LMCS-Paper/Paper.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 12 Aug 2011 22:37:41 +0200
changeset 2985 05ccb61aa628
child 2989 5df574281b69
permissions -rw-r--r--
started lmcs paper (isabelle make lmcs)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2985
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
(*<*)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
theory Paper
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
imports "../Nominal/Nominal2" 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
        "~~/src/HOL/Library/LaTeXsugar"
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
begin
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
consts
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  fv :: "'a \<Rightarrow> 'b"
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  abs_set :: "'a \<Rightarrow> 'b \<Rightarrow> 'c"
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  alpha_bn :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  abs_set2 :: "'a \<Rightarrow> perm \<Rightarrow> 'b \<Rightarrow> 'c"
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  Abs_dist :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  Abs_print :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
definition
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
 "equal \<equiv> (op =)" 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
notation (latex output)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  swap ("'(_ _')" [1000, 1000] 1000) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  fresh ("_ # _" [51, 51] 50) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  fresh_star ("_ #\<^sup>* _" [51, 51] 50) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  supp ("supp _" [78] 73) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  uminus ("-_" [78] 73) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  If  ("if _ then _ else _" 10) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  alpha_set ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set}}$}}>\<^bsup>_, _, _\<^esup> _") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  alpha_lst ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{list}}$}}>\<^bsup>_, _, _\<^esup> _") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  alpha_res ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set+}}$}}>\<^bsup>_, _, _\<^esup> _") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  abs_set2 ("_ \<approx>\<^raw:\raisebox{-1pt}{\makebox[0mm][l]{$\,_{\textit{list}}$}}>\<^bsup>_\<^esup>  _") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  fv ("fa'(_')" [100] 100) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  equal ("=") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  alpha_abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  Abs_set ("[_]\<^bsub>set\<^esub>._" [20, 101] 999) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  Abs_lst ("[_]\<^bsub>list\<^esub>._") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  Abs_dist ("[_]\<^bsub>#list\<^esub>._") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  Abs_res ("[_]\<^bsub>set+\<^esub>._") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  Abs_print ("_\<^bsub>set\<^esub>._") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  Cons ("_::_" [78,77] 73) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  supp_set ("aux _" [1000] 10) and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  alpha_bn ("_ \<approx>bn _")
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
consts alpha_trm ::'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
consts fa_trm :: 'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
consts alpha_trm2 ::'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
consts fa_trm2 :: 'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
consts ast :: 'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
consts ast' :: 'a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
notation (latex output) 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
  alpha_trm ("\<approx>\<^bsub>trm\<^esub>") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  fa_trm ("fa\<^bsub>trm\<^esub>") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  alpha_trm2 ("'(\<approx>\<^bsub>assn\<^esub>, \<approx>\<^bsub>trm\<^esub>')") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  fa_trm2 ("'(fa\<^bsub>assn\<^esub>, fa\<^bsub>trm\<^esub>')") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  ast ("'(as, t')") and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  ast' ("'(as', t\<PRIME> ')")
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
(*>*)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
section {* Introduction *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
  So far, Nominal Isabelle provided a mechanism for constructing
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
  $\alpha$-equated terms, for example lambda-terms,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
  @{text "t ::= x | t t | \<lambda>x. t"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
  where free and bound variables have names.  For such $\alpha$-equated terms,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
  Nominal Isabelle derives automatically a reasoning infrastructure that has
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  been used successfully in formalisations of an equivalence checking
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
  algorithm for LF \cite{UrbanCheneyBerghofer08}, Typed
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
  Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
  \cite{BengtsonParow09} and a strong normalisation result for cut-elimination
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
  in classical logic \cite{UrbanZhu08}. It has also been used by Pollack for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
  formalisations in the locally-nameless approach to binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
  \cite{SatoPollack10}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
  However, Nominal Isabelle has fared less well in a formalisation of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
  the algorithm W \cite{UrbanNipkow09}, where types and type-schemes are,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
  respectively, of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
  \begin{equation}\label{tysch}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  \begin{array}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
  @{text "T ::= x | T \<rightarrow> T"}\hspace{9mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  @{text "S ::= \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. T"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  \end{array}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
  and the @{text "\<forall>"}-quantification binds a finite (possibly empty) set of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
  type-variables.  While it is possible to implement this kind of more general
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  binders by iterating single binders, this leads to a rather clumsy
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  formalisation of W. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  The need of iterating single binders is also one reason
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  why Nominal Isabelle 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
   and similar theorem provers that only provide
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  mechanisms for binding single variables 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  has not fared extremely well with the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  more advanced tasks in the POPLmark challenge \cite{challenge05}, because
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
  also there one would like to bind multiple variables at once. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  Binding multiple variables has interesting properties that cannot be captured
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  easily by iterating single binders. For example in the case of type-schemes we do not
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  want to make a distinction about the order of the bound variables. Therefore
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  we would like to regard the first pair of type-schemes as $\alpha$-equivalent,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
  but assuming that @{text x}, @{text y} and @{text z} are distinct variables,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
  the second pair should \emph{not} be $\alpha$-equivalent:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  \begin{equation}\label{ex1}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
  @{text "\<forall>{x, y}. x \<rightarrow> y  \<approx>\<^isub>\<alpha>  \<forall>{y, x}. y \<rightarrow> x"}\hspace{10mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
  @{text "\<forall>{x, y}. x \<rightarrow> y  \<notapprox>\<^isub>\<alpha>  \<forall>{z}. z \<rightarrow> z"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
  Moreover, we like to regard type-schemes as $\alpha$-equivalent, if they differ
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
  only on \emph{vacuous} binders, such as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
  \begin{equation}\label{ex3}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
  @{text "\<forall>{x}. x \<rightarrow> y  \<approx>\<^isub>\<alpha>  \<forall>{x, z}. x \<rightarrow> y"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
  where @{text z} does not occur freely in the type.  In this paper we will
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
  give a general binding mechanism and associated notion of $\alpha$-equivalence
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
  that can be used to faithfully represent this kind of binding in Nominal
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  Isabelle.  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  The difficulty of finding the right notion for $\alpha$-equivalence
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
  can be appreciated in this case by considering that the definition given by
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
  Leroy in \cite{Leroy92} is incorrect (it omits a side-condition). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
  However, the notion of $\alpha$-equivalence that is preserved by vacuous
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
  binders is not always wanted. For example in terms like
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
  \begin{equation}\label{one}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  @{text "\<LET> x = 3 \<AND> y = 2 \<IN> x - y \<END>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
  we might not care in which order the assignments @{text "x = 3"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  \mbox{@{text "y = 2"}} are given, but it would be often unusual to regard
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
  \eqref{one} as $\alpha$-equivalent with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
  @{text "\<LET> x = 3 \<AND> y = 2 \<AND> z = foo \<IN> x - y \<END>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
  Therefore we will also provide a separate binding mechanism for cases in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  which the order of binders does not matter, but the ``cardinality'' of the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  binders has to agree.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  However, we found that this is still not sufficient for dealing with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
  language constructs frequently occurring in programming language
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  research. For example in @{text "\<LET>"}s containing patterns like
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
  \begin{equation}\label{two}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
  @{text "\<LET> (x, y) = (3, 2) \<IN> x - y \<END>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  we want to bind all variables from the pattern inside the body of the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
  $\mathtt{let}$, but we also care about the order of these variables, since
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
  we do not want to regard \eqref{two} as $\alpha$-equivalent with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
  @{text "\<LET> (y, x) = (3, 2) \<IN> x - y \<END>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
  As a result, we provide three general binding mechanisms each of which binds
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
  multiple variables at once, and let the user chose which one is intended
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
  in a formalisation.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
  %%when formalising a term-calculus.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
  By providing these general binding mechanisms, however, we have to work
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
  around a problem that has been pointed out by Pottier \cite{Pottier06} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
  Cheney \cite{Cheney05}: in @{text "\<LET>"}-constructs of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
  @{text "\<LET> x\<^isub>1 = t\<^isub>1 \<AND> \<dots> \<AND> x\<^isub>n = t\<^isub>n \<IN> s \<END>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  we care about the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
  information that there are as many bound variables @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
  "x\<^isub>i"} as there are @{text "t\<^isub>i"}. We lose this information if
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
  we represent the @{text "\<LET>"}-constructor by something like
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
  @{text "\<LET> (\<lambda>x\<^isub>1\<dots>x\<^isub>n . s)  [t\<^isub>1,\<dots>,t\<^isub>n]"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
  where the notation @{text "\<lambda>_ . _"} indicates that the list of @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  "x\<^isub>i"} becomes bound in @{text s}. In this representation the term
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  \mbox{@{text "\<LET> (\<lambda>x . s)  [t\<^isub>1, t\<^isub>2]"}} is a perfectly legal
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
  instance, but the lengths of the two lists do not agree. To exclude such
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
  terms, additional predicates about well-formed terms are needed in order to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
  ensure that the two lists are of equal length. This can result in very messy
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  reasoning (see for example~\cite{BengtsonParow09}). To avoid this, we will
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
  allow type specifications for @{text "\<LET>"}s as follows
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
  \begin{tabular}{r@ {\hspace{2mm}}r@ {\hspace{2mm}}cl}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
  @{text trm} & @{text "::="}  & @{text "\<dots>"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
              & @{text "|"}  @{text "\<LET>  as::assn  s::trm"}\hspace{2mm} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
                                 \isacommand{bind} @{text "bn(as)"} \isacommand{in} @{text "s"}\\%%%[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
  @{text assn} & @{text "::="} & @{text "\<ANIL>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
               &  @{text "|"}  @{text "\<ACONS>  name  trm  assn"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
  where @{text assn} is an auxiliary type representing a list of assignments
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
  and @{text bn} an auxiliary function identifying the variables to be bound
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
  by the @{text "\<LET>"}. This function can be defined by recursion over @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
  assn} as follows
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
  @{text "bn(\<ANIL>) ="} @{term "{}"} \hspace{5mm} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
  @{text "bn(\<ACONS> x t as) = {x} \<union> bn(as)"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
  The scope of the binding is indicated by labels given to the types, for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
  example @{text "s::trm"}, and a binding clause, in this case
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
  \isacommand{bind} @{text "bn(as)"} \isacommand{in} @{text "s"}. This binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
  clause states that all the names the function @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
  "bn(as)"} returns should be bound in @{text s}.  This style of specifying terms and bindings is heavily
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
  inspired by the syntax of the Ott-tool \cite{ott-jfp}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
  Though, Ott
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
  has only one binding mode, namely the one where the order of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
  binders matters. Consequently, type-schemes with binding sets
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
  of names cannot be modelled in Ott.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
  However, we will not be able to cope with all specifications that are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
  allowed by Ott. One reason is that Ott lets the user specify ``empty'' 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
  types like @{text "t ::= t t | \<lambda>x. t"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
  where no clause for variables is given. Arguably, such specifications make
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
  some sense in the context of Coq's type theory (which Ott supports), but not
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
  at all in a HOL-based environment where every datatype must have a non-empty
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
  set-theoretic model. % \cite{Berghofer99}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
  Another reason is that we establish the reasoning infrastructure
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
  for $\alpha$-\emph{equated} terms. In contrast, Ott produces  a reasoning 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
  infrastructure in Isabelle/HOL for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
  \emph{non}-$\alpha$-equated, or ``raw'', terms. While our $\alpha$-equated terms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
  and the raw terms produced by Ott use names for bound variables,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
  there is a key difference: working with $\alpha$-equated terms means, for example,  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
  that the two type-schemes
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
  @{text "\<forall>{x}. x \<rightarrow> y  = \<forall>{x, z}. x \<rightarrow> y"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
  are not just $\alpha$-equal, but actually \emph{equal}! As a result, we can
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
  only support specifications that make sense on the level of $\alpha$-equated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
  terms (offending specifications, which for example bind a variable according
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
  to a variable bound somewhere else, are not excluded by Ott, but we have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
  to).  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
  Our insistence on reasoning with $\alpha$-equated terms comes from the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
  wealth of experience we gained with the older version of Nominal Isabelle:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
  for non-trivial properties, reasoning with $\alpha$-equated terms is much
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
  easier than reasoning with raw terms. The fundamental reason for this is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
  that the HOL-logic underlying Nominal Isabelle allows us to replace
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
  ``equals-by-equals''. In contrast, replacing
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
  ``$\alpha$-equals-by-$\alpha$-equals'' in a representation based on raw terms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
  requires a lot of extra reasoning work.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
  Although in informal settings a reasoning infrastructure for $\alpha$-equated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
  terms is nearly always taken for granted, establishing it automatically in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
  Isabelle/HOL is a rather non-trivial task. For every
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
  specification we will need to construct type(s) containing as elements the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
  $\alpha$-equated terms. To do so, we use the standard HOL-technique of defining
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
  a new type by identifying a non-empty subset of an existing type.  The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
  construction we perform in Isabelle/HOL can be illustrated by the following picture:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
  \begin{tikzpicture}[scale=0.89]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
  %\draw[step=2mm] (-4,-1) grid (4,1);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
  \draw[very thick] (0.7,0.4) circle (4.25mm);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
  \draw[rounded corners=1mm, very thick] ( 0.0,-0.8) rectangle ( 1.8, 0.9);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
  \draw[rounded corners=1mm, very thick] (-1.95,0.85) rectangle (-2.85,-0.05);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
  \draw (-2.0, 0.845) --  (0.7,0.845);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
  \draw (-2.0,-0.045)  -- (0.7,-0.045);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
  \draw ( 0.7, 0.4) node {\footnotesize\begin{tabular}{@ {}c@ {}}$\alpha$-\\[-1mm]clas.\end{tabular}};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
  \draw (-2.4, 0.4) node {\footnotesize\begin{tabular}{@ {}c@ {}}$\alpha$-eq.\\[-1mm]terms\end{tabular}};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
  \draw (1.8, 0.48) node[right=-0.1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
    {\footnotesize\begin{tabular}{@ {}l@ {}}existing\\[-1mm] type\\ (sets of raw terms)\end{tabular}};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
  \draw (0.9, -0.35) node {\footnotesize\begin{tabular}{@ {}l@ {}}non-empty\\[-1mm]subset\end{tabular}};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
  \draw (-3.25, 0.55) node {\footnotesize\begin{tabular}{@ {}l@ {}}new\\[-1mm]type\end{tabular}};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
  \draw[<->, very thick] (-1.8, 0.3) -- (-0.1,0.3);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
  \draw (-0.95, 0.3) node[above=0mm] {\footnotesize{}isomorphism};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
  \end{tikzpicture}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
  We take as the starting point a definition of raw terms (defined as a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
  datatype in Isabelle/HOL); then identify the $\alpha$-equivalence classes in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
  the type of sets of raw terms according to our $\alpha$-equivalence relation,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
  and finally define the new type as these $\alpha$-equivalence classes
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
  (non-emptiness is satisfied whenever the raw terms are definable as datatype
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
  in Isabelle/HOL and our relation for $\alpha$-equivalence is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
  an equivalence relation).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
  The fact that we obtain an isomorphism between the new type and the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
  non-empty subset shows that the new type is a faithful representation of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
  $\alpha$-equated terms. That is not the case for example for terms using the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
  locally nameless representation of binders \cite{McKinnaPollack99}: in this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
  representation there are ``junk'' terms that need to be excluded by
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
  reasoning about a well-formedness predicate.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
  The problem with introducing a new type in Isabelle/HOL is that in order to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
  be useful, a reasoning infrastructure needs to be ``lifted'' from the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
  underlying subset to the new type. This is usually a tricky and arduous
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
  task. To ease it, we re-implemented in Isabelle/HOL \cite{KaliszykUrban11} the quotient package
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
  described by Homeier \cite{Homeier05} for the HOL4 system. This package
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
  allows us to lift definitions and theorems involving raw terms to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
  definitions and theorems involving $\alpha$-equated terms. For example if we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
  define the free-variable function over raw lambda-terms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
  @{text "fv(x) = {x}"}\hspace{8mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
  @{text "fv(t\<^isub>1 t\<^isub>2) = fv(t\<^isub>1) \<union> fv(t\<^isub>2)"}\hspace{8mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
  @{text "fv(\<lambda>x.t) = fv(t) - {x}"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
  then with the help of the quotient package we can obtain a function @{text "fv\<^sup>\<alpha>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
  operating on quotients, or $\alpha$-equivalence classes of lambda-terms. This
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
  lifted function is characterised by the equations
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
  @{text "fv\<^sup>\<alpha>(x) = {x}"}\hspace{8mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
  @{text "fv\<^sup>\<alpha>(t\<^isub>1 t\<^isub>2) = fv\<^sup>\<alpha>(t\<^isub>1) \<union> fv\<^sup>\<alpha>(t\<^isub>2)"}\hspace{8mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
  @{text "fv\<^sup>\<alpha>(\<lambda>x.t) = fv\<^sup>\<alpha>(t) - {x}"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
  (Note that this means also the term-constructors for variables, applications
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
  and lambda are lifted to the quotient level.)  This construction, of course,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
  only works if $\alpha$-equivalence is indeed an equivalence relation, and the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
  ``raw'' definitions and theorems are respectful w.r.t.~$\alpha$-equivalence.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
  For example, we will not be able to lift a bound-variable function. Although
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
  this function can be defined for raw terms, it does not respect
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
  $\alpha$-equivalence and therefore cannot be lifted. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
  To sum up, every lifting
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
  of theorems to the quotient level needs proofs of some respectfulness
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
  properties (see \cite{Homeier05}). In the paper we show that we are able to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
  automate these proofs and as a result can automatically establish a reasoning 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
  infrastructure for $\alpha$-equated terms.\smallskip
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
  The examples we have in mind where our reasoning infrastructure will be
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
  helpful includes the term language of Core-Haskell. This term language
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
  involves patterns that have lists of type-, coercion- and term-variables,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
  all of which are bound in @{text "\<CASE>"}-expressions. In these
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
  patterns we do not know in advance how many variables need to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
  be bound. Another example is the specification of SML, which includes
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
  includes bindings as in type-schemes.\medskip
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
  {\bf Contributions:}  We provide three new definitions for when terms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
  involving general binders are $\alpha$-equivalent. These definitions are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
  inspired by earlier work of Pitts \cite{Pitts04}. By means of automatic
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
  proofs, we establish a reasoning infrastructure for $\alpha$-equated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
  terms, including properties about support, freshness and equality
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
  conditions for $\alpha$-equated terms. We are also able to derive strong 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
  induction principles that have the variable convention already built in.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
  The method behind our specification of general binders is taken 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
  from the Ott-tool, but we introduce crucial restrictions, and also extensions, so 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
  that our specifications make sense for reasoning about $\alpha$-equated terms.  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
  The main improvement over Ott is that we introduce three binding modes
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
  (only one is present in Ott), provide formalised definitions for $\alpha$-equivalence and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
  for free variables of our terms, and also derive a reasoning infrastructure
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
  for our specifications from ``first principles''.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
  %\begin{figure}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
  %\begin{boxedminipage}{\linewidth}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
  %%\begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
  %\begin{tabular}{r@ {\hspace{1mm}}r@ {\hspace{2mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
  %\multicolumn{3}{@ {}l}{Type Kinds}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
  %@{text "\<kappa>"} & @{text "::="} & @{text "\<star> | \<kappa>\<^isub>1 \<rightarrow> \<kappa>\<^isub>2"}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
  %\multicolumn{3}{@ {}l}{Coercion Kinds}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
  %@{text "\<iota>"} & @{text "::="} & @{text "\<sigma>\<^isub>1 \<sim> \<sigma>\<^isub>2"}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
  %\multicolumn{3}{@ {}l}{Types}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
  %@{text "\<sigma>"} & @{text "::="} & @{text "a | T | \<sigma>\<^isub>1 \<sigma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<sigma>"}}$@{text "\<^sup>n"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
  %@{text "| \<forall>a:\<kappa>. \<sigma> | \<iota> \<Rightarrow> \<sigma>"}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
  %\multicolumn{3}{@ {}l}{Coercion Types}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
  %@{text "\<gamma>"} & @{text "::="} & @{text "c | C | \<gamma>\<^isub>1 \<gamma>\<^isub>2 | S\<^isub>n"}$\;\overline{@{text "\<gamma>"}}$@{text "\<^sup>n"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
  %@{text "| \<forall>c:\<iota>. \<gamma> | \<iota> \<Rightarrow> \<gamma> "}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
  %& @{text "|"} & @{text "refl \<sigma> | sym \<gamma> | \<gamma>\<^isub>1 \<circ> \<gamma>\<^isub>2 | \<gamma> @ \<sigma> | left \<gamma> | right \<gamma>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
  %& @{text "|"} & @{text "\<gamma>\<^isub>1 \<sim> \<gamma>\<^isub>2 | rightc \<gamma> | leftc \<gamma> | \<gamma>\<^isub>1 \<triangleright> \<gamma>\<^isub>2"}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
  %\multicolumn{3}{@ {}l}{Terms}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
  %@{text "e"} & @{text "::="} & @{text "x | K | \<Lambda>a:\<kappa>. e | \<Lambda>c:\<iota>. e | e \<sigma> | e \<gamma>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
  %& @{text "|"} & @{text "\<lambda>x:\<sigma>. e | e\<^isub>1 e\<^isub>2 | \<LET> x:\<sigma> = e\<^isub>1 \<IN> e\<^isub>2"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
  %& @{text "|"} & @{text "\<CASE> e\<^isub>1 \<OF>"}$\;\overline{@{text "p \<rightarrow> e\<^isub>2"}}$ @{text "| e \<triangleright> \<gamma>"}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
  %\multicolumn{3}{@ {}l}{Patterns}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
  %@{text "p"} & @{text "::="} & @{text "K"}$\;\overline{@{text "a:\<kappa>"}}\;\overline{@{text "c:\<iota>"}}\;\overline{@{text "x:\<sigma>"}}$\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
  %\multicolumn{3}{@ {}l}{Constants}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
  %& @{text C} & coercion constants\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
  %& @{text T} & value type constructors\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
  %& @{text "S\<^isub>n"} & n-ary type functions (which need to be fully applied)\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
  %& @{text K} & data constructors\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
  %\multicolumn{3}{@ {}l}{Variables}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  %& @{text a} & type variables\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
  %& @{text c} & coercion variables\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
  %& @{text x} & term variables\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
  %\end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
  %\end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
  %\end{boxedminipage}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
  %\caption{The System @{text "F\<^isub>C"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
  %\cite{CoreHaskell}, also often referred to as \emph{Core-Haskell}. In this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
  %version of @{text "F\<^isub>C"} we made a modification by separating the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
  %grammars for type kinds and coercion kinds, as well as for types and coercion
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
  %types. For this paper the interesting term-constructor is @{text "\<CASE>"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
  %which binds multiple type-, coercion- and term-variables.\label{corehas}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  %\end{figure}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
section {* A Short Review of the Nominal Logic Work *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   429
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   430
  At its core, Nominal Isabelle is an adaption of the nominal logic work by
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
  Pitts \cite{Pitts03}. This adaptation for Isabelle/HOL is described in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   432
  \cite{HuffmanUrban10} (including proofs). We shall briefly review this work
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
  to aid the description of what follows. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
  Two central notions in the nominal logic work are sorted atoms and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
  sort-respecting permutations of atoms. We will use the letters @{text "a,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
  b, c, \<dots>"} to stand for atoms and @{text "p, q, \<dots>"} to stand for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
  permutations. The purpose of atoms is to represent variables, be they bound or free. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
  The sorts of atoms can be used to represent different kinds of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
  variables, such as the term-, coercion- and type-variables in Core-Haskell.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
  It is assumed that there is an infinite supply of atoms for each
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
  sort. In the interest of brevity, we shall restrict ourselves 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
  in what follows to only one sort of atoms.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
  Permutations are bijective functions from atoms to atoms that are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446
  the identity everywhere except on a finite number of atoms. There is a 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
  two-place permutation operation written
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   448
  @{text "_ \<bullet> _  ::  perm \<Rightarrow> \<beta> \<Rightarrow> \<beta>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
  where the generic type @{text "\<beta>"} is the type of the object 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
  over which the permutation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
  acts. In Nominal Isabelle, the identity permutation is written as @{term "0::perm"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
  the composition of two permutations @{term p} and @{term q} as \mbox{@{term "p + q"}}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
  and the inverse permutation of @{term p} as @{text "- p"}. The permutation
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
  operation is defined over the type-hierarchy \cite{HuffmanUrban10};
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   455
  for example permutations acting on products, lists, sets, functions and booleans are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   456
  given by:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   457
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   458
  \begin{equation}\label{permute}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   459
  \mbox{\begin{tabular}{@ {}c@ {\hspace{10mm}}c@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
  @{thm permute_prod.simps[no_vars, THEN eq_reflection]}\\[2mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
  @{thm permute_list.simps(1)[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
  @{thm permute_list.simps(2)[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
  \end{tabular} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
  @{thm permute_set_eq[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
  @{text "p \<bullet> f \<equiv> \<lambda>x. p \<bullet> (f (- p \<bullet> x))"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   468
  @{thm permute_bool_def[no_vars, THEN eq_reflection]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   469
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   471
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
  \mbox{\begin{tabular}{@ {}c@ {\hspace{4mm}}c@ {\hspace{4mm}}c@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
  @{thm permute_prod.simps[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
  @{thm permute_bool_def[no_vars, THEN eq_reflection]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
  \end{tabular} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
  @{thm permute_list.simps(1)[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
  @{thm permute_list.simps(2)[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
  \end{tabular} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   484
  @{thm permute_set_eq[no_vars, THEN eq_reflection]}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
  @{text "p \<bullet> f \<equiv> \<lambda>x. p \<bullet> (f (- p \<bullet> x))"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
  Concrete permutations in Nominal Isabelle are built up from swappings, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
  written as \mbox{@{text "(a b)"}}, which are permutations that behave 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
  as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   495
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   496
  @{text "(a b) = \<lambda>c. if a = c then b else if b = c then a else c"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   497
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
  The most original aspect of the nominal logic work of Pitts is a general
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   500
  definition for the notion of the ``set of free variables of an object @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   501
  "x"}''.  This notion, written @{term "supp x"}, is general in the sense that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
  it applies not only to lambda-terms ($\alpha$-equated or not), but also to lists,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   503
  products, sets and even functions. The definition depends only on the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
  permutation operation and on the notion of equality defined for the type of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
  @{text x}, namely:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   507
  \begin{equation}\label{suppdef}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   508
  @{thm supp_def[no_vars, THEN eq_reflection]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   509
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   512
  There is also the derived notion for when an atom @{text a} is \emph{fresh}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
  for an @{text x}, defined as @{thm fresh_def[no_vars]}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   514
  We use for sets of atoms the abbreviation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   515
  @{thm (lhs) fresh_star_def[no_vars]}, defined as 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
  @{thm (rhs) fresh_star_def[no_vars]}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   517
  A striking consequence of these definitions is that we can prove
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   518
  without knowing anything about the structure of @{term x} that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   519
  swapping two fresh atoms, say @{text a} and @{text b}, leaves 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   520
  @{text x} unchanged, namely if @{text "a \<FRESH> x"} and @{text "b \<FRESH> x"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   521
  then @{term "(a \<rightleftharpoons> b) \<bullet> x = x"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   523
  \begin{myproperty}\label{swapfreshfresh}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   524
  @{thm[mode=IfThen] swap_fresh_fresh[no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   525
  \end{myproperty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   526
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
  While often the support of an object can be relatively easily 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
  described, for example for atoms, products, lists, function applications, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
  booleans and permutations as follows
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
  \begin{tabular}{c@ {\hspace{10mm}}c}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
  \begin{tabular}{rcl}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
  @{term "supp a"} & $=$ & @{term "{a}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
  @{term "supp (x, y)"} & $=$ & @{term "supp x \<union> supp y"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
  @{term "supp []"} & $=$ & @{term "{}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   537
  @{term "supp (x#xs)"} & $=$ & @{term "supp x \<union> supp xs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   538
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
  &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   540
  \begin{tabular}{rcl}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
  @{text "supp (f x)"} & @{text "\<subseteq>"} & @{term "supp f \<union> supp x"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
  @{term "supp b"} & $=$ & @{term "{}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
  @{term "supp p"} & $=$ & @{term "{a. p \<bullet> a \<noteq> a}"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   547
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   548
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
  in some cases it can be difficult to characterise the support precisely, and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
  only an approximation can be established (as for functions above). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
  Reasoning about
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
  such approximations can be simplified with the notion \emph{supports}, defined 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
  as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   555
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   556
  \begin{definition}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
  A set @{text S} \emph{supports} @{text x} if for all atoms @{text a} and @{text b}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
  not in @{text S} we have @{term "(a \<rightleftharpoons> b) \<bullet> x = x"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
  \end{definition}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   560
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   561
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   562
  The main point of @{text supports} is that we can establish the following 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
  two properties.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
  \begin{myproperty}\label{supportsprop}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   566
  Given a set @{text "as"} of atoms.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   567
  {\it (i)} @{thm[mode=IfThen] supp_is_subset[where S="as", no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
  {\it (ii)} @{thm supp_supports[no_vars]}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
  \end{myproperty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
  Another important notion in the nominal logic work is \emph{equivariance}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
  For a function @{text f}, say of type @{text "\<alpha> \<Rightarrow> \<beta>"}, to be equivariant 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
  it is required that every permutation leaves @{text f} unchanged, that is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
  \begin{equation}\label{equivariancedef}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
  @{term "\<forall>p. p \<bullet> f = f"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579
  \noindent or equivalently that a permutation applied to the application
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
  @{text "f x"} can be moved to the argument @{text x}. That means for equivariant
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
  functions @{text f}, we have for all permutations @{text p}:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   583
  \begin{equation}\label{equivariance}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
  @{text "p \<bullet> f = f"} \;\;\;\textit{if and only if}\;\;\;
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   585
  @{text "p \<bullet> (f x) = f (p \<bullet> x)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   586
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
   
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   589
  From property \eqref{equivariancedef} and the definition of @{text supp}, we 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
  can easily deduce that equivariant functions have empty support. There is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
  also a similar notion for equivariant relations, say @{text R}, namely the property
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
  that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   595
  @{text "x R y"} \;\;\textit{implies}\;\; @{text "(p \<bullet> x) R (p \<bullet> y)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   597
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   598
  Using freshness, the nominal logic work provides us with general means for renaming 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   599
  binders. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   600
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   601
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   602
  While in the older version of Nominal Isabelle, we used extensively 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   603
  Property~\ref{swapfreshfresh}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   604
  this property to rename single binders, it this property 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   605
  proved too unwieldy for dealing with multiple binders. For such binders the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   606
  following generalisations turned out to be easier to use.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   607
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   608
  \begin{myproperty}\label{supppermeq}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   609
  @{thm[mode=IfThen] supp_perm_eq[no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   610
  \end{myproperty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   611
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
  \begin{myproperty}\label{avoiding}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
  For a finite set @{text as} and a finitely supported @{text x} with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614
  @{term "as \<sharp>* x"} and also a finitely supported @{text c}, there
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   615
  exists a permutation @{text p} such that @{term "(p \<bullet> as) \<sharp>* c"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   616
  @{term "supp x \<sharp>* p"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   617
  \end{myproperty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   618
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   619
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   620
  The idea behind the second property is that given a finite set @{text as}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   621
  of binders (being bound, or fresh, in @{text x} is ensured by the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   622
  assumption @{term "as \<sharp>* x"}), then there exists a permutation @{text p} such that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   623
  the renamed binders @{term "p \<bullet> as"} avoid @{text c} (which can be arbitrarily chosen
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   624
  as long as it is finitely supported) and also @{text "p"} does not affect anything
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   625
  in the support of @{text x} (that is @{term "supp x \<sharp>* p"}). The last 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   626
  fact and Property~\ref{supppermeq} allow us to ``rename'' just the binders 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   627
  @{text as} in @{text x}, because @{term "p \<bullet> x = x"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   628
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   629
  Most properties given in this section are described in detail in \cite{HuffmanUrban10}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   630
  and all are formalised in Isabelle/HOL. In the next sections we will make 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   631
  extensive use of these properties in order to define $\alpha$-equivalence in 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   632
  the presence of multiple binders.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   633
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   634
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   635
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   636
section {* General Bindings\label{sec:binders} *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   637
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   638
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   639
  In Nominal Isabelle, the user is expected to write down a specification of a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   640
  term-calculus and then a reasoning infrastructure is automatically derived
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   641
  from this specification (remember that Nominal Isabelle is a definitional
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   642
  extension of Isabelle/HOL, which does not introduce any new axioms).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   643
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   644
  In order to keep our work with deriving the reasoning infrastructure
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   645
  manageable, we will wherever possible state definitions and perform proofs
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   646
  on the ``user-level'' of Isabelle/HOL, as opposed to write custom ML-code.  that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   647
  generates them anew for each specification. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   648
  To that end, we will consider
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   649
  first pairs @{text "(as, x)"} of type @{text "(atom set) \<times> \<beta>"}.  These pairs
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   650
  are intended to represent the abstraction, or binding, of the set of atoms @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   651
  "as"} in the body @{text "x"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   652
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   653
  The first question we have to answer is when two pairs @{text "(as, x)"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   654
  @{text "(bs, y)"} are $\alpha$-equivalent? (For the moment we are interested in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
  the notion of $\alpha$-equivalence that is \emph{not} preserved by adding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   656
  vacuous binders.) To answer this question, we identify four conditions: {\it (i)}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   657
  given a free-atom function @{text "fa"} of type \mbox{@{text "\<beta> \<Rightarrow> atom
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   658
  set"}}, then @{text x} and @{text y} need to have the same set of free
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   659
  atoms; moreover there must be a permutation @{text p} such that {\it
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   660
  (ii)} @{text p} leaves the free atoms of @{text x} and @{text y} unchanged, but
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   661
  {\it (iii)} ``moves'' their bound names so that we obtain modulo a relation,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   662
  say \mbox{@{text "_ R _"}}, two equivalent terms. We also require that {\it (iv)}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   663
  @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   664
  requirements {\it (i)} to {\it (iv)} can be stated formally as the conjunction of:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   665
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   666
  \begin{equation}\label{alphaset}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   667
  \begin{array}{@ {\hspace{10mm}}l@ {\hspace{5mm}}l@ {\hspace{10mm}}l@ {\hspace{5mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   668
  \multicolumn{4}{l}{@{term "(as, x) \<approx>set R fa p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   669
       \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   670
       \mbox{\it (iii)} &  @{text "(p \<bullet> x) R y"} \\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   671
       \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* p"} & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   672
       \mbox{\it (iv)}  & @{term "(p \<bullet> as) = bs"} \\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   673
  \end{array}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   674
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   675
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   676
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   677
  Note that this relation depends on the permutation @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   678
  "p"}; $\alpha$-equivalence between two pairs is then the relation where we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   679
  existentially quantify over this @{text "p"}. Also note that the relation is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   680
  dependent on a free-atom function @{text "fa"} and a relation @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   681
  "R"}. The reason for this extra generality is that we will use
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   682
  $\approx_{\,\textit{set}}$ for both ``raw'' terms and $\alpha$-equated terms. In
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   683
  the latter case, @{text R} will be replaced by equality @{text "="} and we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   684
  will prove that @{text "fa"} is equal to @{text "supp"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   685
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   686
  The definition in \eqref{alphaset} does not make any distinction between the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   687
  order of abstracted atoms. If we want this, then we can define $\alpha$-equivalence 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   688
  for pairs of the form \mbox{@{text "(as, x)"}} with type @{text "(atom list) \<times> \<beta>"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   689
  as follows
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   690
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   691
  \begin{equation}\label{alphalist}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   692
  \begin{array}{@ {\hspace{10mm}}l@ {\hspace{5mm}}l@ {\hspace{10mm}}l@ {\hspace{5mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   693
  \multicolumn{4}{l}{@{term "(as, x) \<approx>lst R fa p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   694
         \mbox{\it (i)}   & @{term "fa(x) - (set as) = fa(y) - (set bs)"} & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   695
         \mbox{\it (iii)} & @{text "(p \<bullet> x) R y"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   696
         \mbox{\it (ii)}  & @{term "(fa(x) - set as) \<sharp>* p"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   697
         \mbox{\it (iv)}  & @{term "(p \<bullet> as) = bs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   698
  \end{array}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   699
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   700
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   701
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   702
  where @{term set} is the function that coerces a list of atoms into a set of atoms.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   703
  Now the last clause ensures that the order of the binders matters (since @{text as}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   704
  and @{text bs} are lists of atoms).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   705
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   706
  If we do not want to make any difference between the order of binders \emph{and}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   707
  also allow vacuous binders, that means \emph{restrict} names, then we keep sets of binders, but drop 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   708
  condition {\it (iv)} in \eqref{alphaset}:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   709
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   710
  \begin{equation}\label{alphares}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   711
  \begin{array}{@ {\hspace{10mm}}l@ {\hspace{5mm}}l@ {\hspace{10mm}}l@ {\hspace{5mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   712
  \multicolumn{2}{l}{@{term "(as, x) \<approx>res R fa p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   713
             \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"} & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   714
             \mbox{\it (iii)} & @{text "(p \<bullet> x) R y"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   715
             \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* p"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   716
  \end{array}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   717
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   718
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   719
  It might be useful to consider first some examples how these definitions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   720
  of $\alpha$-equivalence pan out in practice.  For this consider the case of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   721
  abstracting a set of atoms over types (as in type-schemes). We set
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   722
  @{text R} to be the usual equality @{text "="} and for @{text "fa(T)"} we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   723
  define
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   724
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   725
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   726
  @{text "fa(x) = {x}"}  \hspace{5mm} @{text "fa(T\<^isub>1 \<rightarrow> T\<^isub>2) = fa(T\<^isub>1) \<union> fa(T\<^isub>2)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   727
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   728
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   729
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   730
  Now recall the examples shown in \eqref{ex1} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   731
  \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   732
  @{text "({y, x}, y \<rightarrow> x)"} are $\alpha$-equivalent according to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   733
  $\approx_{\,\textit{set}}$ and $\approx_{\,\textit{set+}}$ by taking @{text p} to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   734
  be the swapping @{term "(x \<rightleftharpoons> y)"}. In case of @{text "x \<noteq> y"}, then @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   735
  "([x, y], x \<rightarrow> y)"} $\not\approx_{\,\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   736
  since there is no permutation that makes the lists @{text "[x, y]"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   737
  @{text "[y, x]"} equal, and also leaves the type \mbox{@{text "x \<rightarrow> y"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   738
  unchanged. Another example is @{text "({x}, x)"} $\approx_{\,\textit{set+}}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   739
  @{text "({x, y}, x)"} which holds by taking @{text p} to be the identity
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   740
  permutation.  However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   741
  $\not\approx_{\,\textit{set}}$ @{text "({x, y}, x)"} since there is no
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   742
  permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   743
  (similarly for $\approx_{\,\textit{list}}$).  It can also relatively easily be
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   744
  shown that all three notions of $\alpha$-equivalence coincide, if we only
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   745
  abstract a single atom.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   746
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   747
  In the rest of this section we are going to introduce three abstraction 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   748
  types. For this we define 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   749
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   750
  \begin{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   751
  @{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_set (as, x) equal supp p (bs, x)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   752
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   753
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   754
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   755
  (similarly for $\approx_{\,\textit{abs\_set+}}$ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   756
  and $\approx_{\,\textit{abs\_list}}$). We can show that these relations are equivalence 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   757
  relations. %% and equivariant.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   758
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   759
  \begin{lemma}\label{alphaeq} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   760
  The relations $\approx_{\,\textit{abs\_set}}$, $\approx_{\,\textit{abs\_list}}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   761
  and $\approx_{\,\textit{abs\_set+}}$ are equivalence relations. %, and if 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   762
  %@{term "abs_set (as, x) (bs, y)"} then also 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   763
  %@{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet> bs, p \<bullet> y)"} (similarly for the other two relations).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   764
  \end{lemma}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   765
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   766
  \begin{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   767
  Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   768
  a permutation @{text p} and for the proof obligation take @{term "-p"}. In case 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   769
  of transitivity, we have two permutations @{text p} and @{text q}, and for the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   770
  proof obligation use @{text "q + p"}. All conditions are then by simple
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   771
  calculations. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   772
  \end{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   773
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   774
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   775
  This lemma allows us to use our quotient package for introducing 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   776
  new types @{text "\<beta> abs_set"}, @{text "\<beta> abs_set+"} and @{text "\<beta> abs_list"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   777
  representing $\alpha$-equivalence classes of pairs of type 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   778
  @{text "(atom set) \<times> \<beta>"} (in the first two cases) and of type @{text "(atom list) \<times> \<beta>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   779
  (in the third case). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   780
  The elements in these types will be, respectively, written as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   781
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   782
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   783
  @{term "Abs_set as x"}, \hspace{5mm} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   784
  @{term "Abs_res as x"} and \hspace{5mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   785
  @{term "Abs_lst as x"}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   786
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   787
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   788
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   789
  indicating that a set (or list) of atoms @{text as} is abstracted in @{text x}. We will
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   790
  call the types \emph{abstraction types} and their elements
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   791
  \emph{abstractions}. The important property we need to derive is the support of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   792
  abstractions, namely:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   793
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   794
  \begin{theorem}[Support of Abstractions]\label{suppabs} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   795
  Assuming @{text x} has finite support, then
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   796
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   797
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   798
  \begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   799
  @{thm (lhs) supp_Abs(1)[no_vars]} $\;\;=\;\;$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   800
  @{thm (lhs) supp_Abs(2)[no_vars]} $\;\;=\;\;$ @{thm (rhs) supp_Abs(2)[no_vars]}, and\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   801
  @{thm (lhs) supp_Abs(3)[where bs="bs", no_vars]} $\;\;=\;\;$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   802
  @{thm (rhs) supp_Abs(3)[where bs="bs", no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   803
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   804
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   805
  \end{theorem}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   806
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   807
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   808
  This theorem states that the bound names do not appear in the support.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   809
  For brevity we omit the proof and again refer the reader to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   810
  our formalisation in Isabelle/HOL.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   811
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   812
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   813
  Below we will show the first equation. The others 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   814
  follow by similar arguments. By definition of the abstraction type @{text "abs_set"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   815
  we have 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   816
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   817
  \begin{equation}\label{abseqiff}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   818
  @{thm (lhs) Abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\text{if and only if}\;\; 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   819
  @{thm (rhs) Abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   820
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   821
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   822
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   823
  and also
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   824
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   825
  \begin{equation}\label{absperm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   826
  @{thm permute_Abs[no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   827
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   828
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   829
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   830
  The second fact derives from the definition of permutations acting on pairs 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   831
  \eqref{permute} and $\alpha$-equivalence being equivariant 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   832
  (see Lemma~\ref{alphaeq}). With these two facts at our disposal, we can show 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   833
  the following lemma about swapping two atoms in an abstraction.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   834
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   835
  \begin{lemma}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   836
  @{thm[mode=IfThen] Abs_swap1(1)[where bs="as", no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   837
  \end{lemma}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   838
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   839
  \begin{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   840
  This lemma is straightforward using \eqref{abseqiff} and observing that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   841
  the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   842
  Moreover @{text supp} and set difference are equivariant (see \cite{HuffmanUrban10}).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   843
  \end{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   844
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   845
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   846
  Assuming that @{text "x"} has finite support, this lemma together 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   847
  with \eqref{absperm} allows us to show
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   848
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   849
  \begin{equation}\label{halfone}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   850
  @{thm Abs_supports(1)[no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   851
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   852
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   853
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   854
  which by Property~\ref{supportsprop} gives us ``one half'' of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   855
  Theorem~\ref{suppabs}. The ``other half'' is a bit more involved. To establish 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   856
  it, we use a trick from \cite{Pitts04} and first define an auxiliary 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   857
  function @{text aux}, taking an abstraction as argument:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   858
  @{thm supp_set.simps[THEN eq_reflection, no_vars]}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   859
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   860
  Using the second equation in \eqref{equivariance}, we can show that 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   861
  @{text "aux"} is equivariant (since @{term "p \<bullet> (supp x - as) = (supp (p \<bullet> x)) - (p \<bullet> as)"}) 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   862
  and therefore has empty support. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   863
  This in turn means
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   864
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   865
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   866
  @{term "supp (supp_gen (Abs_set as x)) \<subseteq> supp (Abs_set as x)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   867
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   868
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   869
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   870
  using \eqref{suppfun}. Assuming @{term "supp x - as"} is a finite set,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   871
  we further obtain
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   872
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   873
  \begin{equation}\label{halftwo}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   874
  @{thm (concl) Abs_supp_subset1(1)[no_vars]}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   875
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   876
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   877
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   878
  since for finite sets of atoms, @{text "bs"}, we have 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   879
  @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   880
  Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   881
  Theorem~\ref{suppabs}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   882
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   883
  The method of first considering abstractions of the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   884
  form @{term "Abs_set as x"} etc is motivated by the fact that 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   885
  we can conveniently establish  at the Isabelle/HOL level
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   886
  properties about them.  It would be
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   887
  laborious to write custom ML-code that derives automatically such properties 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   888
  for every term-constructor that binds some atoms. Also the generality of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   889
  the definitions for $\alpha$-equivalence will help us in the next sections.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   890
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   891
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   892
section {* Specifying General Bindings\label{sec:spec} *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   893
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   894
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   895
  Our choice of syntax for specifications is influenced by the existing
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   896
  datatype package of Isabelle/HOL \cite{Berghofer99} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   897
  and by the syntax of the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   898
  Ott-tool \cite{ott-jfp}. For us a specification of a term-calculus is a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   899
  collection of (possibly mutual recursive) type declarations, say @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   900
  "ty\<AL>\<^isub>1, \<dots>, ty\<AL>\<^isub>n"}, and an associated collection of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   901
  binding functions, say @{text "bn\<AL>\<^isub>1, \<dots>, bn\<AL>\<^isub>m"}. The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   902
  syntax in Nominal Isabelle for such specifications is roughly as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   903
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   904
  \begin{equation}\label{scheme}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   905
  \mbox{\begin{tabular}{@ {}p{2.5cm}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   906
  type \mbox{declaration part} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   907
  $\begin{cases}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   908
  \mbox{\small\begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   909
  \isacommand{nominal\_datatype} @{text "ty\<AL>\<^isub>1 = \<dots>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   910
  \isacommand{and} @{text "ty\<AL>\<^isub>2 = \<dots>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   911
  \raisebox{2mm}{$\ldots$}\\[-2mm] 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   912
  \isacommand{and} @{text "ty\<AL>\<^isub>n = \<dots>"}\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   913
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   914
  \end{cases}$\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   915
  binding \mbox{function part} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   916
  $\begin{cases}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   917
  \mbox{\small\begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   918
  \isacommand{binder} @{text "bn\<AL>\<^isub>1"} \isacommand{and} \ldots \isacommand{and} @{text "bn\<AL>\<^isub>m"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   919
  \isacommand{where}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   920
  \raisebox{2mm}{$\ldots$}\\[-2mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   921
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   922
  \end{cases}$\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   923
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   924
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   925
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   926
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   927
  Every type declaration @{text ty}$^\alpha_{1..n}$ consists of a collection of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   928
  term-constructors, each of which comes with a list of labelled 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   929
  types that stand for the types of the arguments of the term-constructor.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   930
  For example a term-constructor @{text "C\<^sup>\<alpha>"} might be specified with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   931
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   932
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   933
  @{text "C\<^sup>\<alpha> label\<^isub>1::ty"}$'_1$ @{text "\<dots> label\<^isub>l::ty"}$'_l\;\;$  @{text "binding_clauses"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   934
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   935
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   936
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   937
  whereby some of the @{text ty}$'_{1..l}$ (or their components) 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   938
  can be contained
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   939
  in the collection of @{text ty}$^\alpha_{1..n}$ declared in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   940
  \eqref{scheme}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   941
  In this case we will call the corresponding argument a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   942
  \emph{recursive argument} of @{text "C\<^sup>\<alpha>"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   943
  The types of such recursive 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   944
  arguments need to satisfy a  ``positivity''
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   945
  restriction, which ensures that the type has a set-theoretic semantics 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   946
  \cite{Berghofer99}.  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   947
  The labels
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   948
  annotated on the types are optional. Their purpose is to be used in the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   949
  (possibly empty) list of \emph{binding clauses}, which indicate the binders
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   950
  and their scope in a term-constructor.  They come in three \emph{modes}:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   951
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   952
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   953
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   954
  \isacommand{bind} {\it binders} \isacommand{in} {\it bodies}\;\;\;\,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   955
  \isacommand{bind (set)} {\it binders} \isacommand{in} {\it bodies}\;\;\;\,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   956
  \isacommand{bind (set+)} {\it binders} \isacommand{in} {\it bodies}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   957
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   958
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   959
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   960
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   961
  The first mode is for binding lists of atoms (the order of binders matters);
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   962
  the second is for sets of binders (the order does not matter, but the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   963
  cardinality does) and the last is for sets of binders (with vacuous binders
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   964
  preserving $\alpha$-equivalence). As indicated, the labels in the ``\isacommand{in}-part'' of a binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   965
  clause will be called \emph{bodies}; the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   966
  ``\isacommand{bind}-part'' will be called \emph{binders}. In contrast to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   967
  Ott, we allow multiple labels in binders and bodies. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   968
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   969
  For example we allow
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   970
  binding clauses of the form:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   971
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   972
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   973
  \begin{tabular}{@ {}ll@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   974
  @{text "Foo\<^isub>1 x::name y::name t::trm s::trm"} &  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   975
      \isacommand{bind} @{text "x y"} \isacommand{in} @{text "t s"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   976
  @{text "Foo\<^isub>2 x::name y::name t::trm s::trm"} &  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   977
      \isacommand{bind} @{text "x y"} \isacommand{in} @{text "t"}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   978
      \isacommand{bind} @{text "x y"} \isacommand{in} @{text "s"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   979
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   980
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   981
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   982
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   983
  Similarly for the other binding modes. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   984
  Interestingly, in case of \isacommand{bind (set)}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   985
  and \isacommand{bind (set+)} the binding clauses above will make a difference to the semantics
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   986
  of the specifications (the corresponding $\alpha$-equivalence will differ). We will 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   987
  show this later with an example.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   988
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   989
  There are also some restrictions we need to impose on our binding clauses in comparison to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   990
  the ones of Ott. The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   991
  main idea behind these restrictions is that we obtain a sensible notion of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   992
  $\alpha$-equivalence where it is ensured that within a given scope an 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   993
  atom occurrence cannot be both bound and free at the same time.  The first
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   994
  restriction is that a body can only occur in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   995
  \emph{one} binding clause of a term constructor (this ensures that the bound
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   996
  atoms of a body cannot be free at the same time by specifying an
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   997
  alternative binder for the same body). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   998
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   999
  For binders we distinguish between
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1000
  \emph{shallow} and \emph{deep} binders.  Shallow binders are just
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1001
  labels. The restriction we need to impose on them is that in case of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1002
  \isacommand{bind (set)} and \isacommand{bind (set+)} the labels must either
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1003
  refer to atom types or to sets of atom types; in case of \isacommand{bind}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1004
  the labels must refer to atom types or lists of atom types. Two examples for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1005
  the use of shallow binders are the specification of lambda-terms, where a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1006
  single name is bound, and type-schemes, where a finite set of names is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1007
  bound:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1008
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1009
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1010
  \begin{tabular}{@ {}c@ {\hspace{7mm}}c@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1011
  \begin{tabular}{@ {}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1012
  \isacommand{nominal\_datatype} @{text lam} $=$\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1013
  \hspace{2mm}\phantom{$\mid$}~@{text "Var name"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1014
  \hspace{2mm}$\mid$~@{text "App lam lam"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1015
  \hspace{2mm}$\mid$~@{text "Lam x::name t::lam"}~~\isacommand{bind} @{text x} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1016
  \end{tabular} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1017
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1018
  \isacommand{nominal\_datatype}~@{text ty} $=$\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1019
  \hspace{5mm}\phantom{$\mid$}~@{text "TVar name"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1020
  \hspace{5mm}$\mid$~@{text "TFun ty ty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1021
  \isacommand{and}~@{text "tsc = All xs::(name fset) T::ty"}~~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1022
  \isacommand{bind (set+)} @{text xs} \isacommand{in} @{text T}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1023
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1024
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1025
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1026
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1027
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1028
  In these specifications @{text "name"} refers to an atom type, and @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1029
  "fset"} to the type of finite sets.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1030
  Note that for @{text lam} it does not matter which binding mode we use. The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1031
  reason is that we bind only a single @{text name}. However, having
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1032
  \isacommand{bind (set)} or \isacommand{bind} in the second case makes a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1033
  difference to the semantics of the specification (which we will define in the next section).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1034
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1035
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1036
  A \emph{deep} binder uses an auxiliary binding function that ``picks'' out
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1037
  the atoms in one argument of the term-constructor, which can be bound in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1038
  other arguments and also in the same argument (we will call such binders
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1039
  \emph{recursive}, see below). The binding functions are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1040
  expected to return either a set of atoms (for \isacommand{bind (set)} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1041
  \isacommand{bind (set+)}) or a list of atoms (for \isacommand{bind}). They can
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1042
  be defined by recursion over the corresponding type; the equations
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1043
  must be given in the binding function part of the scheme shown in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1044
  \eqref{scheme}. For example a term-calculus containing @{text "Let"}s with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1045
  tuple patterns might be specified as:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1046
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1047
  \begin{equation}\label{letpat}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1048
  \mbox{\small%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1049
  \begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1050
  \isacommand{nominal\_datatype} @{text trm} $=$\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1051
  \hspace{5mm}\phantom{$\mid$}~@{term "Var name"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1052
  \hspace{5mm}$\mid$~@{term "App trm trm"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1053
  \hspace{5mm}$\mid$~@{text "Lam x::name t::trm"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1054
     \;\;\isacommand{bind} @{text x} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1055
  \hspace{5mm}$\mid$~@{text "Let p::pat trm t::trm"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1056
     \;\;\isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1057
  \isacommand{and} @{text pat} $=$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1058
  @{text PNil}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1059
  $\mid$~@{text "PVar name"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1060
  $\mid$~@{text "PTup pat pat"}\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1061
  \isacommand{binder}~@{text "bn::pat \<Rightarrow> atom list"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1062
  \isacommand{where}~@{text "bn(PNil) = []"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1063
  \hspace{5mm}$\mid$~@{text "bn(PVar x) = [atom x]"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1064
  \hspace{5mm}$\mid$~@{text "bn(PTup p\<^isub>1 p\<^isub>2) = bn(p\<^isub>1) @ bn(p\<^isub>2)"}\smallskip\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1065
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1066
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1067
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1068
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1069
  In this specification the function @{text "bn"} determines which atoms of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1070
  the pattern @{text p} are bound in the argument @{text "t"}. Note that in the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1071
  second-last @{text bn}-clause the function @{text "atom"} coerces a name
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1072
  into the generic atom type of Nominal Isabelle \cite{HuffmanUrban10}. This
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1073
  allows us to treat binders of different atom type uniformly.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1074
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1075
  As said above, for deep binders we allow binding clauses such as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1076
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1077
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1078
  \begin{tabular}{ll}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1079
  @{text "Bar p::pat t::trm"} &  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1080
     \isacommand{bind} @{text "bn(p)"} \isacommand{in} @{text "p t"} \\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1081
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1082
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1083
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1084
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1085
  where the argument of the deep binder also occurs in the body. We call such
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1086
  binders \emph{recursive}.  To see the purpose of such recursive binders,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1087
  compare ``plain'' @{text "Let"}s and @{text "Let_rec"}s in the following
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1088
  specification:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1089
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1090
  \begin{equation}\label{letrecs}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1091
  \mbox{\small%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1092
  \begin{tabular}{@ {}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1093
  \isacommand{nominal\_datatype}~@{text "trm ="}~\ldots\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1094
  \hspace{5mm}$\mid$~@{text "Let as::assn t::trm"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1095
     \;\;\isacommand{bind} @{text "bn(as)"} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1096
  \hspace{5mm}$\mid$~@{text "Let_rec as::assn t::trm"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1097
     \;\;\isacommand{bind} @{text "bn(as)"} \isacommand{in} @{text "as t"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1098
  \isacommand{and} @{text "assn"} $=$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1099
  @{text "ANil"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1100
  $\mid$~@{text "ACons name trm assn"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1101
  \isacommand{binder} @{text "bn::assn \<Rightarrow> atom list"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1102
  \isacommand{where}~@{text "bn(ANil) = []"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1103
  \hspace{5mm}$\mid$~@{text "bn(ACons a t as) = [atom a] @ bn(as)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1104
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1105
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1106
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1107
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1108
  The difference is that with @{text Let} we only want to bind the atoms @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1109
  "bn(as)"} in the term @{text t}, but with @{text "Let_rec"} we also want to bind the atoms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1110
  inside the assignment. This difference has consequences for the associated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1111
  notions of free-atoms and $\alpha$-equivalence.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1112
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1113
  To make sure that atoms bound by deep binders cannot be free at the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1114
  same time, we cannot have more than one binding function for a deep binder. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1115
  Consequently we exclude specifications such as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1116
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1117
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1118
  \begin{tabular}{@ {}l@ {\hspace{2mm}}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1119
  @{text "Baz\<^isub>1 p::pat t::trm"} & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1120
     \isacommand{bind} @{text "bn\<^isub>1(p) bn\<^isub>2(p)"} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1121
  @{text "Baz\<^isub>2 p::pat t\<^isub>1::trm t\<^isub>2::trm"} & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1122
     \isacommand{bind} @{text "bn\<^isub>1(p)"} \isacommand{in} @{text "t\<^isub>1"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1123
     \isacommand{bind} @{text "bn\<^isub>2(p)"} \isacommand{in} @{text "t\<^isub>2"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1124
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1125
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1126
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1127
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1128
  Otherwise it is possible that @{text "bn\<^isub>1"} and @{text "bn\<^isub>2"}  pick 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1129
  out different atoms to become bound, respectively be free, in @{text "p"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1130
  (Since the Ott-tool does not derive a reasoning infrastructure for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1131
  $\alpha$-equated terms with deep binders, it can permit such specifications.)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1132
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1133
  We also need to restrict the form of the binding functions in order 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1134
  to ensure the @{text "bn"}-functions can be defined for $\alpha$-equated 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1135
  terms. The main restriction is that we cannot return an atom in a binding function that is also
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1136
  bound in the corresponding term-constructor. That means in \eqref{letpat} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1137
  that the term-constructors @{text PVar} and @{text PTup} may
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1138
  not have a binding clause (all arguments are used to define @{text "bn"}).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1139
  In contrast, in case of \eqref{letrecs} the term-constructor @{text ACons}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1140
  may have a binding clause involving the argument @{text trm} (the only one that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1141
  is \emph{not} used in the definition of the binding function). This restriction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1142
  is sufficient for lifting the binding function to $\alpha$-equated terms.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1143
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1144
  In the version of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1145
  Nominal Isabelle described here, we also adopted the restriction from the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1146
  Ott-tool that binding functions can only return: the empty set or empty list
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1147
  (as in case @{text PNil}), a singleton set or singleton list containing an
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1148
  atom (case @{text PVar}), or unions of atom sets or appended atom lists
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1149
  (case @{text PTup}). This restriction will simplify some automatic definitions and proofs
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1150
  later on.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1151
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1152
  In order to simplify our definitions of free atoms and $\alpha$-equivalence, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1153
  we shall assume specifications 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1154
  of term-calculi are implicitly \emph{completed}. By this we mean that  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1155
  for every argument of a term-constructor that is \emph{not} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1156
  already part of a binding clause given by the user, we add implicitly a special \emph{empty} binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1157
  clause, written \isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "labels"}. In case
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1158
  of the lambda-terms, the completion produces
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1159
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1160
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1161
  \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1162
  \isacommand{nominal\_datatype} @{text lam} =\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1163
  \hspace{5mm}\phantom{$\mid$}~@{text "Var x::name"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1164
    \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "x"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1165
  \hspace{5mm}$\mid$~@{text "App t\<^isub>1::lam t\<^isub>2::lam"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1166
    \;\;\isacommand{bind}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>1 t\<^isub>2"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1167
  \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1168
    \;\;\isacommand{bind}~@{text x} \isacommand{in} @{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1169
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1170
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1171
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1172
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1173
  The point of completion is that we can make definitions over the binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1174
  clauses and be sure to have captured all arguments of a term constructor. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1175
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1176
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1177
section {* Alpha-Equivalence and Free Atoms\label{sec:alpha} *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1178
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1179
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1180
  Having dealt with all syntax matters, the problem now is how we can turn
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1181
  specifications into actual type definitions in Isabelle/HOL and then
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1182
  establish a reasoning infrastructure for them. As
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1183
  Pottier and Cheney pointed out \cite{Pottier06,Cheney05}, just 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1184
  re-arranging the arguments of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1185
  term-constructors so that binders and their bodies are next to each other will 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1186
  result in inadequate representations in cases like @{text "Let x\<^isub>1 = t\<^isub>1\<dots>x\<^isub>n = t\<^isub>n in s"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1187
  Therefore we will first
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1188
  extract ``raw'' datatype definitions from the specification and then define 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1189
  explicitly an $\alpha$-equivalence relation over them. We subsequently
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1190
  construct the quotient of the datatypes according to our $\alpha$-equivalence.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1191
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1192
  The ``raw'' datatype definition can be obtained by stripping off the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1193
  binding clauses and the labels from the types. We also have to invent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1194
  new names for the types @{text "ty\<^sup>\<alpha>"} and term-constructors @{text "C\<^sup>\<alpha>"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1195
  given by the user. In our implementation we just use the affix ``@{text "_raw"}''.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1196
  But for the purpose of this paper, we use the superscript @{text "_\<^sup>\<alpha>"} to indicate 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1197
  that a notion is given for $\alpha$-equivalence classes and leave it out 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1198
  for the corresponding notion given on the ``raw'' level. So for example 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1199
  we have @{text "ty\<^sup>\<alpha> \<mapsto> ty"} and @{text "C\<^sup>\<alpha> \<mapsto> C"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1200
  where @{term ty} is the type used in the quotient construction for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1201
  @{text "ty\<^sup>\<alpha>"} and @{text "C"} is the term-constructor on the ``raw'' type @{text "ty"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1202
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1203
  The resulting datatype definition is legal in Isabelle/HOL provided the datatypes are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1204
  non-empty and the types in the constructors only occur in positive 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1205
  position (see \cite{Berghofer99} for an in-depth description of the datatype package
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1206
  in Isabelle/HOL). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1207
  We subsequently define each of the user-specified binding 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1208
  functions @{term "bn"}$_{1..m}$ by recursion over the corresponding 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1209
  raw datatype. We can also easily define permutation operations by 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1210
  recursion so that for each term constructor @{text "C"} we have that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1211
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1212
  \begin{equation}\label{ceqvt}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1213
  @{text "p \<bullet> (C z\<^isub>1 \<dots> z\<^isub>n) = C (p \<bullet> z\<^isub>1) \<dots> (p \<bullet> z\<^isub>n)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1214
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1215
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1216
  The first non-trivial step we have to perform is the generation of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1217
  free-atom functions from the specification. For the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1218
  \emph{raw} types @{text "ty"}$_{1..n}$ we define the free-atom functions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1219
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1220
  \begin{equation}\label{fvars}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1221
  \mbox{@{text "fa_ty"}$_{1..n}$}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1222
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1223
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1224
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1225
  by recursion.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1226
  We define these functions together with auxiliary free-atom functions for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1227
  the binding functions. Given raw binding functions @{text "bn"}$_{1..m}$ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1228
  we define
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1229
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1230
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1231
  @{text "fa_bn"}$_{1..m}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1232
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1233
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1234
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1235
  The reason for this setup is that in a deep binder not all atoms have to be
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1236
  bound, as we saw in the example with ``plain'' @{text Let}s. We need therefore a function
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1237
  that calculates those free atoms in a deep binder.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1238
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1239
  While the idea behind these free-atom functions is clear (they just
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1240
  collect all atoms that are not bound), because of our rather complicated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1241
  binding mechanisms their definitions are somewhat involved.  Given
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1242
  a term-constructor @{text "C"} of type @{text ty} and some associated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1243
  binding clauses @{text "bc\<^isub>1\<dots>bc\<^isub>k"}, the result of @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1244
  "fa_ty (C z\<^isub>1 \<dots> z\<^isub>n)"} will be the union @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1245
  "fa(bc\<^isub>1) \<union> \<dots> \<union> fa(bc\<^isub>k)"} where we will define below what @{text "fa"} for a binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1246
  clause means. We only show the details for the mode \isacommand{bind (set)} (the other modes are similar). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1247
  Suppose the binding clause @{text bc\<^isub>i} is of the form 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1248
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1249
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1250
  \mbox{\isacommand{bind (set)} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1251
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1252
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1253
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1254
  in which the body-labels @{text "d"}$_{1..q}$ refer to types @{text ty}$_{1..q}$,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1255
  and the binders @{text b}$_{1..p}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1256
  either refer to labels of atom types (in case of shallow binders) or to binding 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1257
  functions taking a single label as argument (in case of deep binders). Assuming 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1258
  @{text "D"} stands for the set of free atoms of the bodies, @{text B} for the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1259
  set of binding atoms in the binders and @{text "B'"} for the set of free atoms in 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1260
  non-recursive deep binders,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1261
  then the free atoms of the binding clause @{text bc\<^isub>i} are\\[-2mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1262
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1263
  \begin{equation}\label{fadef}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1264
  \mbox{@{text "fa(bc\<^isub>i) \<equiv> (D - B) \<union> B'"}}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1265
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1266
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1267
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1268
  The set @{text D} is formally defined as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1269
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1270
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1271
  @{text "D \<equiv> fa_ty\<^isub>1 d\<^isub>1 \<union> ... \<union> fa_ty\<^isub>q d\<^isub>q"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1272
  \end{center} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1273
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1274
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1275
  where in case @{text "d\<^isub>i"} refers to one of the raw types @{text "ty"}$_{1..n}$ from the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1276
  specification, the function @{text "fa_ty\<^isub>i"} is the corresponding free-atom function 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1277
  we are defining by recursion; 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1278
  (see \eqref{fvars}); 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1279
  otherwise we set @{text "fa_ty\<^isub>i d\<^isub>i = supp d\<^isub>i"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1280
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1281
  In order to formally define the set @{text B} we use the following auxiliary @{text "bn"}-functions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1282
  for atom types to which shallow binders may refer\\[-4mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1283
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1284
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1285
  \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1286
  @{text "bn_atom a"} & @{text "\<equiv>"} & @{text "{atom a}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1287
  @{text "bn_atom_set as"} & @{text "\<equiv>"} & @{text "atoms as"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1288
  @{text "bn_atom_list as"} & @{text "\<equiv>"} & @{text "atoms (set as)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1289
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1290
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1291
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1292
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1293
  @{text "bn\<^bsub>atom\<^esub> a \<equiv> {atom a}"}\hfill
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1294
  @{text "bn\<^bsub>atom_set\<^esub> as \<equiv> atoms as"}\hfill
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1295
  @{text "bn\<^bsub>atom_list\<^esub> as \<equiv> atoms (set as)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1296
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1297
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1298
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1299
  Like the function @{text atom}, the function @{text "atoms"} coerces 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1300
  a set of atoms to a set of the generic atom type. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1301
  It is defined as  @{text "atoms as \<equiv> {atom a | a \<in> as}"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1302
  The set @{text B} is then formally defined as\\[-4mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1303
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1304
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1305
  @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> ... \<union> bn_ty\<^isub>p b\<^isub>p"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1306
  \end{center} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1307
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1308
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1309
  where we use the auxiliary binding functions for shallow binders. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1310
  The set @{text "B'"} collects all free atoms in non-recursive deep
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1311
  binders. Let us assume these binders in @{text "bc\<^isub>i"} are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1312
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1313
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1314
  \mbox{@{text "bn\<^isub>1 l\<^isub>1, \<dots>, bn\<^isub>r l\<^isub>r"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1315
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1316
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1317
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1318
  with @{text "l"}$_{1..r}$ $\subseteq$ @{text "b"}$_{1..p}$ and none of the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1319
  @{text "l"}$_{1..r}$ being among the bodies @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1320
  "d"}$_{1..q}$. The set @{text "B'"} is defined as\\[-5mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1321
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1322
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1323
  @{text "B' \<equiv> fa_bn\<^isub>1 l\<^isub>1 \<union> ... \<union> fa_bn\<^isub>r l\<^isub>r"}\\[-9mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1324
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1325
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1326
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1327
  This completes the definition of the free-atom functions @{text "fa_ty"}$_{1..n}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1328
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1329
  Note that for non-recursive deep binders, we have to add in \eqref{fadef}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1330
  the set of atoms that are left unbound by the binding functions @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1331
  "bn"}$_{1..m}$. We used for the definition of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1332
  this set the functions @{text "fa_bn"}$_{1..m}$, which are also defined by mutual
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1333
  recursion. Assume the user specified a @{text bn}-clause of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1334
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1335
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1336
  @{text "bn (C z\<^isub>1 \<dots> z\<^isub>s) = rhs"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1337
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1338
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1339
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1340
  where the @{text "z"}$_{1..s}$ are of types @{text "ty"}$_{1..s}$. For each of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1341
  the arguments we calculate the free atoms as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1342
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1343
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1344
  \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1345
  $\bullet$ & @{term "fa_ty\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text "rhs"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1346
  (that means nothing is bound in @{text "z\<^isub>i"} by the binding function),\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1347
  $\bullet$ & @{term "fa_bn\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1348
  with the recursive call @{text "bn\<^isub>i z\<^isub>i"}, and\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1349
  $\bullet$ & @{term "{}"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1350
  but without a recursive call.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1351
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1352
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1353
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1354
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1355
  For defining @{text "fa_bn (C z\<^isub>1 \<dots> z\<^isub>n)"} we just union up all these sets.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1356
 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1357
  To see how these definitions work in practice, let us reconsider the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1358
  term-constructors @{text "Let"} and @{text "Let_rec"} shown in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1359
  \eqref{letrecs} together with the term-constructors for assignments @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1360
  "ANil"} and @{text "ACons"}. Since there is a binding function defined for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1361
  assignments, we have three free-atom functions, namely @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1362
  "fa\<^bsub>trm\<^esub>"}, @{text "fa\<^bsub>assn\<^esub>"} and @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1363
  "fa\<^bsub>bn\<^esub>"} as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1364
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1365
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1366
  \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1mm}}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1367
  @{text "fa\<^bsub>trm\<^esub> (Let as t)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t - set (bn as)) \<union> fa\<^bsub>bn\<^esub> as"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1368
  @{text "fa\<^bsub>trm\<^esub> (Let_rec as t)"} & @{text "="} & @{text "(fa\<^bsub>assn\<^esub> as \<union> fa\<^bsub>trm\<^esub> t) - set (bn as)"}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1369
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1370
  @{text "fa\<^bsub>assn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1371
  @{text "fa\<^bsub>assn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(supp a) \<union> (fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>assn\<^esub> as)"}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1372
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1373
  @{text "fa\<^bsub>bn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1374
  @{text "fa\<^bsub>bn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>bn\<^esub> as)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1375
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1376
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1377
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1378
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1379
  Recall that @{text ANil} and @{text "ACons"} have no
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1380
  binding clause in the specification. The corresponding free-atom
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1381
  function @{text "fa\<^bsub>assn\<^esub>"} therefore returns all free atoms
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1382
  of an assignment (in case of @{text "ACons"}, they are given in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1383
  terms of @{text supp}, @{text "fa\<^bsub>trm\<^esub>"} and @{text "fa\<^bsub>assn\<^esub>"}). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1384
  The binding only takes place in @{text Let} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1385
  @{text "Let_rec"}. In case of @{text "Let"}, the binding clause specifies
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1386
  that all atoms given by @{text "set (bn as)"} have to be bound in @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1387
  t}. Therefore we have to subtract @{text "set (bn as)"} from @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1388
  "fa\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1389
  free in @{text "as"}. This is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1390
  in contrast with @{text "Let_rec"} where we have a recursive
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1391
  binder to bind all occurrences of the atoms in @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1392
  "set (bn as)"} also inside @{text "as"}. Therefore we have to subtract
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1393
  @{text "set (bn as)"} from both @{text "fa\<^bsub>trm\<^esub> t"} and @{text "fa\<^bsub>assn\<^esub> as"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1394
  Like the function @{text "bn"}, the function @{text "fa\<^bsub>bn\<^esub>"} traverses the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1395
  list of assignments, but instead returns the free atoms, which means in this 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1396
  example the free atoms in the argument @{text "t"}.  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1397
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1398
  An interesting point in this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1399
  example is that a ``naked'' assignment (@{text "ANil"} or @{text "ACons"}) does not bind any
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1400
  atoms, even if the binding function is specified over assignments. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1401
  Only in the context of a @{text Let} or @{text "Let_rec"}, where the binding clauses are given, will
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1402
  some atoms actually become bound.  This is a phenomenon that has also been pointed
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1403
  out in \cite{ott-jfp}. For us this observation is crucial, because we would 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1404
  not be able to lift the @{text "bn"}-functions to $\alpha$-equated terms if they act on 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1405
  atoms that are bound. In that case, these functions would \emph{not} respect
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1406
  $\alpha$-equivalence.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1407
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1408
  Next we define the $\alpha$-equivalence relations for the raw types @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1409
  "ty"}$_{1..n}$ from the specification. We write them as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1410
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1411
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1412
  @{text "\<approx>ty"}$_{1..n}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1413
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1414
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1415
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1416
  Like with the free-atom functions, we also need to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1417
  define auxiliary $\alpha$-equivalence relations 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1418
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1419
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1420
  @{text "\<approx>bn\<^isub>"}$_{1..m}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1421
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1422
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1423
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1424
  for the binding functions @{text "bn"}$_{1..m}$, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1425
  To simplify our definitions we will use the following abbreviations for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1426
  \emph{compound equivalence relations} and \emph{compound free-atom functions} acting on tuples.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1427
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1428
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1429
  \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1430
  @{text "(x\<^isub>1,\<dots>, x\<^isub>n) (R\<^isub>1,\<dots>, R\<^isub>n) (x\<PRIME>\<^isub>1,\<dots>, x\<PRIME>\<^isub>n)"} & @{text "\<equiv>"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1431
  @{text "x\<^isub>1 R\<^isub>1 x\<PRIME>\<^isub>1 \<and> \<dots> \<and> x\<^isub>n R\<^isub>n x\<PRIME>\<^isub>n"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1432
  @{text "(fa\<^isub>1,\<dots>, fa\<^isub>n) (x\<^isub>1,\<dots>, x\<^isub>n)"} & @{text "\<equiv>"} & @{text "fa\<^isub>1 x\<^isub>1 \<union> \<dots> \<union> fa\<^isub>n x\<^isub>n"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1433
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1434
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1435
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1436
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1437
  The $\alpha$-equivalence relations are defined as inductive predicates
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1438
  having a single clause for each term-constructor. Assuming a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1439
  term-constructor @{text C} is of type @{text ty} and has the binding clauses
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1440
  @{term "bc"}$_{1..k}$, then the $\alpha$-equivalence clause has the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1441
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1442
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1443
  \mbox{\infer{@{text "C z\<^isub>1 \<dots> z\<^isub>n  \<approx>ty  C z\<PRIME>\<^isub>1 \<dots> z\<PRIME>\<^isub>n"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1444
  {@{text "prems(bc\<^isub>1) \<dots> prems(bc\<^isub>k)"}}} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1445
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1446
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1447
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1448
  The task below is to specify what the premises of a binding clause are. As a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1449
  special instance, we first treat the case where @{text "bc\<^isub>i"} is the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1450
  empty binding clause of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1451
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1452
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1453
  \mbox{\isacommand{bind (set)} @{term "{}"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}.}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1454
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1455
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1456
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1457
  In this binding clause no atom is bound and we only have to $\alpha$-relate the bodies. For this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1458
  we build first the tuples @{text "D \<equiv> (d\<^isub>1,\<dots>, d\<^isub>q)"} and @{text "D' \<equiv> (d\<PRIME>\<^isub>1,\<dots>, d\<PRIME>\<^isub>q)"}  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1459
  whereby the labels @{text "d"}$_{1..q}$ refer to arguments @{text "z"}$_{1..n}$ and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1460
  respectively @{text "d\<PRIME>"}$_{1..q}$ to @{text "z\<PRIME>"}$_{1..n}$. In order to relate
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1461
  two such tuples we define the compound $\alpha$-equivalence relation @{text "R"} as follows
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1462
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1463
  \begin{equation}\label{rempty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1464
  \mbox{@{text "R \<equiv> (R\<^isub>1,\<dots>, R\<^isub>q)"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1465
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1466
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1467
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1468
  with @{text "R\<^isub>i"} being @{text "\<approx>ty\<^isub>i"} if the corresponding labels @{text "d\<^isub>i"} and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1469
  @{text "d\<PRIME>\<^isub>i"} refer
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1470
  to a recursive argument of @{text C} with type @{text "ty\<^isub>i"}; otherwise
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1471
  we take @{text "R\<^isub>i"} to be the equality @{text "="}. This lets us define
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1472
  the premise for an empty binding clause succinctly as @{text "prems(bc\<^isub>i) \<equiv> D R D'"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1473
  which can be unfolded to the series of premises
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1474
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1475
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1476
  @{text "d\<^isub>1 R\<^isub>1 d\<PRIME>\<^isub>1  \<dots> d\<^isub>q R\<^isub>q d\<PRIME>\<^isub>q"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1477
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1478
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1479
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1480
  We will use the unfolded version in the examples below.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1481
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1482
  Now suppose the binding clause @{text "bc\<^isub>i"} is of the general form 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1483
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1484
  \begin{equation}\label{nonempty}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1485
  \mbox{\isacommand{bind (set)} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}.}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1486
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1487
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1488
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1489
  In this case we define a premise @{text P} using the relation
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1490
  $\approx_{\,\textit{set}}$ given in Section~\ref{sec:binders} (similarly
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1491
  $\approx_{\,\textit{set+}}$ and $\approx_{\,\textit{list}}$ for the other
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1492
  binding modes). This premise defines $\alpha$-equivalence of two abstractions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1493
  involving multiple binders. As above, we first build the tuples @{text "D"} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1494
  @{text "D'"} for the bodies @{text "d"}$_{1..q}$, and the corresponding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1495
  compound $\alpha$-relation @{text "R"} (shown in \eqref{rempty}). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1496
  For $\approx_{\,\textit{set}}$  we also need
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1497
  a compound free-atom function for the bodies defined as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1498
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1499
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1500
  \mbox{@{text "fa \<equiv> (fa_ty\<^isub>1,\<dots>, fa_ty\<^isub>q)"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1501
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1502
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1503
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1504
  with the assumption that the @{text "d"}$_{1..q}$ refer to arguments of types @{text "ty"}$_{1..q}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1505
  The last ingredient we need are the sets of atoms bound in the bodies.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1506
  For this we take
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1507
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1508
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1509
  @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> \<dots> \<union> bn_ty\<^isub>p b\<^isub>p"}\;.\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1510
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1511
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1512
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1513
  Similarly for @{text "B'"} using the labels @{text "b\<PRIME>"}$_{1..p}$. This 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1514
  lets us formally define the premise @{text P} for a non-empty binding clause as:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1515
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1516
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1517
  \mbox{@{term "P \<equiv> \<exists>p. (B, D) \<approx>set R fa p (B', D')"}}\;.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1518
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1519
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1520
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1521
  This premise accounts for $\alpha$-equivalence of the bodies of the binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1522
  clause. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1523
  However, in case the binders have non-recursive deep binders, this premise
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1524
  is not enough:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1525
  we also have to ``propagate'' $\alpha$-equivalence inside the structure of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1526
  these binders. An example is @{text "Let"} where we have to make sure the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1527
  right-hand sides of assignments are $\alpha$-equivalent. For this we use 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1528
  relations @{text "\<approx>bn"}$_{1..m}$ (which we will formally define shortly).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1529
  Let us assume the non-recursive deep binders in @{text "bc\<^isub>i"} are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1530
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1531
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1532
  @{text "bn\<^isub>1 l\<^isub>1, \<dots>, bn\<^isub>r l\<^isub>r"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1533
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1534
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1535
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1536
  The tuple @{text L} is then @{text "(l\<^isub>1,\<dots>,l\<^isub>r)"} (similarly @{text "L'"})
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1537
  and the compound equivalence relation @{text "R'"} is @{text "(\<approx>bn\<^isub>1,\<dots>,\<approx>bn\<^isub>r)"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1538
  All premises for @{text "bc\<^isub>i"} are then given by
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1539
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1540
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1541
  @{text "prems(bc\<^isub>i) \<equiv> P  \<and>   L R' L'"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1542
  \end{center} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1543
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1544
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1545
  The auxiliary $\alpha$-equivalence relations @{text "\<approx>bn"}$_{1..m}$ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1546
  in @{text "R'"} are defined as follows: assuming a @{text bn}-clause is of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1547
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1548
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1549
  @{text "bn (C z\<^isub>1 \<dots> z\<^isub>s) = rhs"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1550
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1551
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1552
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1553
  where the @{text "z"}$_{1..s}$ are of types @{text "ty"}$_{1..s}$,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1554
  then the corresponding $\alpha$-equivalence clause for @{text "\<approx>bn"} has the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1555
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1556
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1557
  \mbox{\infer{@{text "C z\<^isub>1 \<dots> z\<^isub>s \<approx>bn C z\<PRIME>\<^isub>1 \<dots> z\<PRIME>\<^isub>s"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1558
  {@{text "z\<^isub>1 R\<^isub>1 z\<PRIME>\<^isub>1 \<dots> z\<^isub>s R\<^isub>s z\<PRIME>\<^isub>s"}}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1559
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1560
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1561
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1562
  In this clause the relations @{text "R"}$_{1..s}$ are given by 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1563
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1564
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1565
  \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1566
  $\bullet$ & @{text "z\<^isub>i \<approx>ty z\<PRIME>\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text rhs} and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1567
  is a recursive argument of @{text C},\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1568
  $\bullet$ & @{text "z\<^isub>i = z\<PRIME>\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text rhs}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1569
  and is a non-recursive argument of @{text C},\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1570
  $\bullet$ & @{text "z\<^isub>i \<approx>bn\<^isub>i z\<PRIME>\<^isub>i"} provided @{text "z\<^isub>i"} occurs in @{text rhs}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1571
  with the recursive call @{text "bn\<^isub>i x\<^isub>i"} and\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1572
  $\bullet$ & @{text True} provided @{text "z\<^isub>i"} occurs in @{text rhs} but without a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1573
  recursive call.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1574
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1575
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1576
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1577
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1578
  This completes the definition of $\alpha$-equivalence. As a sanity check, we can show
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1579
  that the premises of empty binding clauses are a special case of the clauses for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1580
  non-empty ones (we just have to unfold the definition of $\approx_{\,\textit{set}}$ and take @{text "0"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1581
  for the existentially quantified permutation).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1582
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1583
  Again let us take a look at a concrete example for these definitions. For \eqref{letrecs}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1584
  we have three relations $\approx_{\textit{trm}}$, $\approx_{\textit{assn}}$ and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1585
  $\approx_{\textit{bn}}$ with the following clauses:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1586
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1587
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1588
  \begin{tabular}{@ {}c @ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1589
  \infer{@{text "Let as t \<approx>\<^bsub>trm\<^esub> Let as' t'"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1590
  {@{term "\<exists>p. (bn as, t) \<approx>lst alpha_trm fa_trm p (bn as', t')"} & @{text "as \<approx>\<^bsub>bn\<^esub> as'"}}\smallskip\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1591
  \makebox[0mm]{\infer{@{text "Let_rec as t \<approx>\<^bsub>trm\<^esub> Let_rec as' t'"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1592
  {@{term "\<exists>p. (bn as, ast) \<approx>lst alpha_trm2 fa_trm2 p (bn as', ast')"}}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1593
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1594
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1595
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1596
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1597
  \begin{tabular}{@ {}c @ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1598
  \infer{@{text "ANil \<approx>\<^bsub>assn\<^esub> ANil"}}{}\hspace{9mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1599
  \infer{@{text "ACons a t as \<approx>\<^bsub>assn\<^esub> ACons a' t' as"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1600
  {@{text "a = a'"} & @{text "t \<approx>\<^bsub>trm\<^esub> t'"} & @{text "as \<approx>\<^bsub>assn\<^esub> as'"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1601
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1602
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1603
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1604
  \begin{center}\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1605
  \begin{tabular}{@ {}c @ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1606
  \infer{@{text "ANil \<approx>\<^bsub>bn\<^esub> ANil"}}{}\hspace{9mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1607
  \infer{@{text "ACons a t as \<approx>\<^bsub>bn\<^esub> ACons a' t' as"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1608
  {@{text "t \<approx>\<^bsub>trm\<^esub> t'"} & @{text "as \<approx>\<^bsub>bn\<^esub> as'"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1609
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1610
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1611
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1612
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1613
  Note the difference between  $\approx_{\textit{assn}}$ and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1614
  $\approx_{\textit{bn}}$: the latter only ``tracks'' $\alpha$-equivalence of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1615
  the components in an assignment that are \emph{not} bound. This is needed in the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1616
  clause for @{text "Let"} (which has
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1617
  a non-recursive binder). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1618
  The underlying reason is that the terms inside an assignment are not meant 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1619
  to be ``under'' the binder. Such a premise is \emph{not} needed in @{text "Let_rec"}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1620
  because there all components of an assignment are ``under'' the binder. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1621
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1622
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1623
section {* Establishing the Reasoning Infrastructure *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1624
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1625
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1626
  Having made all necessary definitions for raw terms, we can start
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1627
  with establishing the reasoning infrastructure for the $\alpha$-equated types
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1628
  @{text "ty\<AL>"}$_{1..n}$, that is the types the user originally specified. We sketch
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1629
  in this section the proofs we need for establishing this infrastructure. One
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1630
  main point of our work is that we have completely automated these proofs in Isabelle/HOL.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1631
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1632
  First we establish that the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1633
  $\alpha$-equivalence relations defined in the previous section are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1634
  equivalence relations.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1635
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1636
  \begin{lemma}\label{equiv} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1637
  Given the raw types @{text "ty"}$_{1..n}$ and binding functions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1638
  @{text "bn"}$_{1..m}$, the relations @{text "\<approx>ty"}$_{1..n}$ and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1639
  @{text "\<approx>bn"}$_{1..m}$ are equivalence relations. and equivariant.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1640
  \end{lemma}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1641
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1642
  \begin{proof} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1643
  The proof is by mutual induction over the definitions. The non-trivial
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1644
  cases involve premises built up by $\approx_{\textit{set}}$, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1645
  $\approx_{\textit{set+}}$ and $\approx_{\textit{list}}$. They 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1646
  can be dealt with as in Lemma~\ref{alphaeq}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1647
  \end{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1648
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1649
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1650
  We can feed this lemma into our quotient package and obtain new types @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1651
  "ty"}$^\alpha_{1..n}$ representing $\alpha$-equated terms of types @{text "ty"}$_{1..n}$. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1652
  We also obtain definitions for the term-constructors @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1653
  "C"}$^\alpha_{1..k}$ from the raw term-constructors @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1654
  "C"}$_{1..k}$, and similar definitions for the free-atom functions @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1655
  "fa_ty"}$^\alpha_{1..n}$ and @{text "fa_bn"}$^\alpha_{1..m}$ as well as the binding functions @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1656
  "bn"}$^\alpha_{1..m}$. However, these definitions are not really useful to the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1657
  user, since they are given in terms of the isomorphisms we obtained by 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1658
  creating new types in Isabelle/HOL (recall the picture shown in the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1659
  Introduction).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1660
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1661
  The first useful property for the user is the fact that distinct 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1662
  term-constructors are not 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1663
  equal, that is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1664
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1665
  \begin{equation}\label{distinctalpha}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1666
  \mbox{@{text "C"}$^\alpha$~@{text "x\<^isub>1 \<dots> x\<^isub>r"}~@{text "\<noteq>"}~% 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1667
  @{text "D"}$^\alpha$~@{text "y\<^isub>1 \<dots> y\<^isub>s"}} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1668
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1669
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1670
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1671
  whenever @{text "C"}$^\alpha$~@{text "\<noteq>"}~@{text "D"}$^\alpha$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1672
  In order to derive this fact, we use the definition of $\alpha$-equivalence
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1673
  and establish that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1674
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1675
  \begin{equation}\label{distinctraw}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1676
  \mbox{@{text "C x\<^isub>1 \<dots> x\<^isub>r"}\;$\not\approx$@{text ty}\;@{text "D y\<^isub>1 \<dots> y\<^isub>s"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1677
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1678
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1679
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1680
  holds for the corresponding raw term-constructors.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1681
  In order to deduce \eqref{distinctalpha} from \eqref{distinctraw}, our quotient
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1682
  package needs to know that the raw term-constructors @{text "C"} and @{text "D"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1683
  are \emph{respectful} w.r.t.~the $\alpha$-equivalence relations (see \cite{Homeier05}).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1684
  Assuming, for example, @{text "C"} is of type @{text "ty"} with argument types
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1685
  @{text "ty"}$_{1..r}$, respectfulness amounts to showing that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1686
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1687
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1688
  @{text "C x\<^isub>1 \<dots> x\<^isub>r \<approx>ty C x\<PRIME>\<^isub>1 \<dots> x\<PRIME>\<^isub>r"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1689
  \end{center}  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1690
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1691
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1692
  holds under the assumptions that we have \mbox{@{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1693
  "x\<^isub>i \<approx>ty\<^isub>i x\<PRIME>\<^isub>i"}} whenever @{text "x\<^isub>i"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1694
  and @{text "x\<PRIME>\<^isub>i"} are recursive arguments of @{text C} and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1695
  @{text "x\<^isub>i = x\<PRIME>\<^isub>i"} whenever they are non-recursive arguments. We can prove this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1696
  implication by applying the corresponding rule in our $\alpha$-equivalence
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1697
  definition and by establishing the following auxiliary implications %facts 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1698
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1699
  \begin{equation}\label{fnresp}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1700
  \mbox{%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1701
  \begin{tabular}{ll@ {\hspace{7mm}}ll}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1702
  \mbox{\it (i)} & @{text "x \<approx>ty\<^isub>i x\<PRIME>"}~~@{text "\<Rightarrow>"}~~@{text "fa_ty\<^isub>i x = fa_ty\<^isub>i x\<PRIME>"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1703
  \mbox{\it (iii)} & @{text "x \<approx>ty\<^isub>j x\<PRIME>"}~~@{text "\<Rightarrow>"}~~@{text "bn\<^isub>j x = bn\<^isub>j x\<PRIME>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1704
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1705
  \mbox{\it (ii)} & @{text "x \<approx>ty\<^isub>j x\<PRIME>"}~~@{text "\<Rightarrow>"}~~@{text "fa_bn\<^isub>j x = fa_bn\<^isub>j x\<PRIME>"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1706
  \mbox{\it (iv)} & @{text "x \<approx>ty\<^isub>j x\<PRIME>"}~~@{text "\<Rightarrow>"}~~@{text "x \<approx>bn\<^isub>j x\<PRIME>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1707
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1708
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1709
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1710
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1711
  They can be established by induction on @{text "\<approx>ty"}$_{1..n}$. Whereas the first,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1712
  second and last implication are true by how we stated our definitions, the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1713
  third \emph{only} holds because of our restriction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1714
  imposed on the form of the binding functions---namely \emph{not} returning 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1715
  any bound atoms. In Ott, in contrast, the user may 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1716
  define @{text "bn"}$_{1..m}$ so that they return bound
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1717
  atoms and in this case the third implication is \emph{not} true. A 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1718
  result is that the lifting of the corresponding binding functions in Ott to $\alpha$-equated
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1719
  terms is impossible.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1720
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1721
  Having established respectfulness for the raw term-constructors, the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1722
  quotient package is able to automatically deduce \eqref{distinctalpha} from 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1723
  \eqref{distinctraw}. Having the facts \eqref{fnresp} at our disposal, we can 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1724
  also lift properties that characterise when two raw terms of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1725
  %
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1726
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1727
  @{text "C x\<^isub>1 \<dots> x\<^isub>r \<approx>ty C x\<PRIME>\<^isub>1 \<dots> x\<PRIME>\<^isub>r"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1728
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1729
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1730
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1731
  are $\alpha$-equivalent. This gives us conditions when the corresponding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1732
  $\alpha$-equated terms are \emph{equal}, namely
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1733
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1734
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1735
  @{text "C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r = C\<^sup>\<alpha> x\<PRIME>\<^isub>1 \<dots> x\<PRIME>\<^isub>r"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1736
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1737
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1738
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1739
  We call these conditions as \emph{quasi-injectivity}. They correspond to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1740
  the premises in our $\alpha$-equivalence relations.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1741
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1742
  Next we can lift the permutation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1743
  operations defined in \eqref{ceqvt}. In order to make this 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1744
  lifting to go through, we have to show that the permutation operations are respectful. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1745
  This amounts to showing that the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1746
  $\alpha$-equivalence relations are equivariant \cite{HuffmanUrban10}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1747
  , which we already established 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1748
  in Lemma~\ref{equiv}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1749
  As a result we can add the equations
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1750
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1751
  \begin{equation}\label{calphaeqvt}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1752
  @{text "p \<bullet> (C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r) = C\<^sup>\<alpha> (p \<bullet> x\<^isub>1) \<dots> (p \<bullet> x\<^isub>r)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1753
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1754
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1755
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1756
  to our infrastructure. In a similar fashion we can lift the defining equations
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1757
  of the free-atom functions @{text "fn_ty\<AL>"}$_{1..n}$ and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1758
  @{text "fa_bn\<AL>"}$_{1..m}$ as well as of the binding functions @{text
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1759
  "bn\<AL>"}$_{1..m}$ and the size functions @{text "size_ty\<AL>"}$_{1..n}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1760
  The latter are defined automatically for the raw types @{text "ty"}$_{1..n}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1761
  by the datatype package of Isabelle/HOL.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1762
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1763
  Finally we can add to our infrastructure a cases lemma (explained in the next section)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1764
  and a structural induction principle 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1765
  for the types @{text "ty\<AL>"}$_{1..n}$. The conclusion of the induction principle is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1766
  of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1767
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1768
  \begin{equation}\label{weakinduct}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1769
  \mbox{@{text "P\<^isub>1 x\<^isub>1 \<and> \<dots> \<and> P\<^isub>n x\<^isub>n "}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1770
  \end{equation} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1771
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1772
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1773
  whereby the @{text P}$_{1..n}$ are predicates and the @{text x}$_{1..n}$ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1774
  have types @{text "ty\<AL>"}$_{1..n}$. This induction principle has for each
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1775
  term constructor @{text "C"}$^\alpha$ a premise of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1776
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1777
  \begin{equation}\label{weakprem}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1778
  \mbox{@{text "\<forall>x\<^isub>1\<dots>x\<^isub>r. P\<^isub>i x\<^isub>i \<and> \<dots> \<and> P\<^isub>j x\<^isub>j \<Rightarrow> P (C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r)"}} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1779
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1780
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1781
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1782
  in which the @{text "x"}$_{i..j}$ @{text "\<subseteq>"} @{text "x"}$_{1..r}$ are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1783
  the recursive arguments of @{text "C\<AL>"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1784
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1785
  By working now completely on the $\alpha$-equated level, we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1786
  can first show that the free-atom functions and binding functions are
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1787
  equivariant, namely
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1788
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1789
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1790
  \begin{tabular}{rcl@ {\hspace{10mm}}rcl}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1791
  @{text "p \<bullet> (fa_ty\<AL>\<^isub>i  x)"} & $=$ & @{text "fa_ty\<AL>\<^isub>i (p \<bullet> x)"} &
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1792
  @{text "p \<bullet> (bn\<AL>\<^isub>j  x)"}    & $=$ & @{text "bn\<AL>\<^isub>j (p \<bullet> x)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1793
  @{text "p \<bullet> (fa_bn\<AL>\<^isub>j  x)"} & $=$ & @{text "fa_bn\<AL>\<^isub>j (p \<bullet> x)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1794
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1795
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1796
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1797
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1798
  These properties can be established using the induction principle for the types @{text "ty\<AL>"}$_{1..n}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1799
  in \eqref{weakinduct}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1800
  Having these equivariant properties established, we can
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1801
  show that the support of term-constructors @{text "C\<^sup>\<alpha>"} is included in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1802
  the support of its arguments, that means 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1803
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1804
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1805
  @{text "supp (C\<^sup>\<alpha> x\<^isub>1 \<dots> x\<^isub>r) \<subseteq> (supp x\<^isub>1 \<union> \<dots> \<union> supp x\<^isub>r)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1806
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1807
 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1808
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1809
  holds. This allows us to prove by induction that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1810
  every @{text x} of type @{text "ty\<AL>"}$_{1..n}$ is finitely supported. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1811
  This can be again shown by induction 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1812
  over @{text "ty\<AL>"}$_{1..n}$. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1813
  Lastly, we can show that the support of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1814
  elements in  @{text "ty\<AL>"}$_{1..n}$ is the same as @{text "fa_ty\<AL>"}$_{1..n}$.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1815
  This fact is important in a nominal setting, but also provides evidence 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1816
  that our notions of free-atoms and $\alpha$-equivalence are correct.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1817
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1818
  \begin{theorem} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1819
  For @{text "x"}$_{1..n}$ with type @{text "ty\<AL>"}$_{1..n}$, we have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1820
  @{text "supp x\<^isub>i = fa_ty\<AL>\<^isub>i x\<^isub>i"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1821
  \end{theorem}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1822
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1823
  \begin{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1824
  The proof is by induction. In each case
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1825
  we unfold the definition of @{text "supp"}, move the swapping inside the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1826
  term-constructors and then use the quasi-injectivity lemmas in order to complete the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1827
  proof. For the abstraction cases we use the facts derived in Theorem~\ref{suppabs}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1828
  \end{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1829
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1830
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1831
  To sum up this section, we can establish automatically a reasoning infrastructure
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1832
  for the types @{text "ty\<AL>"}$_{1..n}$ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1833
  by first lifting definitions from the raw level to the quotient level and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1834
  then by establishing facts about these lifted definitions. All necessary proofs
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1835
  are generated automatically by custom ML-code. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1836
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1837
  %This code can deal with 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1838
  %specifications such as the one shown in Figure~\ref{nominalcorehas} for Core-Haskell.  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1839
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1840
  %\begin{figure}[t!]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1841
  %\begin{boxedminipage}{\linewidth}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1842
  %\small
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1843
  %\begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1844
  %\isacommand{atom\_decl}~@{text "var cvar tvar"}\\[1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1845
  %\isacommand{nominal\_datatype}~@{text "tkind ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1846
  %\phantom{$|$}~@{text "KStar"}~$|$~@{text "KFun tkind tkind"}\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1847
  %\isacommand{and}~@{text "ckind ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1848
  %\phantom{$|$}~@{text "CKSim ty ty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1849
  %\isacommand{and}~@{text "ty ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1850
  %\phantom{$|$}~@{text "TVar tvar"}~$|$~@{text "T string"}~$|$~@{text "TApp ty ty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1851
  %$|$~@{text "TFun string ty_list"}~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1852
  %$|$~@{text "TAll tv::tvar tkind ty::ty"}  \isacommand{bind}~@{text "tv"}~\isacommand{in}~@{text ty}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1853
  %$|$~@{text "TArr ckind ty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1854
  %\isacommand{and}~@{text "ty_lst ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1855
  %\phantom{$|$}~@{text "TNil"}~$|$~@{text "TCons ty ty_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1856
  %\isacommand{and}~@{text "cty ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1857
  %\phantom{$|$}~@{text "CVar cvar"}~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1858
  %$|$~@{text "C string"}~$|$~@{text "CApp cty cty"}~$|$~@{text "CFun string co_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1859
  %$|$~@{text "CAll cv::cvar ckind cty::cty"}  \isacommand{bind}~@{text "cv"}~\isacommand{in}~@{text cty}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1860
  %$|$~@{text "CArr ckind cty"}~$|$~@{text "CRefl ty"}~$|$~@{text "CSym cty"}~$|$~@{text "CCirc cty cty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1861
  %$|$~@{text "CAt cty ty"}~$|$~@{text "CLeft cty"}~$|$~@{text "CRight cty"}~$|$~@{text "CSim cty cty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1862
  %$|$~@{text "CRightc cty"}~$|$~@{text "CLeftc cty"}~$|$~@{text "Coerce cty cty"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1863
  %\isacommand{and}~@{text "co_lst ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1864
  %\phantom{$|$}@{text "CNil"}~$|$~@{text "CCons cty co_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1865
  %\isacommand{and}~@{text "trm ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1866
  %\phantom{$|$}~@{text "Var var"}~$|$~@{text "K string"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1867
  %$|$~@{text "LAM_ty tv::tvar tkind t::trm"}  \isacommand{bind}~@{text "tv"}~\isacommand{in}~@{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1868
  %$|$~@{text "LAM_cty cv::cvar ckind t::trm"}   \isacommand{bind}~@{text "cv"}~\isacommand{in}~@{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1869
  %$|$~@{text "App_ty trm ty"}~$|$~@{text "App_cty trm cty"}~$|$~@{text "App trm trm"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1870
  %$|$~@{text "Lam v::var ty t::trm"}  \isacommand{bind}~@{text "v"}~\isacommand{in}~@{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1871
  %$|$~@{text "Let x::var ty trm t::trm"}  \isacommand{bind}~@{text x}~\isacommand{in}~@{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1872
  %$|$~@{text "Case trm assoc_lst"}~$|$~@{text "Cast trm co"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1873
  %\isacommand{and}~@{text "assoc_lst ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1874
  %\phantom{$|$}~@{text ANil}~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1875
  %$|$~@{text "ACons p::pat t::trm assoc_lst"}  \isacommand{bind}~@{text "bv p"}~\isacommand{in}~@{text t}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1876
  %\isacommand{and}~@{text "pat ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1877
  %\phantom{$|$}~@{text "Kpat string tvtk_lst tvck_lst vt_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1878
  %\isacommand{and}~@{text "vt_lst ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1879
  %\phantom{$|$}~@{text VTNil}~$|$~@{text "VTCons var ty vt_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1880
  %\isacommand{and}~@{text "tvtk_lst ="}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1881
  %\phantom{$|$}~@{text TVTKNil}~$|$~@{text "TVTKCons tvar tkind tvtk_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1882
  %\isacommand{and}~@{text "tvck_lst ="}\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1883
  %\phantom{$|$}~@{text TVCKNil}~$|$ @{text "TVCKCons cvar ckind tvck_lst"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1884
  %\isacommand{binder}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1885
  %@{text "bv :: pat \<Rightarrow> atom list"}~\isacommand{and}~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1886
  %@{text "bv1 :: vt_lst \<Rightarrow> atom list"}~\isacommand{and}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1887
  %@{text "bv2 :: tvtk_lst \<Rightarrow> atom list"}~\isacommand{and}~%
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1888
  %@{text "bv3 :: tvck_lst \<Rightarrow> atom list"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1889
  %\isacommand{where}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1890
  %\phantom{$|$}~@{text "bv (K s tvts tvcs vs) = (bv3 tvts) @ (bv2 tvcs) @ (bv1 vs)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1891
  %$|$~@{text "bv1 VTNil = []"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1892
  %$|$~@{text "bv1 (VTCons x ty tl) = (atom x)::(bv1 tl)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1893
  %$|$~@{text "bv2 TVTKNil = []"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1894
  %$|$~@{text "bv2 (TVTKCons a ty tl) = (atom a)::(bv2 tl)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1895
  %$|$~@{text "bv3 TVCKNil = []"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1896
  %$|$~@{text "bv3 (TVCKCons c cty tl) = (atom c)::(bv3 tl)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1897
  %\end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1898
  %\end{boxedminipage}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1899
  %\caption{The nominal datatype declaration for Core-Haskell. For the moment we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1900
  %do not support nested types; therefore we explicitly have to unfold the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1901
  %lists @{text "co_lst"}, @{text "assoc_lst"} and so on. This will be improved
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1902
  %in a future version of Nominal Isabelle. Apart from that, the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1903
  %declaration follows closely the original in Figure~\ref{corehas}. The
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1904
  %point of our work is that having made such a declaration in Nominal Isabelle,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1905
  %one obtains automatically a reasoning infrastructure for Core-Haskell.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1906
  %\label{nominalcorehas}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1907
  %\end{figure}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1908
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1909
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1910
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1911
section {* Strong Induction Principles *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1912
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1913
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1914
  In the previous section we derived induction principles for $\alpha$-equated terms. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1915
  We call such induction principles \emph{weak}, because for a 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1916
  term-constructor \mbox{@{text "C\<^sup>\<alpha> x\<^isub>1\<dots>x\<^isub>r"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1917
  the induction hypothesis requires us to establish the implications \eqref{weakprem}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1918
  The problem with these implications is that in general they are difficult to establish.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1919
  The reason is that we cannot make any assumption about the bound atoms that might be in @{text "C\<^sup>\<alpha>"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1920
  (for example we cannot assume the variable convention for them).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1921
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1922
  In \cite{UrbanTasson05} we introduced a method for automatically
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1923
  strengthening weak induction principles for terms containing single
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1924
  binders. These stronger induction principles allow the user to make additional
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1925
  assumptions about bound atoms. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1926
  These additional assumptions amount to a formal
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1927
  version of the informal variable convention for binders. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1928
  To sketch how this strengthening extends to the case of multiple binders, we use as
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1929
  running example the term-constructors @{text "Lam"} and @{text "Let"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1930
  from example \eqref{letpat}. Instead of establishing @{text " P\<^bsub>trm\<^esub> t \<and> P\<^bsub>pat\<^esub> p"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1931
  the stronger induction principle for \eqref{letpat} establishes properties @{text " P\<^bsub>trm\<^esub> c t \<and> P\<^bsub>pat\<^esub> c p"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1932
  where the additional parameter @{text c} controls
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1933
  which freshness assumptions the binders should satisfy. For the two term constructors 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1934
  this means that the user has to establish in inductions the implications
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1935
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1936
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1937
  \begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1938
  @{text "\<forall>a t c. {atom a} \<FRESH>\<^sup>* c \<and> (\<forall>d. P\<^bsub>trm\<^esub> d t) \<Rightarrow> P\<^bsub>trm\<^esub> c (Lam a t)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1939
  @{text "\<forall>p t c. (set (bn p)) \<FRESH>\<^sup>* c \<and> (\<forall>d. P\<^bsub>pat\<^esub> d p) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d t) \<and> \<Rightarrow> P\<^bsub>trm\<^esub> c (Let p t)"}\\%[-0mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1940
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1941
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1942
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1943
  In \cite{UrbanTasson05} we showed how the weaker induction principles imply
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1944
  the stronger ones. This was done by some quite complicated, nevertheless automated,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1945
  induction proof. In this paper we simplify this work by leveraging the automated proof
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1946
  methods from the function package of Isabelle/HOL. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1947
  The reasoning principle these methods employ is well-founded induction. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1948
  To use them in our setting, we have to discharge
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1949
  two proof obligations: one is that we have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1950
  well-founded measures (for each type @{text "ty"}$^\alpha_{1..n}$) that decrease in 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1951
  every induction step and the other is that we have covered all cases. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1952
  As measures we use the size functions 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1953
  @{text "size_ty"}$^\alpha_{1..n}$, which we lifted in the previous section and which are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1954
  all well-founded. It is straightforward to establish that these measures decrease 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1955
  in every induction step.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1956
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1957
  What is left to show is that we covered all cases. To do so, we use 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1958
  a \emph{cases lemma} derived for each type. For the terms in \eqref{letpat} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1959
  this lemma is of the form
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1960
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1961
  \begin{equation}\label{weakcases}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1962
  \infer{@{text "P\<^bsub>trm\<^esub>"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1963
  {\begin{array}{l@ {\hspace{9mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1964
  @{text "\<forall>x. t = Var x \<Rightarrow> P\<^bsub>trm\<^esub>"} & @{text "\<forall>a t'. t = Lam a t' \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1965
  @{text "\<forall>t\<^isub>1 t\<^isub>2. t = App t\<^isub>1 t\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"} & @{text "\<forall>p t'. t = Let p t' \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1966
  \end{array}}\\[-1mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1967
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1968
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1969
  where we have a premise for each term-constructor.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1970
  The idea behind such cases lemmas is that we can conclude with a property @{text "P\<^bsub>trm\<^esub>"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1971
  provided we can show that this property holds if we substitute for @{text "t"} all 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1972
  possible term-constructors. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1973
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1974
  The only remaining difficulty is that in order to derive the stronger induction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1975
  principles conveniently, the cases lemma in \eqref{weakcases} is too weak. For this note that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1976
  in order to apply this lemma, we have to establish @{text "P\<^bsub>trm\<^esub>"} for \emph{all} @{text Lam}- and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1977
  \emph{all} @{text Let}-terms. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1978
  What we need instead is a cases lemma where we only have to consider terms that have 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1979
  binders that are fresh w.r.t.~a context @{text "c"}. This gives the implications
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1980
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1981
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1982
  \begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1983
  @{text "\<forall>a t'. t = Lam a t' \<and> {atom a} \<FRESH>\<^sup>* c \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1984
  @{text "\<forall>p t'. t = Let p t' \<and> (set (bn p)) \<FRESH>\<^sup>* c \<Rightarrow> P\<^bsub>trm\<^esub>"}\\[-2mm]
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1985
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1986
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1987
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1988
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1989
  which however can be relatively easily be derived from the implications in \eqref{weakcases} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1990
  by a renaming using Properties \ref{supppermeq} and \ref{avoiding}. In the first case we know
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1991
  that @{text "{atom a} \<FRESH>\<^sup>* Lam a t"}. Property \eqref{avoiding} provides us therefore with 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1992
  a permutation @{text q}, such that @{text "{atom (q \<bullet> a)} \<FRESH>\<^sup>* c"} and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1993
  @{text "supp (Lam a t) \<FRESH>\<^sup>* q"} hold.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1994
  By using Property \ref{supppermeq}, we can infer from the latter 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1995
  that @{text "Lam (q \<bullet> a) (q \<bullet> t) = Lam a t"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1996
  and we are done with this case.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1997
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1998
  The @{text Let}-case involving a (non-recursive) deep binder is a bit more complicated.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1999
  The reason is that the we cannot apply Property \ref{avoiding} to the whole term @{text "Let p t"},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2000
  because @{text p} might contain names bound by @{text bn}, but also some that are 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2001
  free. To solve this problem we have to introduce a permutation function that only
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2002
  permutes names bound by @{text bn} and leaves the other names unchanged. We do this again
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2003
  by lifting. For a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2004
  clause @{text "bn (C x\<^isub>1 \<dots> x\<^isub>r) = rhs"}, we define 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2005
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2006
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2007
  @{text "p \<bullet>\<^bsub>bn\<^esub> (C x\<^isub>1 \<dots> x\<^isub>r) \<equiv> C y\<^isub>1 \<dots> y\<^isub>r"}  with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2008
  $\begin{cases}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2009
  \text{@{text "y\<^isub>i \<equiv> x\<^isub>i"} provided @{text "x\<^isub>i"} does not occur in @{text "rhs"}}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2010
  \text{@{text "y\<^isub>i \<equiv> p \<bullet>\<^bsub>bn'\<^esub> x\<^isub>i"} provided @{text "bn' x\<^isub>i"} is in @{text "rhs"}}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2011
  \text{@{text "y\<^isub>i \<equiv> p \<bullet> x\<^isub>i"} otherwise}  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2012
  \end{cases}$
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2013
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2014
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2015
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2016
  with @{text "y\<^isub>i"} determined as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2017
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2018
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2019
  \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2020
  $\bullet$ & @{text "y\<^isub>i \<equiv> x\<^isub>i"} provided @{text "x\<^isub>i"} does not occur in @{text "rhs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2021
  $\bullet$ & @{text "y\<^isub>i \<equiv> p \<bullet>\<^bsub>bn'\<^esub> x\<^isub>i"} provided @{text "bn' x\<^isub>i"} is in @{text "rhs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2022
  $\bullet$ & @{text "y\<^isub>i \<equiv> p \<bullet> x\<^isub>i"} otherwise
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2023
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2024
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2025
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2026
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2027
  Now Properties \ref{supppermeq} and \ref{avoiding} give us a permutation @{text q} such that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2028
  @{text "(set (bn (q \<bullet>\<^bsub>bn\<^esub> p)) \<FRESH>\<^sup>* c"} holds and such that @{text "[q \<bullet>\<^bsub>bn\<^esub> p]\<^bsub>list\<^esub>.(q \<bullet> t)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2029
  is equal to @{text "[p]\<^bsub>list\<^esub>. t"}. We can also show that @{text "(q \<bullet>\<^bsub>bn\<^esub> p) \<approx>\<^bsub>bn\<^esub> p"}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2030
  These facts establish that @{text "Let (q \<bullet>\<^bsub>bn\<^esub> p) (p \<bullet> t) = Let p t"}, as we need. This
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2031
  completes the non-trivial cases in \eqref{letpat} for strengthening the corresponding induction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2032
  principle.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2033
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2034
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2035
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2036
  A natural question is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2037
  whether we can also strengthen the weak induction principles involving
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2038
  the general binders presented here. We will indeed be able to so, but for this we need an 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2039
  additional notion for permuting deep binders. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2040
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2041
  Given a binding function @{text "bn"} we define an auxiliary permutation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2042
  operation @{text "_ \<bullet>\<^bsub>bn\<^esub> _"} which permutes only bound arguments in a deep binder.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2043
  Assuming a clause of @{text bn} is given as 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2044
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2045
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2046
  @{text "bn (C x\<^isub>1 \<dots> x\<^isub>r) = rhs"}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2047
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2048
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2049
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2050
  then we define 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2051
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2052
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2053
  @{text "p \<bullet>\<^bsub>bn\<^esub> (C x\<^isub>1 \<dots> x\<^isub>r) \<equiv> C y\<^isub>1 \<dots> y\<^isub>r"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2054
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2055
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2056
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2057
  with @{text "y\<^isub>i"} determined as follows:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2058
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2059
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2060
  \begin{tabular}{c@ {\hspace{2mm}}p{7cm}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2061
  $\bullet$ & @{text "y\<^isub>i \<equiv> x\<^isub>i"} provided @{text "x\<^isub>i"} does not occur in @{text "rhs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2062
  $\bullet$ & @{text "y\<^isub>i \<equiv> p \<bullet>\<^bsub>bn'\<^esub> x\<^isub>i"} provided @{text "bn' x\<^isub>i"} is in @{text "rhs"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2063
  $\bullet$ & @{text "y\<^isub>i \<equiv> p \<bullet> x\<^isub>i"} otherwise
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2064
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2065
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2066
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2067
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2068
  Using again the quotient package  we can lift the @{text "_ \<bullet>\<^bsub>bn\<^esub> _"} function to 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2069
  $\alpha$-equated terms. We can then prove the following two facts
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2070
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2071
  \begin{lemma}\label{permutebn} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2072
  Given a binding function @{text "bn\<^sup>\<alpha>"} then for all @{text p}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2073
  {\it (i)} @{text "p \<bullet> (bn\<^sup>\<alpha> x) = bn\<^sup>\<alpha> (p \<bullet>\<AL>\<^bsub>bn\<^esub> x)"} and {\it (ii)}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2074
    @{text "fa_bn\<^isup>\<alpha> x = fa_bn\<^isup>\<alpha> (p \<bullet>\<AL>\<^bsub>bn\<^esub> x)"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2075
  \end{lemma}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2076
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2077
  \begin{proof} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2078
  By induction on @{text x}. The equations follow by simple unfolding 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2079
  of the definitions. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2080
  \end{proof}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2081
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2082
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2083
  The first property states that a permutation applied to a binding function is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2084
  equivalent to first permuting the binders and then calculating the bound
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2085
  atoms. The second amounts to the fact that permuting the binders has no 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2086
  effect on the free-atom function. The main point of this permutation
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2087
  function, however, is that if we have a permutation that is fresh 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2088
  for the support of an object @{text x}, then we can use this permutation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2089
  to rename the binders in @{text x}, without ``changing'' @{text x}. In case of the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2090
  @{text "Let"} term-constructor from the example shown 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2091
  in \eqref{letpat} this means for a permutation @{text "r"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2092
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2093
  \begin{equation}\label{renaming}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2094
  \begin{array}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2095
  \mbox{if @{term "supp (Abs_lst (bn p) t\<^isub>2)  \<sharp>* r"}}\\ 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2096
  \qquad\mbox{then @{text "Let p t\<^isub>1 t\<^isub>2 = Let (r \<bullet>\<AL>\<^bsub>bn_pat\<^esub> p) t\<^isub>1 (r \<bullet> t\<^isub>2)"}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2097
  \end{array}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2098
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2099
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2100
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2101
  This fact will be crucial when establishing the strong induction principles below.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2102
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2103
 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2104
  In our running example about @{text "Let"}, the strong induction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2105
  principle means that instead 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2106
  of establishing the implication 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2107
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2108
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2109
  @{text "\<forall>p t\<^isub>1 t\<^isub>2. P\<^bsub>pat\<^esub> p \<and> P\<^bsub>trm\<^esub> t\<^isub>1 \<and> P\<^bsub>trm\<^esub> t\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub> (Let p t\<^isub>1 t\<^isub>2)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2110
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2111
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2112
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2113
  it is sufficient to establish the following implication
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2114
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2115
  \begin{equation}\label{strong}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2116
  \mbox{\begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2117
  @{text "\<forall>p t\<^isub>1 t\<^isub>2 c."}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2118
  \hspace{5mm}@{text "set (bn p) #\<^sup>* c \<and>"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2119
  \hspace{5mm}@{text "(\<forall>d. P\<^bsub>pat\<^esub> d p) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d t\<^isub>1) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d t\<^isub>2)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2120
  \hspace{15mm}@{text "\<Rightarrow> P\<^bsub>trm\<^esub> c (Let p t\<^isub>1 t\<^isub>2)"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2121
  \end{tabular}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2122
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2123
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2124
  \noindent 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2125
  While this implication contains an additional argument, namely @{text c}, and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2126
  also additional universal quantifications, it is usually easier to establish.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2127
  The reason is that we have the freshness 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2128
  assumption @{text "set (bn\<^sup>\<alpha> p) #\<^sup>* c"}, whereby @{text c} can be arbitrarily 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2129
  chosen by the user as long as it has finite support.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2130
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2131
  Let us now show how we derive the strong induction principles from the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2132
  weak ones. In case of the @{text "Let"}-example we derive by the weak 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2133
  induction the following two properties
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2134
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2135
  \begin{equation}\label{hyps}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2136
  @{text "\<forall>q c. P\<^bsub>trm\<^esub> c (q \<bullet> t)"} \hspace{4mm} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2137
  @{text "\<forall>q\<^isub>1 q\<^isub>2 c. P\<^bsub>pat\<^esub> (q\<^isub>1 \<bullet>\<AL>\<^bsub>bn\<^esub> (q\<^isub>2 \<bullet> p))"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2138
  \end{equation} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2139
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2140
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2141
  For the @{text Let} term-constructor  we therefore have to establish @{text "P\<^bsub>trm\<^esub> c (q \<bullet> Let p t\<^isub>1 t\<^isub>2)"} 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2142
  assuming \eqref{hyps} as induction hypotheses (the first for @{text t\<^isub>1} and @{text t\<^isub>2}). 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2143
  By Property~\ref{avoiding} we
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2144
  obtain a permutation @{text "r"} such that 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2145
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2146
  \begin{equation}\label{rprops}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2147
  @{term "(r \<bullet> set (bn (q \<bullet> p))) \<sharp>* c "}\hspace{4mm}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2148
  @{term "supp (Abs_lst (bn (q \<bullet> p)) (q \<bullet> t\<^isub>2)) \<sharp>* r"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2149
  \end{equation}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2150
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2151
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2152
  hold. The latter fact and \eqref{renaming} give us
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2153
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2154
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2155
  \begin{tabular}{l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2156
  @{text "Let (q \<bullet> p) (q \<bullet> t\<^isub>1) (q \<bullet> t\<^isub>2) ="} \\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2157
  \hspace{15mm}@{text "Let (r \<bullet>\<AL>\<^bsub>bn\<^esub> (q \<bullet> p)) (q \<bullet> t\<^isub>1) (r \<bullet> (q \<bullet> t\<^isub>2))"}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2158
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2159
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2160
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2161
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2162
  So instead of proving @{text "P\<^bsub>trm\<^esub> c (q \<bullet> Let p t\<^isub>1 t\<^isub>2)"}, we can equally
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2163
  establish @{text "P\<^bsub>trm\<^esub> c (Let (r \<bullet>\<AL>\<^bsub>bn\<^esub> (q \<bullet> p)) (q \<bullet> t\<^isub>1) (r \<bullet> (q \<bullet> t\<^isub>2)))"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2164
  To do so, we will use the implication \eqref{strong} of the strong induction
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2165
  principle, which requires us to discharge
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2166
  the following four proof obligations:
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2167
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2168
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2169
  \begin{tabular}{rl}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2170
  {\it (i)} &   @{text "set (bn (r \<bullet>\<AL>\<^bsub>bn\<^esub> (q \<bullet> p))) #\<^sup>* c"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2171
  {\it (ii)} &  @{text "\<forall>d. P\<^bsub>pat\<^esub> d (r \<bullet>\<AL>\<^bsub>bn\<^esub> (q \<bullet> p))"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2172
  {\it (iii)} & @{text "\<forall>d. P\<^bsub>trm\<^esub> d (q \<bullet> t\<^isub>1)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2173
  {\it (iv)} & @{text "\<forall>d. P\<^bsub>trm\<^esub> d (r \<bullet> (q \<bullet> t\<^isub>2))"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2174
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2175
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2176
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2177
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2178
  The first follows from \eqref{rprops} and Lemma~\ref{permutebn}.{\it (i)}; the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2179
  others from the induction hypotheses in \eqref{hyps} (in the fourth case
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2180
  we have to use the fact that @{term "(r \<bullet> (q \<bullet> t\<^isub>2)) = (r + q) \<bullet> t\<^isub>2"}).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2181
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2182
  Taking now the identity permutation @{text 0} for the permutations in \eqref{hyps},
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2183
  we can establish our original goals, namely @{text "P\<^bsub>trm\<^esub> c t"} and \mbox{@{text "P\<^bsub>pat\<^esub> c p"}}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2184
  This completes the proof showing that the weak induction principles imply 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2185
  the strong induction principles. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2186
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2187
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2188
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2189
section {* Related Work\label{related} *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2190
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2191
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2192
  To our knowledge the earliest usage of general binders in a theorem prover
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2193
  is described in \cite{NaraschewskiNipkow99} about a formalisation of the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2194
  algorithm W. This formalisation implements binding in type-schemes using a
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2195
  de-Bruijn indices representation. Since type-schemes in W contain only a single
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2196
  place where variables are bound, different indices do not refer to different binders (as in the usual
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2197
  de-Bruijn representation), but to different bound variables. A similar idea
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2198
  has been recently explored for general binders in the locally nameless
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2199
  approach to binding \cite{chargueraud09}.  There, de-Bruijn indices consist
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2200
  of two numbers, one referring to the place where a variable is bound, and the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2201
  other to which variable is bound. The reasoning infrastructure for both
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2202
  representations of bindings comes for free in theorem provers like Isabelle/HOL or
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2203
  Coq, since the corresponding term-calculi can be implemented as ``normal''
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2204
  datatypes.  However, in both approaches it seems difficult to achieve our
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2205
  fine-grained control over the ``semantics'' of bindings (i.e.~whether the
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2206
  order of binders should matter, or vacuous binders should be taken into
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2207
  account). To do so, one would require additional predicates that filter out
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2208
  unwanted terms. Our guess is that such predicates result in rather
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2209
  intricate formal reasoning.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2210
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2211
  Another technique for representing binding is higher-order abstract syntax
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2212
  (HOAS). , which for example is implemented in the Twelf system. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2213
  This representation
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2214
  technique supports very elegantly many aspects of \emph{single} binding, and
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2215
  impressive work has been done that uses HOAS for mechanising the metatheory
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2216
  of SML~\cite{LeeCraryHarper07}. We are, however, not aware how multiple
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2217
  binders of SML are represented in this work. Judging from the submitted
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2218
  Twelf-solution for the POPLmark challenge, HOAS cannot easily deal with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2219
  binding constructs where the number of bound variables is not fixed. For example 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2220
  In the second part of this challenge, @{text "Let"}s involve
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2221
  patterns that bind multiple variables at once. In such situations, HOAS
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2222
  seems to have to resort to the iterated-single-binders-approach with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2223
  all the unwanted consequences when reasoning about the resulting terms.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2224
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2225
  Two formalisations involving general binders have been 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2226
  performed in older
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2227
  versions of Nominal Isabelle (one about Psi-calculi and one about algorithm W 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2228
  \cite{BengtsonParow09,UrbanNipkow09}).  Both
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2229
  use the approach based on iterated single binders. Our experience with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2230
  the latter formalisation has been disappointing. The major pain arose from
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2231
  the need to ``unbind'' variables. This can be done in one step with our
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2232
  general binders described in this paper, but needs a cumbersome
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2233
  iteration with single binders. The resulting formal reasoning turned out to
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2234
  be rather unpleasant. The hope is that the extension presented in this paper
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2235
  is a substantial improvement.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2236
 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2237
  The most closely related work to the one presented here is the Ott-tool
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2238
  \cite{ott-jfp} and the C$\alpha$ml language \cite{Pottier06}. Ott is a nifty
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2239
  front-end for creating \LaTeX{} documents from specifications of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2240
  term-calculi involving general binders. For a subset of the specifications
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2241
  Ott can also generate theorem prover code using a raw representation of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2242
  terms, and in Coq also a locally nameless representation. The developers of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2243
  this tool have also put forward (on paper) a definition for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2244
  $\alpha$-equivalence of terms that can be specified in Ott.  This definition is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2245
  rather different from ours, not using any nominal techniques.  To our
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2246
  knowledge there is no concrete mathematical result concerning this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2247
  notion of $\alpha$-equivalence.  Also the definition for the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2248
  notion of free variables
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2249
  is work in progress.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2250
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2251
  Although we were heavily inspired by the syntax of Ott,
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2252
  its definition of $\alpha$-equi\-valence is unsuitable for our extension of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2253
  Nominal Isabelle. First, it is far too complicated to be a basis for
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2254
  automated proofs implemented on the ML-level of Isabelle/HOL. Second, it
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2255
  covers cases of binders depending on other binders, which just do not make
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2256
  sense for our $\alpha$-equated terms. Third, it allows empty types that have no
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2257
  meaning in a HOL-based theorem prover. We also had to generalise slightly Ott's 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2258
  binding clauses. In Ott you specify binding clauses with a single body; we 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2259
  allow more than one. We have to do this, because this makes a difference 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2260
  for our notion of $\alpha$-equivalence in case of \isacommand{bind (set)} and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2261
  \isacommand{bind (set+)}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2262
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2263
  Consider the examples
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2264
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2265
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2266
  \begin{tabular}{@ {}l@ {\hspace{2mm}}l@ {}}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2267
  @{text "Foo\<^isub>1 xs::name fset t::trm s::trm"} &  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2268
      \isacommand{bind (set)} @{text "xs"} \isacommand{in} @{text "t s"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2269
  @{text "Foo\<^isub>2 xs::name fset t::trm s::trm"} &  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2270
      \isacommand{bind (set)} @{text "xs"} \isacommand{in} @{text "t"}, 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2271
      \isacommand{bind (set)} @{text "xs"} \isacommand{in} @{text "s"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2272
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2273
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2274
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2275
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2276
  In the first term-constructor we have a single
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2277
  body that happens to be ``spread'' over two arguments; in the second term-constructor we have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2278
  two independent bodies in which the same variables are bound. As a result we 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2279
  have
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2280
   
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2281
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2282
  \begin{tabular}{r@ {\hspace{1.5mm}}c@ {\hspace{1.5mm}}l}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2283
  @{text "Foo\<^isub>1 {a, b} (a, b) (a, b)"} & $\not=$ & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2284
  @{text "Foo\<^isub>1 {a, b} (a, b) (b, a)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2285
  @{text "Foo\<^isub>2 {a, b} (a, b) (a, b)"} & $=$ & 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2286
  @{text "Foo\<^isub>2 {a, b} (a, b) (b, a)"}\\
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2287
  \end{tabular}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2288
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2289
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2290
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2291
  and therefore need the extra generality to be able to distinguish between 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2292
  both specifications.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2293
  Because of how we set up our definitions, we also had to impose some restrictions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2294
  (like a single binding function for a deep binder) that are not present in Ott. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2295
  Our
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2296
  expectation is that we can still cover many interesting term-calculi from
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2297
  programming language research, for example Core-Haskell. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2298
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2299
  Pottier presents in \cite{Pottier06} a language, called C$\alpha$ml, for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2300
  representing terms with general binders inside OCaml. This language is
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2301
  implemented as a front-end that can be translated to OCaml with the help of
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2302
  a library. He presents a type-system in which the scope of general binders
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2303
  can be specified using special markers, written @{text "inner"} and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2304
  @{text "outer"}. It seems our and his specifications can be
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2305
  inter-translated as long as ours use the binding mode 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2306
  \isacommand{bind} only.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2307
  However, we have not proved this. Pottier gives a definition for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2308
  $\alpha$-equivalence, which also uses a permutation operation (like ours).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2309
  Still, this definition is rather different from ours and he only proves that
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2310
  it defines an equivalence relation. A complete
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2311
  reasoning infrastructure is well beyond the purposes of his language. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2312
  Similar work for Haskell with similar results was reported by Cheney \cite{Cheney05a}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2313
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2314
  In a slightly different domain (programming with dependent types), the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2315
  paper \cite{Altenkirch10} presents a calculus with a notion of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2316
  $\alpha$-equivalence related to our binding mode \isacommand{bind (set+)}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2317
  The definition in \cite{Altenkirch10} is similar to the one by Pottier, except that it
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2318
  has a more operational flavour and calculates a partial (renaming) map. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2319
  In this way, the definition can deal with vacuous binders. However, to our
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2320
  best knowledge, no concrete mathematical result concerning this
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2321
  definition of $\alpha$-equivalence has been proved.\\[-7mm]    
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2322
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2323
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2324
section {* Conclusion *}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2325
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2326
text {*
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2327
  We have presented an extension of Nominal Isabelle for dealing with
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2328
  general binders, that is term-constructors having multiple bound 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2329
  variables. For this extension we introduced new definitions of 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2330
  $\alpha$-equivalence and automated all necessary proofs in Isabelle/HOL.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2331
  To specify general binders we used the specifications from Ott, but extended them 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2332
  in some places and restricted
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2333
  them in others so that they make sense in the context of $\alpha$-equated terms. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2334
  We also introduced two binding modes (set and set+) that do not 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2335
  exist in Ott. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2336
  We have tried out the extension with calculi such as Core-Haskell, type-schemes 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2337
  and approximately a  dozen of other typical examples from programming 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2338
  language research~\cite{SewellBestiary}. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2339
  The code
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2340
  will eventually become part of the next Isabelle distribution.\footnote{For the moment
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2341
  it can be downloaded from the Mercurial repository linked at
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2342
  \href{http://isabelle.in.tum.de/nominal/download}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2343
  {http://isabelle.in.tum.de/nominal/download}.}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2344
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2345
  We have left out a discussion about how functions can be defined over
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2346
  $\alpha$-equated terms involving general binders. In earlier versions of Nominal
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2347
  Isabelle this turned out to be a thorny issue.  We
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2348
  hope to do better this time by using the function package that has recently
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2349
  been implemented in Isabelle/HOL and also by restricting function
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2350
  definitions to equivariant functions (for them we can
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2351
  provide more automation).
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2352
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2353
  There are some restrictions we imposed in this paper that we would like to lift in
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2354
  future work. One is the exclusion of nested datatype definitions. Nested
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2355
  datatype definitions allow one to specify, for instance, the function kinds
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2356
  in Core-Haskell as @{text "TFun string (ty list)"} instead of the unfolded
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2357
  version @{text "TFun string ty_list"} (see Figure~\ref{nominalcorehas}). To
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2358
  achieve this, we need a slightly more clever implementation than we have at the moment. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2359
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2360
  A more interesting line of investigation is whether we can go beyond the 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2361
  simple-minded form of binding functions that we adopted from Ott. At the moment, binding
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2362
  functions can only return the empty set, a singleton atom set or unions
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2363
  of atom sets (similarly for lists). It remains to be seen whether 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2364
  properties like
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2365
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2366
  \begin{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2367
  @{text "fa_ty x  =  bn x \<union> fa_bn x"}.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2368
  \end{center}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2369
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2370
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2371
  allow us to support more interesting binding functions. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2372
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2373
  We have also not yet played with other binding modes. For example we can
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2374
  imagine that there is need for a binding mode 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2375
  where instead of lists, we abstract lists of distinct elements.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2376
  Once we feel confident about such binding modes, our implementation 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2377
  can be easily extended to accommodate them.
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2378
  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2379
  \smallskip
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2380
  \noindent
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2381
  {\bf Acknowledgements:} We are very grateful to Andrew Pitts for  
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2382
  many discussions about Nominal Isabelle. 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2383
  We thank Peter Sewell for 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2384
  making the informal notes \cite{SewellBestiary} available to us and 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2385
  also for patiently explaining some of the finer points of the Ott-tool.\\[-7mm]    
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2386
  Stephanie Weirich suggested to separate the subgrammars
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2387
  of kinds and types in our Core-Haskell example. \\[-6mm] 
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2388
*}
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2389
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2390
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2391
(*<*)
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2392
end
05ccb61aa628 started lmcs paper (isabelle make lmcs)
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  2393
(*>*)