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