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