Pearl-jv/Paper.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 02 Mar 2011 00:06:28 +0000
changeset 2736 61d30863e5d1
parent 2734 eee5deb35aa8
child 2740 a9e63abf3feb
permissions -rw-r--r--
updated pearl papers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
(*<*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
theory Paper
2568
8193bbaa07fe merged Nominal-General directory into Nominal; renamed Abs.thy to Nominal2_Abs.thy
Christian Urban <urbanc@in.tum.de>
parents: 2523
diff changeset
     3
imports "../Nominal/Nominal2_Base" 
8193bbaa07fe merged Nominal-General directory into Nominal; renamed Abs.thy to Nominal2_Abs.thy
Christian Urban <urbanc@in.tum.de>
parents: 2523
diff changeset
     4
        "../Nominal/Atoms" 
2734
eee5deb35aa8 included old test cases for perm_simp into ROOT.ML file
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
     5
        "../Nominal/Nominal2_Abs"
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
        "LaTeXsugar"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
begin
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
notation (latex output)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  sort_of ("sort _" [1000] 100) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  Abs_perm ("_") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  Rep_perm ("_") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  swap ("'(_ _')" [1000, 1000] 1000) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
  fresh ("_ # _" [51, 51] 50) and
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    15
  fresh_star ("_ #\<^sup>* _" [51, 51] 50) and
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  Cons ("_::_" [78,77] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  supp ("supp _" [78] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  uminus ("-_" [78] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  atom ("|_|") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  If  ("if _ then _ else _" 10) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  Rep_name ("\<lfloor>_\<rfloor>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  Abs_name ("\<lceil>_\<rceil>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  Rep_var ("\<lfloor>_\<rfloor>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  Abs_var ("\<lceil>_\<rceil>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  sort_of_ty ("sort'_ty _")
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
(* BH: uncomment if you really prefer the dot notation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
syntax (latex output)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  "_Collect" :: "pttrn => bool => 'a set" ("(1{_ . _})")
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
(* sort is used in Lists for sorting *)
2005
233bb805a4df replaced hide by the new hide_const
Christian Urban <urbanc@in.tum.de>
parents: 1809
diff changeset
    33
hide_const sort
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
abbreviation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  "sort \<equiv> sort_of"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
abbreviation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  "sort_ty \<equiv> sort_of_ty"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
(*>*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
section {* Introduction *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
text {*
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    46
  Nominal Isabelle provides a proving infratructure for convenient reasoning
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    47
  about programming language calculi involving binders, such as lambda abstractions or
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    48
  quantifications in type schemes:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2382
diff changeset
    49
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    50
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    51
  @{text "\<lambda>x. t       \<forall>{x\<^isub>1,\<dots>,x\<^isub>n}. \<tau>"}
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    52
  \hfill\numbered{atomperm}
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    53
  \end{isabelle}
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    54
  
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    55
  \noindent
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    56
  At its core Nominal Isabelle is based on the nominal logic work by Pitts at
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    57
  al \cite{GabbayPitts02,Pitts03}, whose most basic notion is a
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    58
  sort-respecting permutation operation defined over a countably infinite
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    59
  collection of sorted atoms. The nominal logic work has been starting
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    60
  point for a number of formalisations, most notable Norrish \cite{norrish04} 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    61
  in HOL4, Aydemir et al \cite{AydemirBohannonWeirich07} in Coq and our own 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    62
  work in Isabelle/HOL.
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    63
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
  
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
    65
  Using a single atom type to represent atoms of different sorts and
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    66
  representing permutations as functions are not new ideas; see
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    67
  \cite{GunterOsbornPopescu09} \footnote{function rep.}  The main contribution
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    68
  of this paper is to show an example of how to make better theorem proving
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    69
  tools by choosing the right level of abstraction for the underlying
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    70
  theory---our design choices take advantage of Isabelle's type system, type
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    71
  classes and reasoning infrastructure.  The novel technical contribution is a
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    72
  mechanism for dealing with ``Church-style'' lambda-terms \cite{Church40} and
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    73
  HOL-based languages \cite{PittsHOL4} where variables and variable binding
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    74
  depend on type annotations.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    76
  The paper is organised as follows\ldots
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
section {* Sorted Atoms and Sort-Respecting Permutations *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
text {*
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    82
  The most basic notion in this work is a
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    83
  sort-respecting permutation operation defined over a countably infinite
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    84
  collection of sorted atoms. The atoms are used for representing variable names
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    85
  that might be bound or free. Multiple sorts are necessary for being able to
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    86
  represent different kinds of variables. For example, in the language Mini-ML
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    87
  there are bound term variables in lambda abstractions and bound type variables in
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    88
  type schemes. In order to be able to separate them, each kind of variables needs to be
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    89
  represented by a different sort of atoms. 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    90
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    91
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    92
  The existing nominal logic work usually leaves implicit the sorting
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    93
  information for atoms and as far as we know leaves out a description of how
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    94
  sorts are represented.  In our formalisation, we therefore have to make a
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    95
  design decision about how to implement sorted atoms and sort-respecting
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    96
  permutations. One possibility, which we described in \cite{Urban08}, is to 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    97
  have separate types for the different
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    98
  kinds of atoms, say types @{text "\<alpha>\<^isub>1,\<dots>,\<alpha>\<^isub>n"}. 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
    99
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  In the nominal logic work of Pitts, binders and bound variables are
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
  represented by \emph{atoms}.  As stated above, we need to have different
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
  \emph{sorts} of atoms to be able to bind different kinds of variables.  A
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  basic requirement is that there must be a countably infinite number of atoms
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   104
  of each sort.  We implement these atoms as
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
          datatype atom\<iota> = Atom\<iota> string nat
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  \noindent
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   111
  whereby the string argument specifies the sort of the atom.\footnote{A
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   112
  similar design choice was made by Gunter et al \cite{GunterOsbornPopescu09}
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   113
  for their variables.}  (The use of type \emph{string} is merely for
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   114
  convenience; any countably infinite type would work as well.) We have an
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   115
  auxiliary function @{text sort} that is defined as @{thm
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   116
  sort_of.simps[no_vars]}, and we clearly have for every finite set @{text X}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   117
  of atoms and every sort @{text s} the property:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   118
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
  \begin{proposition}\label{choosefresh}
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   120
  @{text "For a finite set of atoms S, there exists an atom a such that
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   121
  sort a = s and a \<notin> S"}.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
  \end{proposition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
  For implementing sort-respecting permutations, we use functions of type @{typ
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  "atom => atom"} that @{text "i)"} are bijective; @{text "ii)"} are the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
  identity on all atoms, except a finite number of them; and @{text "iii)"} map
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
  each atom to one of the same sort. These properties can be conveniently stated
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
  for a function @{text \<pi>} as follows:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  \begin{tabular}{r@ {\hspace{4mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
  i)   & @{term "bij \<pi>"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
  ii)  & @{term "finite {a. \<pi> a \<noteq> a}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
  iii) & @{term "\<forall>a. sort (\<pi> a) = sort a"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
  \end{tabular}\hfill\numbered{permtype}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
  Like all HOL-based theorem provers, Isabelle/HOL allows us to
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
  introduce a new type @{typ perm} that includes just those functions
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
  satisfying all three properties. For example the identity function,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
  written @{term id}, is included in @{typ perm}. Also function composition, 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  written  \mbox{@{text "_ \<circ> _"}}, and function inversion, given by Isabelle/HOL's 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
  inverse operator and written \mbox{@{text "inv _"}}, preserve the properties 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
  @{text "i"}-@{text "iii"}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  However, a moment of thought is needed about how to construct non-trivial
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  permutations. In the nominal logic work it turned out to be most convenient
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
  to work with swappings, written @{text "(a b)"}.  In our setting the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
  type of swappings must be
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  @{text [display,indent=10] "(_ _) :: atom \<Rightarrow> atom \<Rightarrow> perm"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
  but since permutations are required to respect sorts, we must carefully
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
  consider what happens if a user states a swapping of atoms with different
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   157
  sorts.  In early versions of Nominal Isabelle, we avoided this problem by
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
  using different types for different sorts; the type system prevented users
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  from stating ill-sorted swappings.  Here, however, definitions such 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
  as\footnote{To increase legibility, we omit here and in what follows the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
  @{term Rep_perm} and @{term "Abs_perm"} wrappers that are needed in our
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
  implementation since we defined permutation not to be the full function space,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
  but only those functions of type @{typ perm} satisfying properties @{text
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
  i}-@{text "iii"}.}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
  @{text [display,indent=10] "(a b) \<equiv> \<lambda>c. if a = c then b else (if b = c then a else c)"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
  do not work in general, because the type system does not prevent @{text a}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
  and @{text b} from having different sorts---in which case the function would
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
  violate property @{text iii}.  We could make the definition of swappings
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
  partial by adding the precondition @{term "sort a = sort b"},
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
  which would mean that in case @{text a} and @{text b} have different sorts,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
  the value of @{text "(a b)"} is unspecified.  However, this looked like a
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
  cumbersome solution, since sort-related side conditions would be required
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
  everywhere, even to unfold the definition.  It turned out to be more
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  convenient to actually allow the user to state ``ill-sorted'' swappings but
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
  limit their ``damage'' by defaulting to the identity permutation in the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  ill-sorted case:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  \begin{tabular}{@ {}rl}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
  @{text "(a b) \<equiv>"} & @{text "if (sort a = sort b)"}\\ 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
   & \hspace{3mm}@{text "then \<lambda>c. if a = c then b else (if b = c then a else c)"}\\ 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
   & \hspace{3mm}@{text "else id"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
  \end{tabular}\hfill\numbered{swapdef}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
  This function is bijective, the identity on all atoms except
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
  @{text a} and @{text b}, and sort respecting. Therefore it is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
  a function in @{typ perm}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  One advantage of using functions instead of lists as a representation for
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
  permutations is that for example the swappings
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
  @{thm swap_commute[no_vars]}\hspace{10mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
  @{text "(a a) = id"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
  \end{tabular}\hfill\numbered{swapeqs}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
  are \emph{equal}.  We do not have to use the equivalence relation shown
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
  in~\eqref{permequ} to identify them, as we would if they had been represented
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
  as lists of pairs.  Another advantage of the function representation is that
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   208
  they form a (non-commutative) group provided we define
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
  @{thm zero_perm_def[no_vars, THEN eq_reflection]} \hspace{4mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
  @{thm plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2", THEN eq_reflection]} \hspace{4mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
  @{thm uminus_perm_def[where p="\<pi>", THEN eq_reflection]} \hspace{4mm}
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
   215
  @{thm minus_perm_def[where ?p1.0="\<pi>\<^isub>1" and ?p2.0="\<pi>\<^isub>2"]} 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
  and verify the simple properties
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
  @{thm add_assoc[where a="\<pi>\<^isub>1" and b="\<pi>\<^isub>2" and c="\<pi>\<^isub>3"]} \hspace{3mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
  @{thm monoid_add_class.add_0_left[where a="\<pi>::perm"]} \hspace{3mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
  @{thm monoid_add_class.add_0_right[where a="\<pi>::perm"]} \hspace{3mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
  @{thm group_add_class.left_minus[where a="\<pi>::perm"]} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
  Again this is in contrast to the list-of-pairs representation which does not
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   233
  form a group.  The technical importance of this fact is that we can rely on
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   234
  Isabelle/HOL's existing simplification infrastructure for groups, which will
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   235
  come in handy when we have to do calculations with permutations.
1790
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   236
  Note that Isabelle/HOL defies standard conventions of mathematical notation
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   237
  by using additive syntax even for non-commutative groups.  Obviously,
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   238
  composition of permutations is not commutative in general, because @{text
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   239
  "\<pi>\<^sub>1 + \<pi>\<^sub>2 \<noteq>  \<pi>\<^sub>2 + \<pi>\<^sub>1"}.  But since the point of this paper is to implement the
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   240
  nominal theory as smoothly as possible in Isabelle/HOL, we tolerate
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   241
  the non-standard notation in order to reuse the existing libraries.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
  By formalising permutations abstractly as functions, and using a single type
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
  for all atoms, we can now restate the \emph{permutation properties} from
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
  \eqref{permprops} as just the two equations
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
  \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
  i) & @{thm permute_zero[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
  ii) & @{thm permute_plus[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2",no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
  \end{tabular}\hfill\numbered{newpermprops}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
  in which the permutation operations are of type @{text "perm \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} and so
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
  have only a single type parameter.  Consequently, these properties are
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
  compatible with the one-parameter restriction of Isabelle/HOL's type classes.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
  There is no need to introduce a separate type class instantiated for each
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
  sort, like in the old approach.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
  The next notion allows us to establish generic lemmas involving the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
  permutation operation.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
  \begin{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
  A type @{text "\<beta>"} is a \emph{permutation type} if the permutation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
  properties in \eqref{newpermprops} are satisfied for every @{text "x"} of type
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
  @{text "\<beta>"}.  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
  \end{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
  First, it follows from the laws governing
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
  groups that a permutation and its inverse cancel each other.  That is, for any
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
  @{text "x"} of a permutation type:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  @{thm permute_minus_cancel(1)[where p="\<pi>", no_vars]}\hspace{10mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
  @{thm permute_minus_cancel(2)[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
  \end{tabular}\hfill\numbered{cancel}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   284
  Consequently, in a permutation type the permutation operation @{text "\<pi> \<bullet> _"}~~is bijective, 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
  which in turn implies the property
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
  @{thm (lhs) permute_eq_iff[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
  $\;$if and only if$\;$
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
  @{thm (rhs) permute_eq_iff[where p="\<pi>", no_vars]}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
  \end{tabular}\hfill\numbered{permuteequ}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   296
  We can also show that the following property holds for any permutation type.
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   297
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   298
  \begin{lemma}\label{permutecompose} 
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   299
  Given @{term x} is of permutation type, then 
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   300
  @{text "\<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x) = (\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}.
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   301
  \end{lemma}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   302
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   303
  \begin{proof} The proof is as follows:
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   304
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   305
  \begin{tabular}[b]{@ {}rcl@ {\hspace{8mm}}l}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   306
  @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> x"}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   307
  & @{text "="} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> (-\<pi>\<^isub>1) \<bullet> \<pi>\<^isub>1 \<bullet> x"} & by \eqref{cancel}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   308
  & @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2 - \<pi>\<^isub>1) \<bullet> \<pi>\<^isub>1 \<bullet> x"}  & by {\rm(\ref{newpermprops}.@{text "ii"})}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   309
  & @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   310
  \end{tabular}\hfill\qed
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   311
  \end{isabelle}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   312
  \end{proof}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   313
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   314
  \noindent
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
  In order to lift the permutation operation to other types, we can define for:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   317
  \begin{equation}\label{permdefs}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   318
  \mbox{
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   319
  \begin{tabular}{@ {}ll@ {\hspace{2mm}}l@ {}}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   320
  1) & atoms: & @{thm permute_atom_def[where p="\<pi>",no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   321
  2) & functions: &  @{text "\<pi> \<bullet> f \<equiv> \<lambda>x. \<pi> \<bullet> (f ((-\<pi>) \<bullet> x))"}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   322
  3) & permutations: & @{thm permute_perm_def[where p="\<pi>" and q="\<pi>'", THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   323
  4) & sets: & @{thm permute_set_eq[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   324
  5) & booleans: & @{thm permute_bool_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   325
  6) & lists: & @{thm permute_list.simps(1)[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   326
      & & @{thm permute_list.simps(2)[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   327
  7) & products: & @{thm permute_prod.simps[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   328
  8) & nats: & @{thm permute_nat_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   329
  \end{tabular}}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   330
  \end{equation}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
  and then establish:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
  \begin{theorem}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
  If @{text \<beta>}, @{text "\<beta>\<^isub>1"} and @{text "\<beta>\<^isub>2"} are permutation types, 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
  then so are @{text "atom"}, @{text "\<beta>\<^isub>1 \<Rightarrow> \<beta>\<^isub>2"}, 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
  @{text perm}, @{term "\<beta> set"}, @{term "\<beta> list"}, @{term "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"},
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
  @{text bool} and @{text "nat"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
  \end{theorem}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
  All statements are by unfolding the definitions of the permutation operations and simple 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
  calculations involving addition and minus. With permutations for example we 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
  have
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
  \begin{tabular}[b]{@ {}rcl}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
  @{text "0 \<bullet> \<pi>'"} & @{text "\<equiv>"} & @{text "0 + \<pi>' - 0 = \<pi>'"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
  @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) \<bullet> \<pi>'"} & @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) + \<pi>' - (\<pi>\<^isub>1 + \<pi>\<^isub>2)"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
  & @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) + \<pi>' - \<pi>\<^isub>2 - \<pi>\<^isub>1"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
  & @{text "="} & @{text "\<pi>\<^isub>1 + (\<pi>\<^isub>2 + \<pi>' - \<pi>\<^isub>2) - \<pi>\<^isub>1"} @{text "\<equiv>"} @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> \<pi>'"} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
  \end{tabular}\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
section {* Equivariance *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
text {*
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   361
  An important notion in the nominal logic work is \emph{equivariance}.
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   362
  An equivariant function or predicate is one that is invariant under
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   363
  the swapping of atoms. This notion can be defined
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   364
  uniformly as follows:
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   365
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
  \begin{definition}\label{equivariance}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
  A function @{text f} is \emph{equivariant} if @{term "\<forall>\<pi>. \<pi> \<bullet> f = f"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
  \end{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
  There are a number of equivalent formulations for the equivariance property. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
  For example, assuming @{text f} is of type @{text "\<alpha> \<Rightarrow> \<beta>"}, then equivariance 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
  can also be stated as 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
  @{text "\<forall>\<pi> x.  \<pi> \<bullet> (f x) = f (\<pi> \<bullet> x)"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
  \end{tabular}\hfill\numbered{altequivariance}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
  To see that this formulation implies the definition, we just unfold the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
  definition of the permutation operation for functions and simplify with the equation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
  and the cancellation property shown in \eqref{cancel}. To see the other direction, we use 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
  the fact 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
  @{text "\<pi> \<bullet> (f x) = (\<pi> \<bullet> f) (\<pi> \<bullet> x)"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
  \end{tabular}\hfill\numbered{permutefunapp}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
  which follows again directly 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
  from the definition of the permutation operation for functions and the cancellation 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
  property. Similarly for functions with more than one argument. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
  Both formulations of equivariance have their advantages and disadvantages:
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   400
  the definition, \eqref{permutefunapp} and (\ref{permdefs}.2) lead to a simple
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   401
  rewrite system that pushes permutations inside a term until they reach
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   402
  either function constants or variables. The permutations in front of
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   403
  equivariant functions disappear. Such a rewrite system is often very helpful
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   404
  in determining whether @{text "p \<bullet> t = t"} holds for a compound term @{text t}. In contrast
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   405
  \eqref{altequivariance} is usually easier to establish, since statements are
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   406
  commonly given in a form where functions are fully applied. For example we can
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   407
  easily show that equality is equivariant
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
  @{thm eq_eqvt[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
  using the permutation operation on booleans and property \eqref{permuteequ}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
  Lemma~\ref{permutecompose} establishes that the permutation operation is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
  equivariant. It is also easy to see that the boolean operators, like 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
  @{text "\<and>"}, @{text "\<or>"} and @{text "\<longrightarrow>"} are all equivariant. Furthermore 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
  a simple calculation will show that our swapping functions are equivariant, that is
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  @{thm swap_eqvt[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
  \end{tabular}\hfill\numbered{swapeqvt}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   429
  for all @{text a}, @{text b} and @{text \<pi>}.  
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   430
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   432
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
section {* Support and Freshness *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
  The most original aspect of the nominal logic work of Pitts et al is a general
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
  definition for ``the set of free variables of an object @{text "x"}''.  This
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
  definition is general in the sense that it applies not only to lambda-terms,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
  but also to lists, products, sets and even functions. The definition depends
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
  only on the permutation operation and on the notion of equality defined for
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
  the type of @{text x}, namely:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
  @{thm [display,indent=10] supp_def[no_vars, THEN eq_reflection]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446
  (Note that due to the definition of swapping in \eqref{swapdef}, we do not
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
  need to explicitly restrict @{text a} and @{text b} to have the same sort.)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   448
  There is also the derived notion for when an atom @{text a} is \emph{fresh}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
  for an @{text x}, defined as
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
  @{thm [display,indent=10] fresh_def[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   453
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   454
  We also use the notation @{thm (lhs) fresh_star_def[no_vars]} for sets ot atoms 
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   455
  defined as follows
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   456
  
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   457
  @{thm [display,indent=10] fresh_star_def[no_vars]}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   458
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   459
  \noindent
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
  A striking consequence of these definitions is that we can prove
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
  without knowing anything about the structure of @{term x} that
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
  swapping two fresh atoms, say @{text a} and @{text b}, leave 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
  @{text x} unchanged. For the proof we use the following lemma 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
  about swappings applied to an @{text x}:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
  \begin{lemma}\label{swaptriple}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
  Assuming @{text x} is of permutation type, and @{text a}, @{text b} and @{text c} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   468
  have the same sort, then @{thm (prem 3) swap_rel_trans[no_vars]} and 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   469
  @{thm (prem 4) swap_rel_trans[no_vars]} imply @{thm (concl) swap_rel_trans[no_vars]}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   470
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   471
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
  The cases where @{text "a = c"} and @{text "b = c"} are immediate.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
  For the remaining case it is, given our assumptions, easy to calculate 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   475
  that the permutations
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   476
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   477
  @{thm [display,indent=10] (concl) swap_triple[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   478
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   479
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
  are equal. The lemma is then by application of the second permutation 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
  property shown in \eqref{newpermprops}.\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   484
  \begin{theorem}\label{swapfreshfresh}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
  Let @{text x} be of permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
  @{thm [mode=IfThen] swap_fresh_fresh[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
  \end{theorem}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
  If @{text a} and @{text b} have different sort, then the swapping is the identity.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
  If they have the same sort, we know by definition of support that both
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
  @{term "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}"} and  @{term "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
  hold. So the union of these sets is finite too, and we know by Proposition~\ref{choosefresh} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   494
  that there is an atom @{term c}, with the same sort as @{term a} and @{term b}, 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   495
  that satisfies \mbox{@{term "(a \<rightleftharpoons> c) \<bullet> x = x"}} and @{term "(b \<rightleftharpoons> c) \<bullet> x = x"}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   496
  Now the theorem follows from Lemma~\ref{swaptriple}.\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   497
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   500
  Two important properties that need to be established for later calculations is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   501
  that @{text "supp"} and freshness are equivariant. For this we first show that:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   502
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   503
  \begin{lemma}\label{half}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   504
  If @{term x} is a permutation type, then @{thm (lhs) fresh_permute_iff[where p="\<pi>",no_vars]} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
  if and only if @{thm (rhs) fresh_permute_iff[where p="\<pi>",no_vars]}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   507
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   508
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   509
  \begin{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
  \begin{tabular}[t]{c@ {\hspace{2mm}}l@ {\hspace{5mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
  & \multicolumn{2}{@ {}l}{@{thm (lhs) fresh_permute_iff[where p="\<pi>",no_vars]} @{text "\<equiv>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   512
    @{term "finite {b. (\<pi> \<bullet> a \<rightleftharpoons> b) \<bullet> \<pi> \<bullet> x \<noteq> \<pi> \<bullet> x}"}}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
  @{text "\<Leftrightarrow>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   514
  & @{term "finite {b. (\<pi> \<bullet> a \<rightleftharpoons> \<pi> \<bullet> b) \<bullet> \<pi> \<bullet> x \<noteq> \<pi> \<bullet> x}"} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   515
  & since @{text "\<pi> \<bullet> _"} is bijective\\ 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
  @{text "\<Leftrightarrow>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   517
  & @{term "finite {b. \<pi> \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> \<pi> \<bullet> x}"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   518
  & by \eqref{permutecompose} and \eqref{swapeqvt}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   519
  @{text "\<Leftrightarrow>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   520
  & @{term "finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"} @{text "\<equiv>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   521
    @{thm (rhs) fresh_permute_iff[where p="\<pi>",no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
  & by \eqref{permuteequ}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   523
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   524
  \end{isabelle}\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   525
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   526
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
  Together with the definition of the permutation operation on booleans,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
  we can immediately infer equivariance of freshness: 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
  @{thm [display,indent=10] fresh_eqvt[where p="\<pi>",no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
  Now equivariance of @{text "supp"}, namely
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
  @{thm [display,indent=10] supp_eqvt[where p="\<pi>",no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   537
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   538
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
  is by noting that @{thm supp_conv_fresh[no_vars]} and that freshness and 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   540
  the logical connectives are equivariant.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
  While the abstract properties of support and freshness, particularly 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
  Theorem~\ref{swapfreshfresh}, are useful for developing Nominal Isabelle, 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
  one often has to calculate the support of some concrete object. This is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
  straightforward for example for booleans, nats, products and lists:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   547
  \begin{equation}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   548
  \mbox{
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
  \begin{tabular}{@ {}r@ {\hspace{2mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
  @{text "booleans"}: & @{term "supp b = {}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
  @{text "nats"}:     & @{term "supp n = {}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
  @{text "products"}: & @{thm supp_Pair[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
  @{text "lists:"} & @{thm supp_Nil[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
                   & @{thm supp_Cons[no_vars]}\\
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   555
  \end{tabular}}
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   556
  \end{equation}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   559
  But establishing the support of atoms and permutations is a bit 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   560
  trickier. To do so we will use the following notion about a \emph{supporting set}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   561
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   562
  \begin{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
  A set @{text S} \emph{supports} @{text x} if for all atoms @{text a} and @{text b}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
  not in @{text S} we have @{term "(a \<rightleftharpoons> b) \<bullet> x = x"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
  \end{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   566
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   567
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
  The main motivation for this notion is that we can characterise @{text "supp x"} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
  as the smallest finite set that supports @{text "x"}. For this we prove:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
  \begin{lemma}\label{supports} Let @{text x} be of permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
  \begin{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
  \begin{tabular}{r@ {\hspace{4mm}}p{10cm}}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
  i)    & @{thm[mode=IfThen] supp_is_subset[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
  ii)   & @{thm[mode=IfThen] supp_supports[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
  iii)  & @{thm (concl) supp_is_least_supports[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
         provided @{thm (prem 1) supp_is_least_supports[no_vars]},
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
         @{thm (prem 2) supp_is_least_supports[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579
         and @{text "S"} is the least such set, that means formally,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
         for all @{text "S'"}, if @{term "finite S'"} and 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
         @{term "S' supports x"} then @{text "S \<subseteq> S'"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   583
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   585
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   586
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
  For @{text "i)"} we derive a contradiction by assuming there is an atom @{text a}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
  with @{term "a \<in> supp x"} and @{text "a \<notin> S"}. Using the second fact, the 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   589
  assumption that @{term "S supports x"} gives us that @{text S} is a superset of 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
  @{term "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"}, which is finite by the assumption of @{text S}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
  being finite. But this means @{term "a \<notin> supp x"}, contradicting our assumption.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
  Property @{text "ii)"} is by a direct application of 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
  Theorem~\ref{swapfreshfresh}. For the last property, part @{text "i)"} proves
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
  one ``half'' of the claimed equation. The other ``half'' is by property 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   595
  @{text "ii)"} and the fact that @{term "supp x"} is finite by @{text "i)"}.\hfill\qed  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   597
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   598
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   599
  These are all relatively straightforward proofs adapted from the existing 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   600
  nominal logic work. However for establishing the support of atoms and 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   601
  permutations we found  the following ``optimised'' variant of @{text "iii)"} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   602
  more useful:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   603
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   604
  \begin{lemma}\label{optimised} Let @{text x} be of permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   605
  We have that @{thm (concl) finite_supp_unique[no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   606
  provided @{thm (prem 1) finite_supp_unique[no_vars]},
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   607
  @{thm (prem 2) finite_supp_unique[no_vars]}, and for
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   608
  all @{text "a \<in> S"} and all @{text "b \<notin> S"}, with @{text a}
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   609
  and @{text b} having the same sort, \mbox{@{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"}}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   610
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   611
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   612
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   613
  By Lemma \ref{supports}@{text ".iii)"} we have to show that for every finite
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   614
  set @{text S'} that supports @{text x}, \mbox{@{text "S \<subseteq> S'"}} holds. We will
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   615
  assume that there is an atom @{text "a"} that is element of @{text S}, but
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   616
  not @{text "S'"} and derive a contradiction.  Since both @{text S} and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   617
  @{text S'} are finite, we can by Proposition \ref{choosefresh} obtain an atom
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   618
  @{text b}, which has the same sort as @{text "a"} and for which we know
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   619
  @{text "b \<notin> S"} and @{text "b \<notin> S'"}. Since we assumed @{text "a \<notin> S'"} and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   620
  we have that @{text "S' supports x"}, we have on one hand @{term "(a \<rightleftharpoons> b) \<bullet> x
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   621
  = x"}. On the other hand, the fact @{text "a \<in> S"} and @{text "b \<notin> S"} imply
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   622
  @{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"} using the assumed implication. This gives us the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   623
  contradiction.\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   624
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   625
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   626
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   627
  Using this lemma we only have to show the following three proof-obligations
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   628
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   629
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   630
  \begin{tabular}{@ {}r@ {\hspace{4mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   631
  i)   & @{term "{c} supports c"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   632
  ii)  & @{term "finite {c}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   633
  iii) & @{text "\<forall>a \<in> {c} b \<notin> {c}. sort a = sort b \<longrightarrow> (a b) \<bullet> c \<noteq> c"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   634
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   635
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   636
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   637
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   638
  in order to establish that @{thm supp_atom[where a="c", no_vars]} holds.  In
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   639
  Isabelle/HOL these proof-obligations can be discharged by easy
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   640
  simplifications. Similar proof-obligations arise for the support of
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   641
  permutations, which is
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   642
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   643
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   644
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   645
  @{thm supp_perm[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   646
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   647
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   648
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   649
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   650
  The only proof-obligation that is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   651
  interesting is the one where we have to show that
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   652
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   653
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   654
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
  @{text "If \<pi> \<bullet> a \<noteq> a, \<pi> \<bullet> b = b and sort a = sort b, then (a b) \<bullet> \<pi> \<noteq> \<pi>"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   656
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   657
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   658
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   659
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   660
  For this we observe that 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   661
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   662
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   663
  \begin{tabular}{@ {}rcl}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   664
  @{thm (lhs) perm_swap_eq[where p="\<pi>", no_vars]} &
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   665
  if and only if &
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   666
  @{thm (rhs) perm_swap_eq[where p="\<pi>", no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   667
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   668
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   669
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   670
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   671
  holds by a simple calculation using the group properties of permutations.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   672
  The proof-obligation can then be discharged by analysing the inequality
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   673
  between the permutations @{term "(\<pi> \<bullet> a \<rightleftharpoons> b)"} and @{term "(a \<rightleftharpoons> b)"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   674
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   675
  The main point about support is that whenever an object @{text x} has finite
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   676
  support, then Proposition~\ref{choosefresh} allows us to choose for @{text x} a 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   677
  fresh atom with arbitrary sort. This is an important operation in Nominal
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   678
  Isabelle in situations where, for example, a bound variable needs to be
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   679
  renamed. To allow such a choice, we only have to assume that 
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   680
  @{text "finite (supp x)"} holds. For more convenience we
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   681
  can define a type class for types where every element has finite support, and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   682
  prove that the types @{term "atom"}, @{term "perm"}, lists, products and
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   683
  booleans are instances of this type class. 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   684
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   685
  Unfortunately, this does not work for sets or Isabelle/HOL's function
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   686
  type.\footnote{Isabelle/HOL takes the type @{text "\<alpha> set"} as an abbreviation
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   687
  of @{text "\<alpha> \<Rightarrow> bool"}.}  There are functions and sets definable in
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   688
  Isabelle/HOL for which the finite support property does not hold.  A simple
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   689
  example of a function with infinite support is the function that returns the
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   690
  natural number of an atom
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   691
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   692
  @{text [display, indent=10] "nat_of (Atom s i) \<equiv> i"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   693
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   694
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   695
  This function's support is the set of \emph{all} atoms. To establish this we show @{term "\<not> a \<sharp> nat_of"}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   696
  This is equivalent to assuming the set @{term "{b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"} is finite
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   697
  and deriving a contradiction. From the assumption we also know that 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   698
  @{term "{a} \<union> {b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"} is finite. Then we can use 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   699
  Proposition~\ref{choosefresh} to choose an atom @{text c} such that
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   700
  @{term "c \<noteq> a"}, @{term "sort_of c = sort_of a"} and @{term "(a \<rightleftharpoons> c) \<bullet> nat_of = nat_of"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   701
  Now we can reason as follows:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   702
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   703
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   704
  \begin{tabular}[b]{@ {}rcl@ {\hspace{5mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   705
  @{text "nat_of a"} & @{text "="} & @{text "(a \<rightleftharpoons> c) \<bullet> (nat_of a)"} & by def.~of permutations on nats\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   706
  & @{text "="} & @{term "((a \<rightleftharpoons> c) \<bullet> nat_of) ((a \<rightleftharpoons> c) \<bullet> a)"} & by \eqref{permutefunapp}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   707
  & @{text "="} & @{term "nat_of c"} & by assumptions on @{text c}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   708
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   709
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   710
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   711
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   712
  But this means we have that @{term "nat_of a = nat_of c"} and @{term "sort_of a = sort_of c"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   713
  This implies that atoms @{term a} and @{term c} must be equal, which clashes with our
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   714
  assumption @{term "c \<noteq> a"} about how we chose @{text c}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   715
  Cheney \cite{Cheney06} gives similar examples for constructions that have infinite support.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   716
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   717
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   718
section {* Support of Finite Sets *}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   719
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   720
text {*
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   721
  As shown above, sets is one instance of a type that is not generally finitely supported. 
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   722
  However, we can easily show that finite sets of atoms are finitely
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   723
  supported, because their support can be characterised as:
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   724
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   725
  \begin{lemma}\label{finatomsets}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   726
  If @{text S} is a finite set of atoms, then @{thm (concl) supp_finite_atom_set[no_vars]}.
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   727
  \end{lemma}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   728
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   729
  \begin{proof}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   730
  finite-supp-unique
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   731
  \end{proof}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   732
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   733
  \noindent
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   734
  More difficult, however, is it to establish that finite sets of finitely 
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   735
  supported objects are finitely supported. 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   736
*}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   737
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   738
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   739
section {* Induction Principles *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   740
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   741
text {*
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   742
  While the use of functions as permutation provides us with a unique
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   743
  representation for permutations (for example @{term "(a \<rightleftharpoons> b)"} and 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   744
  @{term "(b \<rightleftharpoons> a)"} are equal permutations), this representation has 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   745
  one draw back: it does not come readily with an induction principle. 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   746
  Such an induction principle is handy for deriving properties like
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   747
  
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   748
  @{thm [display, indent=10] supp_perm_eq[no_vars]}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   749
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   750
  \noindent
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   751
  However, it is not too difficult to derive an induction principle, 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   752
  given the fact that we allow only permutations with a finite domain. 
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
   753
*}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   754
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   755
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   756
section {* An Abstraction Type *}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   757
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   758
text {*
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   759
  To that end, we will consider
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   760
  first pairs @{text "(as, x)"} of type @{text "(atom set) \<times> \<beta>"}.  These pairs
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   761
  are intended to represent the abstraction, or binding, of the set of atoms @{text
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   762
  "as"} in the body @{text "x"}.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   763
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   764
  The first question we have to answer is when two pairs @{text "(as, x)"} and
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   765
  @{text "(bs, y)"} are $\alpha$-equivalent? (For the moment we are interested in
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   766
  the notion of $\alpha$-equivalence that is \emph{not} preserved by adding
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   767
  vacuous binders.) To answer this question, we identify four conditions: {\it (i)}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   768
  given a free-atom function @{text "fa"} of type \mbox{@{text "\<beta> \<Rightarrow> atom
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   769
  set"}}, then @{text x} and @{text y} need to have the same set of free
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   770
  atoms; moreover there must be a permutation @{text p} such that {\it
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   771
  (ii)} @{text p} leaves the free atoms of @{text x} and @{text y} unchanged, but
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   772
  {\it (iii)} ``moves'' their bound names so that we obtain modulo a relation,
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   773
  say \mbox{@{text "_ R _"}}, two equivalent terms. We also require that {\it (iv)}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   774
  @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   775
  requirements {\it (i)} to {\it (iv)} can be stated formally as follows:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   776
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   777
  \begin{equation}\label{alphaset}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   778
  \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l@ {\hspace{4mm}}r}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   779
  \multicolumn{3}{l}{@{text "(as, x) \<approx>set R fa p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}}\\[1mm]
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   780
              & @{term "fa(x) - as = fa(y) - bs"} & \mbox{\it (i)}\\
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   781
  @{text "\<and>"} & @{term "(fa(x) - as) \<sharp>* p"} & \mbox{\it (ii)}\\
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   782
  @{text "\<and>"} & @{text "(p \<bullet> x) R y"} & \mbox{\it (iii)}\\
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   783
  @{text "\<and>"} & @{term "(p \<bullet> as) = bs"} & \mbox{\it (iv)}\\ 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   784
  \end{array}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   785
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   786
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   787
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   788
  Note that this relation depends on the permutation @{text
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   789
  "p"}; $\alpha$-equivalence between two pairs is then the relation where we
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   790
  existentially quantify over this @{text "p"}. Also note that the relation is
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   791
  dependent on a free-atom function @{text "fa"} and a relation @{text
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   792
  "R"}. The reason for this extra generality is that we will use
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   793
  $\approx_{\,\textit{set}}$ for both ``raw'' terms and $\alpha$-equated terms. In
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   794
  the latter case, @{text R} will be replaced by equality @{text "="} and we
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   795
  will prove that @{text "fa"} is equal to @{text "supp"}.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   796
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   797
  It might be useful to consider first some examples about how these definitions
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   798
  of $\alpha$-equivalence pan out in practice.  For this consider the case of
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   799
  abstracting a set of atoms over types (as in type-schemes). We set
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   800
  @{text R} to be the usual equality @{text "="} and for @{text "fa(T)"} we
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   801
  define
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   802
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   803
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   804
  @{text "fa(x) = {x}"}  \hspace{5mm} @{text "fa(T\<^isub>1 \<rightarrow> T\<^isub>2) = fa(T\<^isub>1) \<union> fa(T\<^isub>2)"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   805
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   806
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   807
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   808
  Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   809
  \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   810
  @{text "({y, x}, y \<rightarrow> x)"} are $\alpha$-equivalent according to
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   811
  $\approx_{\,\textit{set}}$ and $\approx_{\,\textit{res}}$ by taking @{text p} to
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   812
  be the swapping @{term "(x \<rightleftharpoons> y)"}. In case of @{text "x \<noteq> y"}, then @{text
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   813
  "([x, y], x \<rightarrow> y)"} $\not\approx_{\,\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   814
  since there is no permutation that makes the lists @{text "[x, y]"} and
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   815
  @{text "[y, x]"} equal, and also leaves the type \mbox{@{text "x \<rightarrow> y"}}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   816
  unchanged. Another example is @{text "({x}, x)"} $\approx_{\,\textit{res}}$
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   817
  @{text "({x, y}, x)"} which holds by taking @{text p} to be the identity
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   818
  permutation.  However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   819
  $\not\approx_{\,\textit{set}}$ @{text "({x, y}, x)"} since there is no
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   820
  permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   821
  (similarly for $\approx_{\,\textit{list}}$).  It can also relatively easily be
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   822
  shown that all three notions of $\alpha$-equivalence coincide, if we only
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   823
  abstract a single atom.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   824
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   825
  In the rest of this section we are going to introduce three abstraction 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   826
  types. For this we define 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   827
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   828
  \begin{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   829
  @{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_set (as, x) equal supp p (bs, x)"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   830
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   831
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   832
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   833
  (similarly for $\approx_{\,\textit{abs\_res}}$ 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   834
  and $\approx_{\,\textit{abs\_list}}$). We can show that these relations are equivalence 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   835
  relations and equivariant.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   836
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   837
  \begin{lemma}\label{alphaeq} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   838
  The relations $\approx_{\,\textit{abs\_set}}$, $\approx_{\,\textit{abs\_list}}$
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   839
  and $\approx_{\,\textit{abs\_res}}$ are equivalence relations, and if @{term
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   840
  "abs_set (as, x) (bs, y)"} then also @{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet>
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   841
  bs, p \<bullet> y)"} (similarly for the other two relations).
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   842
  \end{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   843
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   844
  \begin{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   845
  Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   846
  a permutation @{text p} and for the proof obligation take @{term "-p"}. In case 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   847
  of transitivity, we have two permutations @{text p} and @{text q}, and for the
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   848
  proof obligation use @{text "q + p"}. All conditions are then by simple
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   849
  calculations. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   850
  \end{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   851
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   852
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   853
  This lemma allows us to use our quotient package for introducing 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   854
  new types @{text "\<beta> abs_set"}, @{text "\<beta> abs_res"} and @{text "\<beta> abs_list"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   855
  representing $\alpha$-equivalence classes of pairs of type 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   856
  @{text "(atom set) \<times> \<beta>"} (in the first two cases) and of type @{text "(atom list) \<times> \<beta>"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   857
  (in the third case). 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   858
  The elements in these types will be, respectively, written as:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   859
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   860
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   861
  @{term "Abs_set as x"} \hspace{5mm} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   862
  @{term "Abs_res as x"} \hspace{5mm}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   863
  @{term "Abs_lst as x"} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   864
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   865
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   866
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   867
  indicating that a set (or list) of atoms @{text as} is abstracted in @{text x}. We will
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   868
  call the types \emph{abstraction types} and their elements
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   869
  \emph{abstractions}. The important property we need to derive is the support of 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   870
  abstractions, namely:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   871
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   872
  \begin{theorem}[Support of Abstractions]\label{suppabs} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   873
  Assuming @{text x} has finite support, then\\[-6mm] 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   874
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   875
  \begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   876
  %@ {thm (lhs) supp_abs(1)[no_vars]} & $=$ & @ {thm (rhs) supp_abs(1)[no_vars]}\\
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   877
  %@ {thm (lhs) supp_abs(2)[no_vars]} & $=$ & @ {thm (rhs) supp_abs(2)[no_vars]}\\
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   878
  %@ {thm (lhs) supp_abs(3)[where bs="as", no_vars]} & $=$ & @ {thm (rhs) supp_abs(3)[where bs="as", no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   879
  \end{tabular}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   880
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   881
  \end{theorem}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   882
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   883
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   884
  Below we will show the first equation. The others 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   885
  follow by similar arguments. By definition of the abstraction type @{text "abs_set"} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   886
  we have 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   887
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   888
  \begin{equation}\label{abseqiff}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   889
  %@ {thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\text{if and only if}\;\; 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   890
  %@ {thm (rhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   891
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   892
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   893
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   894
  and also
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   895
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   896
  \begin{equation}\label{absperm}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   897
  @{thm permute_Abs[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   898
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   899
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   900
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   901
  The second fact derives from the definition of permutations acting on pairs 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   902
  \eqref{permute} and $\alpha$-equivalence being equivariant 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   903
  (see Lemma~\ref{alphaeq}). With these two facts at our disposal, we can show 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   904
  the following lemma about swapping two atoms in an abstraction.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   905
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   906
  \begin{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   907
  %@ {thm[mode=IfThen] abs_swap1(1)[where bs="as", no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   908
  \end{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   909
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   910
  \begin{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   911
  This lemma is straightforward using \eqref{abseqiff} and observing that
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   912
  the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   913
  Moreover @{text supp} and set difference are equivariant (see \cite{HuffmanUrban10}).
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   914
  \end{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   915
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   916
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   917
  Assuming that @{text "x"} has finite support, this lemma together 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   918
  with \eqref{absperm} allows us to show
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   919
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   920
  \begin{equation}\label{halfone}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   921
  %@ {thm abs_supports(1)[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   922
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   923
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   924
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   925
  which by Property~\ref{supportsprop} gives us ``one half'' of
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   926
  Theorem~\ref{suppabs}. The ``other half'' is a bit more involved. To establish 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   927
  it, we use a trick from \cite{Pitts04} and first define an auxiliary 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   928
  function @{text aux}, taking an abstraction as argument:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   929
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   930
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   931
  @{thm supp_set.simps[THEN eq_reflection, no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   932
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   933
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   934
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   935
  Using the second equation in \eqref{equivariance}, we can show that 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   936
  @{text "aux"} is equivariant (since @{term "p \<bullet> (supp x - as) =
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   937
  (supp (p \<bullet> x)) - (p \<bullet> as)"}) and therefore has empty support. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   938
  This in turn means
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   939
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   940
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   941
  @{term "supp (supp_gen (Abs_set as x)) \<subseteq> supp (Abs_set as x)"}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   942
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   943
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   944
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   945
  using \eqref{suppfun}. Assuming @{term "supp x - as"} is a finite set,
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   946
  we further obtain
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   947
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   948
  \begin{equation}\label{halftwo}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   949
  %@ {thm (concl) supp_abs_subset1(1)[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   950
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   951
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   952
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   953
  since for finite sets of atoms, @{text "bs"}, we have 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   954
  @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   955
  Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   956
  Theorem~\ref{suppabs}. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   957
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   958
  The method of first considering abstractions of the
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   959
  form @{term "Abs_set as x"} etc is motivated by the fact that 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   960
  we can conveniently establish  at the Isabelle/HOL level
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   961
  properties about them.  It would be
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   962
  laborious to write custom ML-code that derives automatically such properties 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   963
  for every term-constructor that binds some atoms. Also the generality of
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   964
  the definitions for $\alpha$-equivalence will help us in the next section. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   965
*}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   966
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   967
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   968
section {* Concrete Atom Types *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   969
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   970
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   971
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   972
  So far, we have presented a system that uses only a single multi-sorted atom
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   973
  type.  This design gives us the flexibility to define operations and prove
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   974
  theorems that are generic with respect to atom sorts.  For example, as
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   975
  illustrated above the @{term supp} function returns a set that includes the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   976
  free atoms of \emph{all} sorts together; the flexibility offered by the new
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   977
  atom type makes this possible.  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   978
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   979
  However, the single multi-sorted atom type does not make an ideal interface
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   980
  for end-users of Nominal Isabelle.  If sorts are not distinguished by
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   981
  Isabelle's type system, users must reason about atom sorts manually.  That
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   982
  means subgoals involving sorts must be discharged explicitly within proof
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   983
  scripts, instead of being inferred by Isabelle/HOL's type checker.  In other
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   984
  cases, lemmas might require additional side conditions about sorts to be true.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   985
  For example, swapping @{text a} and @{text b} in the pair \mbox{@{term "(a,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   986
  b)"}} will only produce the expected result if we state the lemma in
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   987
  Isabelle/HOL as:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   988
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   989
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   990
          lemma
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   991
	    fixes a b :: "atom"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   992
	    assumes asm: "sort a = sort b"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   993
	    shows "(a \<rightleftharpoons> b) \<bullet> (a, b) = (b, a)" 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   994
          using asm by simp
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   995
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   996
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   997
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   998
  Fortunately, it is possible to regain most of the type-checking automation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   999
  that is lost by moving to a single atom type.  We accomplish this by defining
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1000
  \emph{subtypes} of the generic atom type that only include atoms of a single
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1001
  specific sort.  We call such subtypes \emph{concrete atom types}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1002
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1003
  The following Isabelle/HOL command defines a concrete atom type called
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1004
  \emph{name}, which consists of atoms whose sort equals the string @{term
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1005
  "''name''"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1006
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1007
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1008
  \isacommand{typedef}\ \ @{typ name} = @{term "{a. sort\<iota> a = ''name''}"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1009
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1010
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1011
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1012
  This command automatically generates injective functions that map from the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1013
  concrete atom type into the generic atom type and back, called
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1014
  representation and abstraction functions, respectively. We will write these
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1015
  functions as follows:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1016
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1017
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1018
  \begin{tabular}{@ {}l@ {\hspace{10mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1019
  @{text "\<lfloor>_\<rfloor> :: name \<Rightarrow> atom"} & 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1020
  @{text "\<lceil>_\<rceil> :: atom \<Rightarrow> name"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1021
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1022
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1023
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1024
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1025
  With the definition @{thm permute_name_def [where p="\<pi>", THEN
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1026
  eq_reflection, no_vars]}, it is straightforward to verify that the type 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1027
  @{typ name} is a permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1028
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1029
  In order to reason uniformly about arbitrary concrete atom types, we define a
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1030
  type class that characterises type @{typ name} and other similarly-defined
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1031
  types.  The definition of the concrete atom type class is as follows: First,
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1032
  every concrete atom type must be a permutation type.  In addition, the class
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1033
  defines an overloaded function that maps from the concrete type into the
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1034
  generic atom type, which we will write @{text "|_|"}.  For each class
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1035
  instance, this function must be injective and equivariant, and its outputs
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1036
  must all have the same sort, that is
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1037
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1038
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1039
  \begin{tabular}{r@ {\hspace{3mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1040
  i)   if @{thm (lhs) atom_eq_iff [no_vars]} then @{thm (rhs) atom_eq_iff [no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1041
  ii)  @{thm atom_eqvt[where p="\<pi>", no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1042
  iii) @{thm sort_of_atom_eq [no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1043
  \end{tabular}\hfill\numbered{atomprops}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1044
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1045
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1046
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1047
  With the definition @{thm atom_name_def [THEN eq_reflection, no_vars]} we can
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1048
  show that @{typ name} satisfies all the above requirements of a concrete atom
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1049
  type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1050
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1051
  The whole point of defining the concrete atom type class was to let users
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1052
  avoid explicit reasoning about sorts.  This benefit is realised by defining a
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1053
  special swapping operation of type @{text "\<alpha> \<Rightarrow> \<alpha>
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1054
  \<Rightarrow> perm"}, where @{text "\<alpha>"} is a concrete atom type:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1055
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1056
  @{thm [display,indent=10] flip_def [THEN eq_reflection, no_vars]}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1057
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1058
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1059
  As a consequence of its type, the @{text "\<leftrightarrow>"}-swapping
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1060
  operation works just like the generic swapping operation, but it does not
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1061
  require any sort-checking side conditions---the sort-correctness is ensured by
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1062
  the types!  For @{text "\<leftrightarrow>"} we can establish the following
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1063
  simplification rule:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1064
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1065
  @{thm [display,indent=10] permute_flip_at[no_vars]} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1066
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1067
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1068
  If we now want to swap the \emph{concrete} atoms @{text a} and @{text b}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1069
  in the pair @{term "(a, b)"} we can establish the lemma as follows:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1070
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1071
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1072
          lemma
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1073
	    fixes a b :: "name"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1074
	    shows "(a \<leftrightarrow> b) \<bullet> (a, b) = (b, a)" 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1075
	  by simp
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1076
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1077
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1078
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1079
  There is no need to state an explicit premise involving sorts.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1080
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1081
  We can automate the process of creating concrete atom types, so that users 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1082
  can define a new one simply by issuing the command 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1083
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1084
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1085
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1086
  \isacommand{atom\_decl}~~@{text "name"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1087
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1088
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1089
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1090
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1091
  This command can be implemented using less than 100 lines of custom ML-code.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1092
  In comparison, the old version of Nominal Isabelle included more than 1000
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1093
  lines of ML-code for creating concrete atom types, and for defining various
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1094
  type classes and instantiating generic lemmas for them.  In addition to
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1095
  simplifying the ML-code, the setup here also offers user-visible improvements:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1096
  Now concrete atoms can be declared at any point of a formalisation, and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1097
  theories that separately declare different atom types can be merged
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1098
  together---it is no longer required to collect all atom declarations in one
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1099
  place.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1100
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1101
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1102
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1103
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1104
section {* Related Work *}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1105
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1106
text {*
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1107
  Add here comparison with old work.
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1108
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1109
  The main point is that the above reasoning blends smoothly with the reasoning
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1110
  infrastructure of Isabelle/HOL; no custom ML-code is necessary and a single
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1111
  type class suffices. 
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1112
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1113
  With this
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1114
  design one can represent permutations as lists of pairs of atoms and the
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1115
  operation of applying a permutation to an object as the function
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1116
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1117
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1118
  @{text [display,indent=10] "_ \<bullet> _  ::  (\<alpha> \<times> \<alpha>) list \<Rightarrow> \<beta> \<Rightarrow> \<beta>"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1119
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1120
  \noindent 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1121
  where @{text "\<alpha>"} stands for a type of atoms and @{text "\<beta>"} for the type
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1122
  of the objects on which the permutation acts. For atoms 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1123
  the permutation operation is defined over the length of lists as follows
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1124
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1125
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1126
  \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1127
  @{text "[] \<bullet> c"} & @{text "="} & @{text c}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1128
  @{text "(a b)::\<pi> \<bullet> c"} & @{text "="} & 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1129
     $\begin{cases} @{text a} & \textrm{if}~@{text "\<pi> \<bullet> c = b"}\\ 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1130
                    @{text b} & \textrm{if}~@{text "\<pi> \<bullet> c = a"}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1131
                    @{text "\<pi> \<bullet> c"} & \textrm{otherwise}\end{cases}$
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1132
  \end{tabular}\hfill\numbered{atomperm}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1133
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1134
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1135
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1136
  where we write @{text "(a b)"} for a swapping of atoms @{text "a"} and
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1137
  @{text "b"}. For atoms with different type than the permutation, we 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1138
  define @{text "\<pi> \<bullet> c \<equiv> c"}.
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1139
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1140
  With the separate atom types and the list representation of permutations it
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1141
  is impossible in systems like Isabelle/HOL to state an ``ill-sorted''
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1142
  permutation, since the type system excludes lists containing atoms of
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1143
  different type. However, a disadvantage is that whenever we need to
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1144
  generalise induction hypotheses by quantifying over permutations, we have to
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1145
  build quantifications like
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1146
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1147
  @{text [display,indent=10] "\<forall>\<pi>\<^isub>1 \<dots> \<forall>\<pi>\<^isub>n. \<dots>"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1148
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1149
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1150
  where the @{text "\<pi>\<^isub>i"} are of type @{text "(\<alpha>\<^isub>i \<times> \<alpha>\<^isub>i) list"}. 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1151
  The reason is that the permutation operation behaves differently for 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1152
  every @{text "\<alpha>\<^isub>i"} and the type system does not allow use to have a
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1153
  single quantification to stand for all permutations. Similarly, the 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1154
  notion of support
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1155
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1156
  @{text [display,indent=10] "supp _ :: \<beta> \<Rightarrow> \<alpha> set"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1157
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1158
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1159
  which we will define later, cannot be
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1160
  used to express the support of an object over \emph{all} atoms. The reason
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1161
  is that support can behave differently for each @{text
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1162
  "\<alpha>\<^isub>i"}. This problem is annoying, because if we need to know in
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1163
  a statement that an object, say @{text "x"}, is finitely supported we end up
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1164
  with having to state premises of the form
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1165
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1166
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1167
  \begin{tabular}{@ {}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1168
  @{text "finite ((supp x) :: \<alpha>\<^isub>1 set) , \<dots>, finite ((supp x) :: \<alpha>\<^isub>n set)"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1169
  \end{tabular}\hfill\numbered{fssequence}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1170
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1171
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1172
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1173
  Because of these disadvantages, we will use in this paper a single unified atom type to 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1174
  represent atoms of different sorts. Consequently, we have to deal with the
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1175
  case that a swapping of two atoms is ill-sorted: we cannot rely anymore on
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1176
  the type systems to exclude them. 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1177
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1178
  We also will not represent permutations as lists of pairs of atoms (as done in
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1179
  \cite{Urban08}).  Although an
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1180
  advantage of this representation is that the basic operations on
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1181
  permutations are already defined in Isabelle's list library: composition of
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1182
  two permutations (written @{text "_ @ _"}) is just list append, and
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1183
  inversion of a permutation (written @{text "_\<^sup>-\<^sup>1"}) is just
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1184
  list reversal, and another advantage is that there is a well-understood
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1185
  induction principle for lists, a disadvantage is that permutations 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1186
  do not have unique representations as lists. We have to explicitly identify
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1187
  them according to the relation
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1188
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1189
  
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1190
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1191
  \begin{tabular}{@ {}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1192
  @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2  \<equiv>  \<forall>a. \<pi>\<^isub>1 \<bullet> a = \<pi>\<^isub>2 \<bullet> a"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1193
  \end{tabular}\hfill\numbered{permequ}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1194
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1195
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1196
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1197
  This is a problem when lifting the permutation operation to other types, for
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1198
  example sets, functions and so on. For this we need to ensure that every definition
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1199
  is well-behaved in the sense that it satisfies some
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1200
  \emph{permutation properties}. In the list representation we need
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1201
  to state these properties as follows:
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1202
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1203
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1204
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1205
  \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1206
  i) & @{text "[] \<bullet> x = x"}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1207
  ii) & @{text "(\<pi>\<^isub>1 @ \<pi>\<^isub>2) \<bullet> x = \<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x)"}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1208
  iii) & if @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2"} then @{text "\<pi>\<^isub>1 \<bullet> x = \<pi>\<^isub>2 \<bullet> x"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1209
  \end{tabular}\hfill\numbered{permprops}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1210
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1211
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1212
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1213
  where the last clause explicitly states that the permutation operation has
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1214
  to produce the same result for related permutations.  Moreover, 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1215
  ``permutations-as-lists'' do not satisfy the group properties. This means by
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1216
  using this representation we will not be able to reuse the extensive
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1217
  reasoning infrastructure in Isabelle about groups.  Because of this, we will represent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1218
  in this paper permutations as functions from atoms to atoms. This representation
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1219
  is unique and satisfies the laws of non-commutative groups.
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1220
*}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1221
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1222
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1223
section {* Conclusion *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1224
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1225
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1226
  This proof pearl describes a new formalisation of the nominal logic work by
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1227
  Pitts et al. With the definitions we presented here, the formal reasoning blends 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1228
  smoothly with the infrastructure of the Isabelle/HOL theorem prover. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1229
  Therefore the formalisation will be the underlying theory for a 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1230
  new version of Nominal Isabelle.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1231
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1232
  The main difference of this paper with respect to existing work on Nominal
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1233
  Isabelle is the representation of atoms and permutations. First, we used a
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1234
  single type for sorted atoms. This design choice means for a term @{term t},
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1235
  say, that its support is completely characterised by @{term "supp t"}, even
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1236
  if the term contains different kinds of atoms. Also, whenever we have to
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1237
  generalise an induction so that a property @{text P} is not just established
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1238
  for all @{text t}, but for all @{text t} \emph{and} under all permutations
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1239
  @{text \<pi>}, then we only have to state @{term "\<forall>\<pi>. P (\<pi> \<bullet> t)"}. The reason is
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1240
  that permutations can now consist of multiple swapping each of which can
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1241
  swap different kinds of atoms. This simplifies considerably the reasoning
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1242
  involved in building Nominal Isabelle.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1243
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1244
  Second, we represented permutations as functions so that the associated
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1245
  permutation operation has only a single type parameter. This is very convenient
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1246
  because the abstract reasoning about permutations fits cleanly
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1247
  with Isabelle/HOL's type classes. No custom ML-code is required to work
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1248
  around rough edges. Moreover, by establishing that our permutations-as-functions
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1249
  representation satisfy the group properties, we were able to use extensively 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1250
  Isabelle/HOL's reasoning infrastructure for groups. This often reduced proofs 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1251
  to simple calculations over @{text "+"}, @{text "-"} and @{text "0"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1252
  An interesting point is that we defined the swapping operation so that a 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1253
  swapping of two atoms with different sorts is \emph{not} excluded, like 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1254
  in our older work on Nominal Isabelle, but there is no ``effect'' of such 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1255
  a swapping (it is defined as the identity). This is a crucial insight
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1256
  in order to make the approach based on a single type of sorted atoms to work.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1257
  But of course it is analogous to the well-known trick of defining division by 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1258
  zero to return zero.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1259
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1260
  We noticed only one disadvantage of the permutations-as-functions: Over
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
  1261
  lists we can easily perform inductions. For permutations made up from
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1262
  functions, we have to manually derive an appropriate induction principle. We
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1263
  can establish such a principle, but we have no real experience yet whether ours
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1264
  is the most useful principle: such an induction principle was not needed in
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1265
  any of the reasoning we ported from the old Nominal Isabelle, except
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1266
  when showing that if @{term "\<forall>a \<in> supp x. a \<sharp> p"} implies @{term "p \<bullet> x = x"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1267
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1268
  Finally, our implementation of sorted atoms turned out powerful enough to
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1269
  use it for representing variables that carry on additional information, for
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1270
  example typing annotations. This information is encoded into the sorts. With
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1271
  this we can represent conveniently binding in ``Church-style'' lambda-terms
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1272
  and HOL-based languages. While dealing with such additional information in 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1273
  dependent type-theories, such as LF or Coq, is straightforward, we are not 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1274
  aware of any  other approach in a non-dependent HOL-setting that can deal 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1275
  conveniently with such binders.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1276
 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1277
  The formalisation presented here will eventually become part of the Isabelle 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1278
  distribution, but for the moment it can be downloaded from the 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1279
  Mercurial repository linked at 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1280
  \href{http://isabelle.in.tum.de/nominal/download}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1281
  {http://isabelle.in.tum.de/nominal/download}.\smallskip
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1282
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1283
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1284
  {\bf Acknowledgements:} We are very grateful to Jesper Bengtson, Stefan 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1285
  Berghofer and Cezary Kaliszyk for their comments on earlier versions 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1286
  of this paper. We are also grateful to the anonymous referee who helped us to
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1287
  put the work into the right context.  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1288
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1289
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1290
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1291
(*<*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1292
end
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1293
(*>*)