Pearl-jv/Paper.thy
author Christian Urban <urbanc@in.tum.de>
Sun, 10 Apr 2011 14:13:55 +0800
changeset 2761 64a03564bc24
parent 2759 aeda59ca0d4c
child 2771 66ef2a2c64fb
permissions -rw-r--r--
more paper
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"
2747
a5da7b6aff8f precise path to LaTeXsugar
Christian Urban <urbanc@in.tum.de>
parents: 2746
diff changeset
     6
        "~~/src/HOL/Library/LaTeXsugar"
1785
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
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
     9
abbreviation
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    10
 UNIV_atom ("\<allatoms>")
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    11
where
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    12
 "UNIV_atom \<equiv> UNIV::atom set" 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    13
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
notation (latex output)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  sort_of ("sort _" [1000] 100) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  Abs_perm ("_") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  Rep_perm ("_") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  swap ("'(_ _')" [1000, 1000] 1000) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
  fresh ("_ # _" [51, 51] 50) and
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
    20
  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
    21
  Cons ("_::_" [78,77] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  supp ("supp _" [78] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  uminus ("-_" [78] 73) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  atom ("|_|") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  If  ("if _ then _ else _" 10) and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  Rep_name ("\<lfloor>_\<rfloor>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  Abs_name ("\<lceil>_\<rceil>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  Rep_var ("\<lfloor>_\<rfloor>") and
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  Abs_var ("\<lceil>_\<rceil>") and
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    30
  sort_of_ty ("sort'_ty _") 
1785
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
(* 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
    33
syntax (latex output)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  "_Collect" :: "pttrn => bool => 'a set" ("(1{_ . _})")
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
(* 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
    38
hide_const sort
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
abbreviation
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  "sort \<equiv> sort_of"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    43
lemma infinite_collect:
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    44
  assumes "\<forall>x \<in> S. P x" "infinite S"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    45
  shows "infinite {x \<in> S. P x}"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    46
using assms
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    47
apply(subgoal_tac "infinite {x. x \<in> S}")
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    48
apply(simp only: Inf_many_def[symmetric])
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    49
apply(erule INFM_mono)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    50
apply(auto)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    51
done
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    52
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
(*>*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
section {* Introduction *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
text {*
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    59
  Nominal Isabelle provides a proving infratructure for convenient reasoning
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    60
  about syntax involving binders, such as lambda terms or type schemes:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2382
diff changeset
    61
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    62
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    63
  @{text "\<lambda>x. t       \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. \<tau>"} 
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    64
  \end{isabelle}
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    65
  
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
    66
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    67
  At its core Nominal Isabelle is based on the nominal logic work by
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    68
  Pitts at al \cite{GabbayPitts02,Pitts03}, whose most basic notion is
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    69
  a sort-respecting permutation operation defined over a countably
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
    70
  infinite collection of sorted atoms. 
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
    71
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
    72
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
    73
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
    74
  The aim of this paper is to
2755
Christian Urban <urbanc@in.tum.de>
parents: 2754
diff changeset
    75
  describe how we adapted this work so that it can be implemented in a
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    76
  theorem prover based on Higher-Order Logic (HOL). For this we
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    77
  present the definition we made in the implementation and also review
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    78
  many proofs. There are a two main design choices to be made. One is
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    79
  how to represent sorted atoms. We opt here for a single unified atom
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    80
  type to represent atoms of different sorts. The other is how to
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    81
  present sort-respecting permutations. For them we use the standard
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    82
  technique of HOL-formalisations of introducing an appropriate
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
    83
  substype of functions from atoms to atoms.
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    84
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    85
  The nominal logic work has been the starting point for a number of proving
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    86
  infrastructures, most notable by Norrish \cite{norrish04} in HOL4, by
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    87
  Aydemir et al \cite{AydemirBohannonWeirich07} in Coq and the work by Urban
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    88
  and Berghofer in Isabelle/HOL \cite{Urban08}. Its key attraction is a very
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    89
  general notion, called \emph{support}, for the `set of free variables, or
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    90
  atoms, of an object' that applies not just to lambda terms and type schemes,
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    91
  but also to sets, products, lists, booleans and even functions. The notion of support
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    92
  is derived from the permutation operation defined over the 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    93
  hierarchy of types. This
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    94
  permutation operation, written @{text "_ \<bullet> _"}, has proved to be much more
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    95
  convenient for reasoning about syntax, in comparison to, say, arbitrary
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    96
  renaming substitutions of atoms. One reason is that permutations are
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    97
  bijective renamings of atoms and thus they can be easily `undone'---namely
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
    98
  by applying the inverse permutation. A corresponding inverse substitution 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
    99
  might not always exist, since renaming substitutions are in general only injective.  
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   100
  Another reason is that permutations preserve many constructions when reasoning about syntax. 
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   101
  For example, suppose a typing context @{text "\<Gamma>"} of the form
2521
e7cc033f72c7 tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   102
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   103
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   104
  @{text "x\<^isub>1:\<tau>\<^isub>1, \<dots>, x\<^isub>n:\<tau>\<^isub>n"}
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   105
  \end{isabelle}
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   106
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   107
  \noindent
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   108
  is said to be \emph{valid} provided none of its variables, or atoms, @{text "x\<^isub>i"}
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   109
  occur twice. Then validity of typing contexts is preserved under
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   110
  permutations in the sense that if @{text \<Gamma>} is valid then so is \mbox{@{text "\<pi> \<bullet> \<Gamma>"}} for
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   111
  all permutations @{text "\<pi>"}. Again, this is \emph{not} the case for arbitrary
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   112
  renaming substitutions, as they might identify some of the @{text "x\<^isub>i"} in @{text \<Gamma>}. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   113
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   114
  Permutations also behave uniformly with respect to HOL's logic connectives. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   115
  Applying a permutation to a formula gives, for example 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
  
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   117
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   118
  \begin{tabular}{@ {}lcl}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   119
  @{term "\<pi> \<bullet> (A \<and> B)"} & if and only if & @{text "(\<pi> \<bullet> A) \<and> (\<pi> \<bullet> B)"}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   120
  @{term "\<pi> \<bullet> (A \<longrightarrow> B)"} & if and only if & @{text "(\<pi> \<bullet> A) \<longrightarrow> (\<pi> \<bullet> B)"}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   121
  \end{tabular}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   122
  \end{isabelle}
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   123
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   124
  \noindent
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   125
  This uniform behaviour can also be extended to quantifiers and functions. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   126
  Because of these good properties of permutations, we are able to automate 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   127
  reasoning to do with \emph{equivariance}. By equivariance we mean the property 
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   128
  that every permutation leaves a function unchanged, that is @{term "\<pi> \<bullet> f = f"}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   129
  for all @{text "\<pi>"}. This will often simplify arguments involving support 
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   130
  of functions, since if they are equivariant then they have empty support---or
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   131
  `no free atoms'.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   132
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   133
  There are a number of subtle differences between the nominal logic work by
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   134
  Pitts and the formalisation we will present in this paper. One difference 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   135
  is that our
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   136
  formalisation is compatible with HOL, in the sense that we only extend
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   137
  HOL by some definitions, withouth the introduction of any new axioms.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   138
  The reason why the original nominal logic work is
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   139
  incompatible with HOL has to do with the way how the finite support property
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   140
  is enforced: FM-set theory is defined in \cite{Pitts01b} so that every set
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   141
  in the FM-set-universe has finite support.  In nominal logic \cite{Pitts03},
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   142
  the axioms (E3) and (E4) imply that every function symbol and proposition
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   143
  has finite support. However, there are notions in HOL that do \emph{not}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   144
  have finite support (we will give some examples).  In our formalisation, we 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   145
  will avoid the incompatibility of the original nominal logic work by not a
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   146
  priory restricting our discourse to only finitely supported entities, rather
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   147
  we will explicitly assume this property whenever it is needed in proofs. One
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   148
  consequence is that we state our basic definitions not in terms of nominal
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   149
  sets (as done for example in \cite{Pitts06}), but in terms of the weaker
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   150
  notion of permutation types---essentially sets equipped with a ``sensible''
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   151
  notion of permutation operation.
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   152
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   153
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   154
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   155
  In the nominal logic woworkrk, the `new quantifier' plays a prominent role.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   156
  $\new$
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   157
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   158
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   159
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   160
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   161
  Two binders
2746
6aa98a113e6c a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2744
diff changeset
   162
6aa98a113e6c a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2744
diff changeset
   163
  A preliminary version 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
*}
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
section {* Sorted Atoms and Sort-Respecting Permutations *}
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
text {*
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   169
  The two most basic notions in the nominal logic work are a countably
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   170
  infinite collection of sorted atoms and sort-respecting permutations
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   171
  of atoms.  The atoms are used for representing variable names that
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   172
  might be bound or free. Multiple sorts are necessary for being able
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   173
  to represent different kinds of variables. For example, in the
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   174
  language Mini-ML there are bound term variables in lambda
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   175
  abstractions and bound type variables in type schemes. In order to
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   176
  be able to separate them, each kind of variables needs to be
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   177
  represented by a different sort of atoms.
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   178
2746
6aa98a113e6c a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2744
diff changeset
   179
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   180
  The existing nominal logic work usually leaves implicit the sorting
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   181
  information for atoms and leaves out a description of how sorts are
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   182
  represented.  In our formalisation, we therefore have to make a
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   183
  design decision about how to implement sorted atoms and
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   184
  sort-respecting permutations. One possibility, which we described in
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   185
  \cite{Urban08}, is to have separate types for different sorts of
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   186
  atoms. However, we found that this does not blend well with
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   187
  type-classes in Isabelle/HOL (see Section~\ref{related} about
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   188
  related work).  Therefore we use here a single unified atom type to
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   189
  represent atoms of different sorts. A basic requirement is that
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   190
  there must be a countably infinite number of atoms of each sort.
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   191
  This can be implemented as the datatype
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
   192
1785
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
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
          datatype atom\<iota> = Atom\<iota> string nat
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
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  \noindent
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   199
  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
   200
  similar design choice was made by Gunter et al \cite{GunterOsbornPopescu09}
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   201
  for their variables.}  The use of type \emph{string} for sorts is merely for
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   202
  convenience; any countably infinite type would work as well. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   203
  The set of all atoms we shall write as @{term "UNIV::atom set"}.
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   204
  We have two auxiliary functions for atoms, namely @{text sort} 
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   205
  and @{const nat_of} which are defined as 
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   206
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   207
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   208
  \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   209
  @{thm (lhs) sort_of.simps[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) sort_of.simps[no_vars]}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   210
  @{thm (lhs) nat_of.simps[no_vars]} & @{text "\<equiv>"}  & @{thm (rhs) nat_of.simps[no_vars]}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   211
  \end{tabular}\hfill\numbered{sortnatof}
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   212
  \end{isabelle}
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   213
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   214
  \noindent
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   215
  We clearly have for every finite set @{text S}
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   216
  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
   217
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   218
  \begin{proposition}\label{choosefresh}\mbox{}\\
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
   219
  @{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
   220
  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
   221
  \end{proposition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
  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
   224
  "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
   225
  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
   226
  each atom to one of the same sort. These properties can be conveniently stated
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   227
  in Isabelle/HOL for a function @{text \<pi>} as follows:
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
  \begin{tabular}{r@ {\hspace{4mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
  i)   & @{term "bij \<pi>"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
  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
   233
  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
   234
  \end{tabular}\hfill\numbered{permtype}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
  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
   239
  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
   240
  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
   241
  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
   242
  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
   243
  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
   244
  @{text "i"}-@{text "iii"}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
  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
   247
  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
   248
  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
   249
  type of swappings must be
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
  @{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
   252
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
  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
   255
  consider what happens if a user states a swapping of atoms with different
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   256
  sorts.  The following definition\footnote{To increase legibility, we omit
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   257
  here and in what follows the @{term Rep_perm} and @{term "Abs_perm"}
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   258
  wrappers that are needed in our implementation in Isabelle/HOL since we defined permutation
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   259
  not to be the full function space, but only those functions of type @{typ
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   260
  perm} satisfying properties @{text i}-@{text "iii"} in \eqref{permtype}.}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   261
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
  @{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
   264
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
  \noindent
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   266
  does not work in general, because @{text a} and @{text b} may have different
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   267
  sorts---in which case the function would violate property @{text iii} in \eqref{permtype}.  We
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   268
  could make the definition of swappings partial by adding the precondition
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   269
  @{term "sort a = sort b"}, which would mean that in case @{text a} and
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   270
  @{text b} have different sorts, the value of @{text "(a b)"} is unspecified.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   271
  However, this looked like a cumbersome solution, since sort-related side
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   272
  conditions would be required everywhere, even to unfold the definition.  It
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   273
  turned out to be more convenient to actually allow the user to state
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   274
  `ill-sorted' swappings but limit their `damage' by defaulting to the
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   275
  identity permutation in the ill-sorted case:
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   276
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
  \begin{tabular}{@ {}rl}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
  @{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
   281
   & \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
   282
   & \hspace{3mm}@{text "else id"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
  \end{tabular}\hfill\numbered{swapdef}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
  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
   288
  @{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
   289
  a function in @{typ perm}. 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   291
  One advantage of using functions as a representation for
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   292
  permutations is that it is unique. For example the swappings
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
  @{thm swap_commute[no_vars]}\hspace{10mm}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
  @{text "(a a) = id"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
  \end{tabular}\hfill\numbered{swapeqs}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
  \noindent
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   302
  are \emph{equal}. Another advantage of the function representation is that
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   303
  they form a (non-com\-mu\-ta\-tive) group provided we define
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   304
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   305
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   306
  \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{10mm}}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   307
  @{thm (lhs) zero_perm_def[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) zero_perm_def[no_vars]} &
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   308
  @{thm (lhs) plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2"]} & @{text "\<equiv>"} & 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   309
     @{thm (rhs) plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2"]}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   310
  @{thm (lhs) uminus_perm_def[where p="\<pi>"]} & @{text "\<equiv>"} & @{thm (rhs) uminus_perm_def[where p="\<pi>"]} &
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   311
  @{thm (lhs) minus_perm_def[where ?p1.0="\<pi>\<^isub>1" and ?p2.0="\<pi>\<^isub>2"]} & @{text "\<equiv>"} &
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   312
     @{thm (rhs) minus_perm_def[where ?p1.0="\<pi>\<^isub>1" and ?p2.0="\<pi>\<^isub>2"]}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   313
  \end{tabular}\hfill\numbered{groupprops}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   314
  \end{isabelle}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   315
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   316
  \noindent
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   317
  and verify the four simple properties
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
  \begin{tabular}{@ {}l}
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   321
  i)~~@{thm add_assoc[where a="\<pi>\<^isub>1" and b="\<pi>\<^isub>2" and c="\<pi>\<^isub>3"]}\\
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   322
  ii)~~@{thm monoid_add_class.add_0_left[where a="\<pi>::perm"]} \hspace{9mm}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   323
  iii)~~@{thm monoid_add_class.add_0_right[where a="\<pi>::perm"]} \hspace{9mm}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   324
  iv)~~@{thm group_add_class.left_minus[where a="\<pi>::perm"]} 
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   325
  \end{tabular}\hfill\numbered{grouplaws}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
  \noindent
2740
a9e63abf3feb more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2736
diff changeset
   329
  The technical importance of this fact is that we can rely on
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   330
  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
   331
  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
   332
  Note that Isabelle/HOL defies standard conventions of mathematical notation
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   333
  by using additive syntax even for non-commutative groups.  Obviously,
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   334
  composition of permutations is not commutative in general; for example
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   335
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   336
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   337
  @{text "(a b) + (b c) \<noteq> (b c) + (a b)"}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   338
  \end{isabelle} 
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   339
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   340
  \noindent
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   341
  But since the point of this paper is to implement the
1790
000e680b6b6e some further changes
Christian Urban <urbanc@in.tum.de>
parents: 1785
diff changeset
   342
  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
   343
  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
   344
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   345
  A \emph{permutation operation}, written infix as @{text "\<pi> \<bullet> x"},
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   346
  applies a permutation @{text "\<pi>"} to an object @{text "x"} of type
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   347
  @{text \<beta>}, say.  This operation has the type
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   348
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   349
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   350
  @{text "_ \<bullet> _ :: perm \<Rightarrow> \<beta> \<Rightarrow> \<beta>"}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   351
  \end{isabelle} 
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   352
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   353
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   354
  and will be defined over the hierarchie of types.
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   355
  Isabelle/HOL allows us to give a definition of this operation for
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   356
  `base' types, such as atoms, permutations, booleans and natural numbers:
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   357
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   358
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   359
  \begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   360
  atoms: & @{thm permute_atom_def[where p="\<pi>",no_vars, THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   361
  permutations: & @{thm permute_perm_def[where p="\<pi>" and q="\<pi>'", THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   362
  booleans: & @{thm permute_bool_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   363
  nats: & @{thm permute_nat_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   364
  \end{tabular}\hfill\numbered{permdefsbase}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   365
  \end{isabelle}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   366
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   367
  \noindent
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   368
  and for type-constructors, such as functions, sets, lists and products:
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   369
  
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   370
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   371
  \begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}}
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   372
  functions: &  @{text "\<pi> \<bullet> f \<equiv> \<lambda>x. \<pi> \<bullet> (f ((-\<pi>) \<bullet> x))"}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   373
  sets: & @{thm permute_set_eq[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   374
  lists: & @{thm permute_list.simps(1)[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   375
         & @{thm permute_list.simps(2)[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   376
  products: & @{thm permute_prod.simps[where p="\<pi>", no_vars, THEN eq_reflection]}\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   377
  \end{tabular}\hfill\numbered{permdefsconstrs}
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   378
  \end{isabelle}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   379
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   380
  In order to reason abstractly about this operation, 
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   381
  we use Isabelle/HOL's type classes~\cite{Wenzel04} and state the following two 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   382
  \emph{permutation properties}: 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
  \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
  i) & @{thm permute_zero[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
  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
   388
  \end{tabular}\hfill\numbered{newpermprops}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   392
  From these properties and law (\ref{grouplaws}.{\it iv}) about groups 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   393
  follows that a permutation and its inverse cancel each other. That is
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   396
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
  @{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
   398
  @{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
   399
  \end{tabular}\hfill\numbered{cancel}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   403
  Consequently, 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
   404
  which in turn implies the property
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   405
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
  @{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
   409
  $\;$if and only if$\;$
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
  @{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
   411
  \end{tabular}\hfill\numbered{permuteequ}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  \end{isabelle} 
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   413
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   414
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   415
  We can also show that the following property holds for the permutation 
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   416
  operation.
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   417
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   418
  \begin{lemma}\label{permutecompose} 
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   419
  @{text "\<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x) = (\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}.
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   420
  \end{lemma}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   421
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   422
  \begin{proof} The proof is as follows:
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   423
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   424
  \begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   425
  & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> x"}\\
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   426
  @{text "="} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> (-\<pi>\<^isub>1) \<bullet> \<pi>\<^isub>1 \<bullet> x"} & by \eqref{cancel}\\
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   427
  @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2 - \<pi>\<^isub>1) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}  & by {\rm(\ref{newpermprops}.@{text "ii"})}\\
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   428
  @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}\\
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   429
  \end{tabular}\hfill\qed
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   430
  \end{isabelle}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   431
  \end{proof}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   432
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   433
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   434
  Note that the permutation operation for functions is defined so that
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   435
  we have for applications the property
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   437
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   438
  @{text "\<pi> \<bullet> (f x) ="}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   439
  @{thm (rhs) permute_fun_app_eq[where p="\<pi>", no_vars]}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   440
  \hfill\numbered{permutefunapp}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   441
  \end{isabelle}
1785
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
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   444
  whenever the permutation properties hold for @{text x}. This property can
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   445
  be easily shown by unfolding the permutation operation for functions on
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   446
  the right-hand side, simplifying the beta-redex and eliminating the permutations
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   447
  in front of @{text x} using \eqref{cancel}.
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   448
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   449
  The use of type classes allows us to delegate much of the routine
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   450
  resoning involved in determining whether the permutation properties
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   451
  are satisfied to Isabelle/HOL's type system: we only have to
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   452
  establish that base types satisfy them and that type-constructors
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   453
  preserve them. Isabelle/HOL will use this information and determine
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   454
  whether an object @{text x} with a compound type satisfies the
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   455
  permutation properties.  For this we define the notion of a
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   456
  \emph{permutation type}:
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   457
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   458
  \begin{definition}[Permutation type]
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   459
  A type @{text "\<beta>"} is a \emph{permutation type} if the permutation
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   460
  properties in \eqref{newpermprops} are satisfied for every @{text
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   461
  "x"} of type @{text "\<beta>"}.
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   462
  \end{definition}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   463
 
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   464
  \noindent
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   465
  and establish:
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   467
  \begin{theorem}
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   468
  The types @{type atom}, @{type perm}, @{type bool} and @{type nat}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   469
  are permutation types, and if @{text \<beta>}, @{text "\<beta>\<^isub>1"} and @{text
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   470
  "\<beta>\<^isub>2"} are permutation types, then so are \mbox{@{text "\<beta>\<^isub>1 \<Rightarrow> \<beta>\<^isub>2"}},
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   471
  @{text "\<beta> set"}, @{text "\<beta> list"} and @{text "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"}.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
  \end{theorem}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
  \begin{proof}
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   475
  All statements are by unfolding the definitions of the permutation
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   476
  operations and simple calculations involving addition and
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   477
  minus. In case of permutations for example we have
1785
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
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
  \begin{tabular}[b]{@ {}rcl}
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   481
  @{text "0 \<bullet> \<pi>'"} & @{text "\<equiv>"} & @{text "0 + \<pi>' - 0 = \<pi>'"}\smallskip\\
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
  @{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
   483
  & @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) + \<pi>' - \<pi>\<^isub>2 - \<pi>\<^isub>1"}\\
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   484
  & @{text "="} & @{text "\<pi>\<^isub>1 + (\<pi>\<^isub>2 + \<pi>' - \<pi>\<^isub>2) - \<pi>\<^isub>1"}\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   485
  & @{text "\<equiv>"} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> \<pi>'"} 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
  \end{tabular}\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   488
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
section {* Equivariance *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
text {*
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   494
  An important notion in the nominal logic work is
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   495
  \emph{equivariance}.  It will enable us to characterise how
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   496
  permutations act upon compound statements in HOL by analysing how
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   497
  these statements are constructed.  To do so, let us first define
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   498
  \emph{HOL-terms}. They are given by the grammar
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   499
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   500
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   501
  @{text "t ::= c | x | t\<^isub>1 t\<^isub>2 | \<lambda>x. t"}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   502
  \hfill\numbered{holterms}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   503
  \end{isabelle} 
1809
08e4d3cbcf8c folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents: 1790
diff changeset
   504
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   505
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   506
  whereby @{text c} stands for constants and @{text x} for
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   507
  variables. We assume HOL-terms are fully typed, but for the sake of
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   508
  greater legibility we leave the typing information implicit.  We
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   509
  also assume the usual notions for free and bound variables of a
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   510
  HOL-term.  Furthermore, it is custom in HOL to regard terms as equal
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   511
  modulo alpha-, beta- and eta-equivalence.
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   512
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   513
  An \emph{equivariant} HOL-term is one that is invariant under the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   514
  permutation operation. This can be defined in Isabelle/HOL 
2756
a6b4d9629b1c tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 2754
diff changeset
   515
  as follows:
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   517
  \begin{definition}[Equivariance]\label{equivariance}
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   518
  A  HOL-term @{text t} is \emph{equivariant} provided 
2756
a6b4d9629b1c tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 2754
diff changeset
   519
  @{term "\<pi> \<bullet> t = t"} holds for all permutations @{text "\<pi>"}.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   520
  \end{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   521
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   523
  We will primarily be interested in the cases where @{text t} is a constant, but
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   524
  of course there is no way to restrict this definition in Isabelle/HOL so that it
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   525
  applies to just constants.  
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   526
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   527
  There are a number of equivalent formulations for the equivariance
2756
a6b4d9629b1c tuned paper
Christian Urban <urbanc@in.tum.de>
parents: 2754
diff changeset
   528
  property.  For example, assuming @{text t} is of permutation type @{text "\<alpha> \<Rightarrow>
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   529
  \<beta>"}, then equivariance can also be stated as
1785
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
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
  \begin{tabular}{@ {}l}
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   533
  @{text "\<forall>\<pi> x.  \<pi> \<bullet> (t x) = t (\<pi> \<bullet> x)"}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
  \end{tabular}\hfill\numbered{altequivariance}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   537
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   538
  We will call this formulation of equivariance in \emph{fully applied form}.
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   539
  To see that this formulation implies the definition, we just unfold
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   540
  the definition of the permutation operation for functions and
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   541
  simplify with the equation and the cancellation property shown in
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   542
  \eqref{cancel}. To see the other direction, we use
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   543
  \eqref{permutefunapp}. Similarly for HOL-terms that take more than
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   544
  one argument. The point to note is that equivariance and equivariance in fully
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   545
  applied form are always interderivable.
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   547
  Both formulations of equivariance have their advantages and
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   548
  disadvantages: \eqref{altequivariance} is usually more convenient to
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   549
  establish, since statements in Isabelle/HOL are commonly given in a
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   550
  form where functions are fully applied. For example we can easily
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   551
  show that equality is equivariant
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   553
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   554
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   555
  @{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
   556
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   560
  using the permutation operation on booleans and property
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   561
  \eqref{permuteequ}.  Lemma~\ref{permutecompose} establishes that the
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   562
  permutation operation is equivariant. The permutation operation for
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   563
  lists and products, shown in \eqref{permdefsconstrs}, state that the
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   564
  constructors for products, @{text "Nil"} and @{text Cons} are
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   565
  equivariant. Furthermore a simple calculation will show that our
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   566
  swapping functions are equivariant, that is
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   567
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
  @{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
   571
  \end{tabular}\hfill\numbered{swapeqvt}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
  \noindent
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   575
  for all @{text a}, @{text b} and @{text \<pi>}. Also the booleans
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   576
  @{const True} and @{const False} are equivariant by the definition
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   577
  of the permutation operation for booleans. It is easy to see
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   578
  that the boolean operators, like @{text "\<and>"}, @{text "\<or>"}, @{text
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   579
  "\<not>"} and @{text "\<longrightarrow>"}, are all equivariant too. (see ??? intro)
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   580
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   581
  In contrast, the advantage of Definition \ref{equivariance} is that
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   582
  it leads to a relatively simple rewrite system that allows us to `push' a permutation,
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   583
  say @{text \<pi>}, towards the leaves of a HOL-term (i.e.~constants and
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   584
  variables).  Then the permutation disappears in cases where the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   585
  constants are equivariant, since by Definition \ref{equivariance} we
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   586
  have @{term "\<pi> \<bullet> c = c"}. What we will show next is that for a HOL-term
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   587
  @{term t} containing only equivariant constants, a permutation can be pushed
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   588
  inside this term and the only instances remaining are in front of
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   589
  the free variables of @{text t}. We can only show this by a meta-argument, 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   590
  that means one we cannot formalise inside Isabelle/HOL. But we can invoke
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   591
  it in form of a tactic programmed on the ML-level of Isabelle/HOL.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   592
  This tactic is a rewrite systems consisting of `oriented' equations. 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   593
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   594
  A permutation @{text \<pi>} can be 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   595
  pushed into applications and abstractions as follows
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   596
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   597
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   598
  \begin{tabular}{@ {}lrcl}
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   599
  i) & @{text "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2)"} & $\stackrel{\rightharpoonup}{=}$ 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   600
        & @{term "(\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   601
  ii) & @{text "\<pi> \<bullet> (\<lambda>x. t)"} & $\stackrel{\rightharpoonup}{=}$ & @{text "\<lambda>x. \<pi> \<bullet> (t[x :=  (-\<pi>) \<bullet> x])"}\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   602
  \end{tabular}\hfill\numbered{rewriteapplam}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   603
  \end{isabelle}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   604
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   605
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   606
  The first rule we established in \eqref{permutefunapp};
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   607
  the second follows from the definition of permutations acting on functions
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   608
  and the fact that HOL-terms are equal modulo beta-equivalence.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   609
  Once the permutations are pushed towards the leaves we need the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   610
  following two rules
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   611
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   612
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   613
  \begin{tabular}{@ {}lrcl}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   614
  iii) & @{term "\<pi> \<bullet> (- \<pi>) \<bullet> x"} & $\stackrel{\rightharpoonup}{=}$ & @{term "x"}\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   615
  iv) &  @{term "\<pi> \<bullet> c"} & $\stackrel{\rightharpoonup}{=}$ & 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   616
            @{term "c"}\hspace{6mm}provided @{text c} is equivariant\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   617
  \end{tabular}\hfill\numbered{rewriteother}
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   618
  \end{isabelle}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   619
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   620
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   621
  in order to remove permuations in front of bound variables and equivariant constants.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   622
  
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   623
  In order to obtain a terminating rewrite system, we have to be
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   624
  careful with rule ({\it i}). It can lead to a loop whenever
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   625
  \mbox{@{text "t\<^isub>1 t\<^isub>2"}} is of the form @{text "\<pi>' \<bullet> t'"}. Consider
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   626
  for example the infinite reduction sequence
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   627
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   628
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   629
  \begin{tabular}{@ {}l}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   630
  @{text "\<pi> \<bullet> (\<pi>' \<bullet> t)"}~~$\stackrel{\rightharpoonup}{=}\ldots\stackrel{\rightharpoonup}{=}$\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   631
  @{text "(\<pi> \<bullet> \<pi>') \<bullet> (\<pi> \<bullet> t)"}~~$\stackrel{\rightharpoonup}{=}\ldots\stackrel{\rightharpoonup}{=}$\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   632
  @{text "((\<pi> \<bullet> \<pi>') \<bullet> \<pi>) \<bullet> ((\<pi> \<bullet> \<pi>') \<bullet> t)"}~~$\stackrel{\rightharpoonup}{=}\ldots$\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   633
  \end{tabular}
2754
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   634
  \end{isabelle}
2a3a37f29f4f more on paper
Christian Urban <urbanc@in.tum.de>
parents: 2747
diff changeset
   635
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   636
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   637
  where the last step is again an instance of the first term, but it is
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   638
  bigger (note that for the permutation operation we have that @{text
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   639
  "\<pi> \<bullet> (op \<bullet>) = (op \<bullet>)"} since as shown in Lemma \ref{permutecompose}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   640
  \mbox{@{text "(op \<bullet>)"}} is equivariant). In order to avoid this loop
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   641
  we need to apply these rules using an `outside to inside' strategy.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   642
  This strategy is sufficient since we are only interested of rewriting
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   643
  terms of the form @{term "\<pi> \<bullet> t"}.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   644
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   645
  Another problem we have to avoid is that the rules ({\it i}) and
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   646
  ({\it iii}) can `overlap'. For this note that
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   647
  the term @{term "\<pi> \<bullet>(\<lambda>x. x)"} reduces to @{term "\<lambda>x. \<pi> \<bullet> (- \<pi>) \<bullet>
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   648
  x"}, to which we can apply rule ({\it iii}) in order to obtain
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   649
  @{term "\<lambda>x. x"}, as is desired.  However, the subterm term @{text
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   650
  "(- \<pi>) \<bullet> x"} is also an application. Consequently, the term 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   651
  @{term "\<lambda>x. \<pi> \<bullet> (- \<pi>) \<bullet>x"} can reduce to @{text "\<lambda>x. (- (\<pi> \<bullet> \<pi>)) \<bullet> (\<pi> \<bullet> x)"} using
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   652
  ({\it i}).  Now we cannot apply rule ({\it iii}) anymore and even
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   653
  worse the measure we will introduce shortly increases. On the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   654
  other hand, if we started with the term @{text "\<pi> \<bullet> ((- \<pi>) \<bullet> x)"}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   655
  where @{text \<pi>} and @{text x} are free variables, then we do
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   656
  want to apply rule  ({\it i}), rather than rule ({\it iii}) which
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   657
  would eliminate @{text \<pi>} completely. This is a problem because we 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   658
  want to keep the shape of the HOL-term intact during rewriting.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   659
  As a remedy we use a standard trick in HOL: we introduce 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   660
  a separate definition for terms of the form @{text "(- \<pi>) \<bullet> x"}, 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   661
  namely as
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   662
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   663
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   664
  @{term "unpermute \<pi> x \<equiv> (- \<pi>) \<bullet> x"}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   665
  \end{isabelle}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   666
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   667
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   668
  The point is that we will always start with a term that does not
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   669
  contain any @{text unpermutes}.  With this trick we can reformulate
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   670
  our rewrite rules as follows
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   671
  
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   672
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   673
  \begin{tabular}{@ {}lrcl}
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   674
  i') & @{text "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2)"} & $\stackrel{\rightharpoonup}{=}$ & 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   675
    @{term "(\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}\hspace{45mm}\mbox{}\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   676
  \multicolumn{4}{r}{provided @{text "t\<^isub>1 t\<^isub>2"} is not of the form @{text "unpermute \<pi> x"}}\smallskip\\
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   677
  ii') & @{text "\<pi> \<bullet> (\<lambda>x. t)"} & $\stackrel{\rightharpoonup}{=}$ & @{text "\<lambda>x. \<pi> \<bullet> (t[x := unpermute \<pi> x])"}\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   678
  iii') & @{text "\<pi> \<bullet> (unpermute \<pi> x)"} & $\stackrel{\rightharpoonup}{=}$ & @{term x}\\
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   679
  iv') &  @{term "\<pi> \<bullet> c"} & $\stackrel{\rightharpoonup}{=}$ & @{term "c"}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   680
    \hspace{6mm}provided @{text c} is equivariant\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   681
  \end{tabular}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   682
  \end{isabelle}
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   683
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   684
  \noindent
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   685
  None of these rules overlap. To see that the permutation on the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   686
  right-hand side is applied to a smaller term, we take the measure
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   687
  consisting of lexicographically ordered pairs whose first component
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   688
  is the size of a term (without counting @{text unpermutes}) and the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   689
  second is the number of occurences of @{text "unpermute \<pi> x"} and
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   690
  @{text "\<pi> \<bullet> c"}. This means the process of applying these rules 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   691
  with our `outside-to-inside' strategy must terminate.
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   692
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   693
  With the rewriting system in plcae, we are able to establish the
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   694
  fact that for a HOL-term @{text t} whose constants are all equivariant,
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   695
  the HOL-term @{text "\<pi> \<bullet> t"} is equal to @{text "t'"} wherby
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   696
  @{text "t'"} is equal to @{text t} except that every free variable
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   697
  @{text x} of @{text t} is replaced by @{text "\<pi> \<bullet> x"}.  Pitts calls
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   698
  this fact \emph{equivariance principle}. In our setting the precise
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   699
  statement of this fact is a bit more involved because of the fact
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   700
  that @{text unpermute} needs to be treated specially.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   701
  
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   702
  \begin{theorem}[Equivariance Principle]
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   703
  Suppose a HOL-term @{text t} does not contain any @{text unpermutes} and all
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   704
  its constants are equivariant. For any permutation @{text \<pi>}, let @{text t'} 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   705
  be the HOL-term @{text t} except every free variable @{text x} in @{term t} is 
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   706
  replaced by @{text "\<pi> \<bullet> x"}, then @{text "\<pi> \<bullet> t = t'"}.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   707
  \end{theorem}
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   708
  
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   709
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   710
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   711
  With these definitions in place we can define the notion of an \emph{equivariant}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   712
  HOL-term
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   713
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   714
  \begin{definition}[Equivariant HOL-term]
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   715
  A HOL-term is \emph{equivariant}, provided it is closed and composed of applications, 
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   716
  abstractions and equivariant constants only.
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   717
  \end{definition}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   718
  
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   719
  \noindent
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   720
  For equivariant terms we have
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   721
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   722
  \begin{lemma}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   723
  For an equivariant HOL-term @{text "t"},  @{term "\<pi> \<bullet> t = t"} for all permutations @{term "\<pi>"}.
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   724
  \end{lemma}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   725
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   726
  \begin{proof}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   727
  By induction on the grammar of HOL-terms. The case for variables cannot arise since
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   728
  equivariant HOL-terms are closed. The case for constants is clear by Definition 
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   729
  \ref{equivariance}. The case for applications is also straightforward since by
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   730
  \eqref{permutefunapp} we have @{term "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2) = (\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}.
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   731
  For the case of abstractions we can reason as follows
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   732
  
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   733
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   734
  \begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   735
  & @{text "\<pi> \<bullet> (\<lambda>x. t)"}\\
2758
6ba52f3a1542 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2757
diff changeset
   736
  @{text "\<equiv>"} & @{text "\<lambda>y. \<pi> \<bullet> ((\<lambda>x. t) ((-\<pi>) \<bullet> y))"} & by \eqref{permdefsconstrs}\\
2744
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   737
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   738
  \end{tabular}\hfill\qed
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   739
  \end{isabelle}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   740
  \end{proof}
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   741
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   742
  database of equivariant functions
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   743
56b8d977d1c0 more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   744
  Such a rewrite system is often very helpful
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   745
  in determining whether @{text "\<pi> \<bullet> t = t"} holds for a compound term @{text t}. ???
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   746
 
2761
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   747
  For this we have implemented in Isabelle/HOL a
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   748
  database of equivariant constants that can be used to rewrite
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   749
  HOL-terms.
64a03564bc24 more paper
Christian Urban <urbanc@in.tum.de>
parents: 2759
diff changeset
   750
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   751
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   752
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   753
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   754
section {* Support and Freshness *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   755
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   756
text {*
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   757
  The most original aspect of the nominal logic work of Pitts is a general
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   758
  definition for `the set of free variables, or free atoms, of an object @{text "x"}'.  This
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   759
  definition is general in the sense that it applies not only to lambda terms,
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   760
  but to any type for which a permutation operation is defined 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   761
  (like lists, sets, functions and so on). 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   762
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   763
  \begin{definition}[Support] Given @{text x} is of permutation type, then 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   764
  
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   765
  @{thm [display,indent=10] supp_def[no_vars, THEN eq_reflection]}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   766
  \end{definition}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   767
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   768
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   769
  (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
   770
  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
   771
  There is also the derived notion for when an atom @{text a} is \emph{fresh}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   772
  for an @{text x} of permutation type, defined as
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   773
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   774
  @{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
   775
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   776
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   777
  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
   778
  defined as follows
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   779
  
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   780
  @{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
   781
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   782
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   783
  \noindent
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   784
  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
   785
  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
   786
  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
   787
  @{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
   788
  about swappings applied to an @{text x}:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   789
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   790
  \begin{lemma}\label{swaptriple}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   791
  Assuming @{text x} is of permutation type, and @{text a}, @{text b} and @{text c} 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   792
  have the same sort, then \mbox{@{thm (prem 3) swap_rel_trans[no_vars]}} and 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   793
  @{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
   794
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   795
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   796
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   797
  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
   798
  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
   799
  that the permutations
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   800
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   801
  @{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
   802
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   803
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   804
  are equal. The lemma is then by application of the second permutation 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   805
  property shown in~\eqref{newpermprops}.\hfill\qed
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   806
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   807
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   808
  \begin{theorem}\label{swapfreshfresh}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   809
  Let @{text x} be of permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   810
  @{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
   811
  \end{theorem}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   812
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   813
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   814
  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
   815
  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
   816
  @{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
   817
  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
   818
  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
   819
  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
   820
  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
   821
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   822
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   823
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   824
  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
   825
  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
   826
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   827
  \begin{lemma}\label{half}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   828
  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
   829
  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
   830
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   831
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   832
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   833
  \begin{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   834
  \begin{tabular}[t]{c@ {\hspace{2mm}}l@ {\hspace{5mm}}l}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   835
  & @{thm (lhs) fresh_permute_iff[where p="\<pi>",no_vars]}\\ 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   836
  @{text "\<equiv>"} & 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   837
    @{term "finite {b. (\<pi> \<bullet> a \<rightleftharpoons> b) \<bullet> \<pi> \<bullet> x \<noteq> \<pi> \<bullet> x}"}\\
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   838
  @{text "\<Leftrightarrow>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   839
  & @{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
   840
  & since @{text "\<pi> \<bullet> _"} is bijective\\ 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   841
  @{text "\<Leftrightarrow>"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   842
  & @{term "finite {b. \<pi> \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> \<pi> \<bullet> x}"}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   843
  & by Lemma~\ref{permutecompose} and \eqref{swapeqvt}\\
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   844
  @{text "\<Leftrightarrow>"}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   845
  & @{term "finite {b. (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
   846
  & by \eqref{permuteequ}\\
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   847
   @{text "\<equiv>"}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   848
  & @{thm (rhs) fresh_permute_iff[where p="\<pi>",no_vars]}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   849
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   850
  \end{isabelle}\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   851
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   852
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   853
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   854
  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
   855
  we can immediately infer equivariance of freshness: 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   856
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   857
  @{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
   858
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   859
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   860
  Now equivariance of @{text "supp"}, namely
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   861
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   862
  @{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
   863
  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   864
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   865
  is by noting that @{thm supp_conv_fresh[no_vars]} and that freshness and 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   866
  the logical connectives are equivariant. ??? Equivariance
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   867
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   868
  A simple consequence of the definition of support and equivariance is that 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   869
  if a function @{text f} is equivariant then we have 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   870
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   871
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   872
  \begin{tabular}{@ {}l}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   873
  @{thm  (concl) supp_fun_eqvt[no_vars]}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   874
  \end{tabular}\hfill\numbered{suppeqvtfun}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   875
  \end{isabelle} 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   876
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   877
  \noindent 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   878
  For function applications we can establish the two following properties.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   879
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   880
  \begin{lemma} Let @{text f} and @{text x} be of permutation type, then
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   881
  \begin{isabelle}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   882
  \begin{tabular}{r@ {\hspace{4mm}}p{10cm}}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   883
  @{text "i)"} & @{thm[mode=IfThen] fresh_fun_app[no_vars]}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   884
  @{text "ii)"} & @{thm supp_fun_app[no_vars]}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   885
  \end{tabular}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   886
  \end{isabelle}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   887
  \end{lemma}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   888
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   889
  \begin{proof}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   890
  ???
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   891
  \end{proof}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   892
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   893
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   894
  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
   895
  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
   896
  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
   897
  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
   898
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   899
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   900
  \begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   901
  @{text "booleans"}: & @{term "supp b = {}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   902
  @{text "nats"}:     & @{term "supp n = {}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   903
  @{text "products"}: & @{thm supp_Pair[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   904
  @{text "lists:"} & @{thm supp_Nil[no_vars]}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   905
                   & @{thm supp_Cons[no_vars]}\\
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   906
  \end{tabular}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   907
  \end{isabelle}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   908
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   909
  \noindent
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
   910
  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
   911
  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
   912
  
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   913
  \begin{definition}[Supporting Set]
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   914
  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
   915
  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
   916
  \end{definition}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   917
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   918
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   919
  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
   920
  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
   921
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   922
  \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
   923
  \begin{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   924
  \begin{tabular}{r@ {\hspace{4mm}}p{10cm}}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   925
  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
   926
  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
   927
  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
   928
         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
   929
         @{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
   930
         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
   931
         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
   932
         @{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
   933
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   934
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   935
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   936
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   937
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   938
  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
   939
  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
   940
  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
   941
  @{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
   942
  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
   943
  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
   944
  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
   945
  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
   946
  @{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
   947
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   948
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   949
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   950
  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
   951
  nominal logic work. However for establishing the support of atoms and 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
   952
  permutations we found  the following `optimised' variant of @{text "iii)"} 
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   953
  more useful:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   954
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   955
  \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
   956
  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
   957
  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
   958
  @{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
   959
  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
   960
  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
   961
  \end{lemma}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   962
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   963
  \begin{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   964
  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
   965
  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
   966
  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
   967
  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
   968
  @{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
   969
  @{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
   970
  @{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
   971
  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
   972
  = 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
   973
  @{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
   974
  contradiction.\hfill\qed
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   975
  \end{proof}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   976
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   977
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   978
  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
   979
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   980
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   981
  \begin{tabular}{@ {}r@ {\hspace{4mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   982
  i)   & @{term "{c} supports c"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   983
  ii)  & @{term "finite {c}"}\\
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   984
  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
   985
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   986
  \end{isabelle} 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   987
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   988
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   989
  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
   990
  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
   991
  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
   992
  permutations, which is
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   993
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   994
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   995
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   996
  @{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
   997
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   998
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   999
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1000
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1001
  The only proof-obligation that is 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1002
  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
  1003
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1004
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1005
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1006
  @{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
  1007
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1008
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1009
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1010
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1011
  For this we observe that 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1012
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1013
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1014
  \begin{tabular}{@ {}rcl}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1015
  @{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
  1016
  if and only if &
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1017
  @{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
  1018
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1019
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1020
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1021
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1022
  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
  1023
  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
  1024
  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
  1025
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1026
  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
  1027
  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
  1028
  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
  1029
  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
  1030
  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
  1031
  @{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
  1032
  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
  1033
  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
  1034
  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
  1035
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1036
  Unfortunately, this does not work for sets or Isabelle/HOL's function
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1037
  type. There are functions and sets definable in Isabelle/HOL for which the
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1038
  finite support property does not hold.  A simple example of a function with
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1039
  infinite support is @{const nat_of} shown in \eqref{sortnatof}.  This
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1040
  function's support is the set of \emph{all} atoms @{term "UNIV::atom set"}. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1041
  To establish this we show
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1042
  @{term "\<not> a \<sharp> nat_of"}. This is equivalent to assuming the set @{term
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1043
  "{b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"} is finite and deriving a
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1044
  contradiction. From the assumption we also know that @{term "{a} \<union> {b. (a \<rightleftharpoons>
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1045
  b) \<bullet> nat_of \<noteq> nat_of}"} is finite. Then we can use
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1046
  Proposition~\ref{choosefresh} to choose an atom @{text c} such that @{term
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1047
  "c \<noteq> a"}, @{term "sort_of c = sort_of a"} and @{term "(a \<rightleftharpoons> c) \<bullet> nat_of =
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1048
  nat_of"}.  Now we can reason as follows:
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1049
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1050
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1051
  \begin{tabular}[b]{@ {}rcl@ {\hspace{5mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1052
  @{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
  1053
  & @{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
  1054
  & @{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
  1055
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1056
  \end{isabelle}
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
  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
  1060
  This implies that atoms @{term a} and @{term c} must be equal, which clashes with our
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1061
  assumption @{term "c \<noteq> a"} about how we chose @{text c}.\footnote{Cheney \cite{Cheney06} 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1062
  gives similar examples for constructions that have infinite support.}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1063
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1064
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1065
section {* Support of Finite Sets *}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1066
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1067
text {*
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1068
  Also the set type is one instance whose elements are not generally finitely 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1069
  supported (we will give an example in Section~\ref{concrete}). 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1070
  However, we can easily show that finite sets and co-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
  1071
  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
  1072
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1073
  \begin{lemma}\label{finatomsets}\mbox{}\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1074
  @{text "i)"} If @{text S} is a finite set of atoms, then @{thm (concl) supp_finite_atom_set[no_vars]}.\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1075
  @{text "ii)"} If @{term "UNIV - (S::atom set)"} is a finite set of atoms, then 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1076
  @{thm (concl) supp_cofinite_atom_set[no_vars]}.
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1077
  \end{lemma}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1078
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1079
  \begin{proof}
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1080
  Both parts can be easily shown by Lemma~\ref{optimised}.  We only have to observe
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1081
  that a swapping @{text "(a b)"} leaves a set @{text S} unchanged provided both
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1082
  @{text a} and @{text b} are elements in @{text S} or both are not in @{text S}.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1083
  However if the sorts of a @{text a} and @{text b} agree, then the swapping will
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1084
  change @{text S} if either of them is an element in @{text S} and the other is 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1085
  not.\hfill\qed
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1086
  \end{proof}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1087
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1088
  \noindent
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1089
  Note that a consequence of the second part of this lemma is that 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1090
  @{term "supp (UNIV::atom set) = {}"}.
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1091
  More difficult, however, is it to establish that finite sets of finitely 
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1092
  supported objects are finitely supported. For this we first show that
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1093
  the union of the suports of finitely many and finitely supported  objects 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1094
  is finite, namely
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1095
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1096
  \begin{lemma}\label{unionsupp}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1097
  If @{text S} is a finite set whose elements are all finitely supported, then\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1098
  @{text "i)"} @{thm (concl) Union_of_finite_supp_sets[no_vars]} and\\
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1099
  @{text "ii)"} @{thm (concl) Union_included_in_supp[no_vars]}.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1100
  \end{lemma}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1101
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1102
  \begin{proof}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1103
  The first part is by a straightforward induction on the finiteness of @{text S}. 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1104
  For the second part, we know that @{term "\<Union>x\<in>S. supp x"} is a set of atoms, which
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1105
  by the first part is finite. Therefore we know by Lemma~\ref{finatomsets}.@{text "i)"}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1106
  that @{term "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"}. Taking @{text "f"} to be
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1107
  \mbox{@{text "\<lambda>S. \<Union> (supp ` S)"}}, we can write the right hand side as @{text "supp (f S)"}.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1108
  Since @{text "f"} is an equivariant function, we have that 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1109
  @{text "supp (f S) \<subseteq> supp S"} by ??? This completes the second part.\hfill\qed
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1110
  \end{proof}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1111
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1112
  \noindent
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1113
  With this lemma in place we can establish that
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1114
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1115
  \begin{lemma}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1116
  @{thm[mode=IfThen] supp_of_finite_sets[no_vars]}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1117
  \end{lemma}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1118
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1119
  \begin{proof}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1120
  The right-to-left inclusion is proved in Lemma~\ref{unionsupp}.@{text "ii)"}. To show the inclusion 
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1121
  in the other direction we have to show Lemma~\ref{supports}.@{text "i)"}
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1122
  \end{proof}
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1123
*}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1124
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1125
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1126
section {* Induction Principles *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1127
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1128
text {*
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1129
  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
  1130
  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
  1131
  @{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
  1132
  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
  1133
  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
  1134
  
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1135
  @{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
  1136
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1137
  \noindent
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1138
  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
  1139
  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
  1140
*}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1141
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1142
2522
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1143
section {* An Abstraction Type *}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1144
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1145
text {*
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1146
  To that end, we will consider
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1147
  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
  1148
  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
  1149
  "as"} in the body @{text "x"}.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1150
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1151
  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
  1152
  @{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
  1153
  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
  1154
  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
  1155
  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
  1156
  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
  1157
  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
  1158
  (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
  1159
  {\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
  1160
  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
  1161
  @{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
  1162
  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
  1163
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1164
  \begin{equation}\label{alphaset}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1165
  \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
  1166
  \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
  1167
              & @{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
  1168
  @{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
  1169
  @{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
  1170
  @{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
  1171
  \end{array}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1172
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1173
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1174
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1175
  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
  1176
  "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
  1177
  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
  1178
  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
  1179
  "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
  1180
  $\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
  1181
  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
  1182
  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
  1183
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1184
  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
  1185
  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
  1186
  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
  1187
  @{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
  1188
  define
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1189
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1190
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1191
  @{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
  1192
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1193
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1194
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1195
  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
  1196
  \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
  1197
  @{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
  1198
  $\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
  1199
  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
  1200
  "([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
  1201
  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
  1202
  @{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
  1203
  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
  1204
  @{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
  1205
  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
  1206
  $\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
  1207
  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
  1208
  (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
  1209
  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
  1210
  abstract a single atom.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1211
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1212
  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
  1213
  types. For this we define 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1214
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1215
  \begin{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1216
  @{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
  1217
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1218
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1219
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1220
  (similarly for $\approx_{\,\textit{abs\_res}}$ 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1221
  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
  1222
  relations and equivariant.
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1223
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1224
  \begin{lemma}\label{alphaeq} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1225
  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
  1226
  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
  1227
  "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
  1228
  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
  1229
  \end{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1230
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1231
  \begin{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1232
  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
  1233
  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
  1234
  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
  1235
  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
  1236
  calculations. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1237
  \end{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1238
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1239
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1240
  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
  1241
  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
  1242
  representing $\alpha$-equivalence classes of pairs of type 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1243
  @{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
  1244
  (in the third case). 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1245
  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
  1246
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1247
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1248
  @{term "Abs_set as x"} \hspace{5mm} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1249
  @{term "Abs_res as x"} \hspace{5mm}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1250
  @{term "Abs_lst as x"} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1251
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1252
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1253
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1254
  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
  1255
  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
  1256
  \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
  1257
  abstractions, namely:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1258
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1259
  \begin{theorem}[Support of Abstractions]\label{suppabs} 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1260
  Assuming @{text x} has finite support, then\\[-6mm] 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1261
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1262
  \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
  1263
  %@ {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
  1264
  %@ {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
  1265
  %@ {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
  1266
  \end{tabular}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1267
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1268
  \end{theorem}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1269
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1270
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1271
  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
  1272
  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
  1273
  we have 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1274
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1275
  \begin{equation}\label{abseqiff}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1276
  %@ {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
  1277
  %@ {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
  1278
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1279
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1280
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1281
  and also
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1282
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1283
  \begin{equation}\label{absperm}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1284
  @{thm permute_Abs[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1285
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1286
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1287
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1288
  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
  1289
  \eqref{permute} and $\alpha$-equivalence being equivariant 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1290
  (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
  1291
  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
  1292
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1293
  \begin{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1294
  %@ {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
  1295
  \end{lemma}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1296
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1297
  \begin{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1298
  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
  1299
  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
  1300
  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
  1301
  \end{proof}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1302
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1303
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1304
  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
  1305
  with \eqref{absperm} allows us to show
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1306
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1307
  \begin{equation}\label{halfone}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1308
  %@ {thm abs_supports(1)[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1309
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1310
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1311
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1312
  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
  1313
  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
  1314
  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
  1315
  function @{text aux}, taking an abstraction as argument:
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1316
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1317
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1318
  @{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
  1319
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1320
  
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1321
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1322
  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
  1323
  @{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
  1324
  (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
  1325
  This in turn means
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1326
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1327
  \begin{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1328
  @{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
  1329
  \end{center}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1330
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1331
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1332
  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
  1333
  we further obtain
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1334
  %
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1335
  \begin{equation}\label{halftwo}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1336
  %@ {thm (concl) supp_abs_subset1(1)[no_vars]}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1337
  \end{equation}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1338
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1339
  \noindent
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1340
  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
  1341
  @{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
  1342
  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
  1343
  Theorem~\ref{suppabs}. 
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1344
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1345
  The method of first considering abstractions of the
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1346
  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
  1347
  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
  1348
  properties about them.  It would be
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1349
  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
  1350
  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
  1351
  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
  1352
*}
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1353
0cb0c88b2cad added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents: 2521
diff changeset
  1354
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1355
section {* Concrete Atom Types\label{concrete} *}
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1356
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1357
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1358
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1359
  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
  1360
  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
  1361
  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
  1362
  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
  1363
  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
  1364
  atom type makes this possible.  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1365
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1366
  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
  1367
  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
  1368
  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
  1369
  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
  1370
  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
  1371
  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
  1372
  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
  1373
  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
  1374
  Isabelle/HOL as:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1375
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1376
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1377
          lemma
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1378
	    fixes a b :: "atom"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1379
	    assumes asm: "sort a = sort b"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1380
	    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
  1381
          using asm by simp
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1382
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1383
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1384
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1385
  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
  1386
  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
  1387
  \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
  1388
  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
  1389
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1390
  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
  1391
  \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
  1392
  "''name''"}.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1393
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1394
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1395
  \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
  1396
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1397
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1398
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1399
  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
  1400
  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
  1401
  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
  1402
  functions as follows:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1403
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1404
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1405
  \begin{tabular}{@ {}l@ {\hspace{10mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1406
  @{text "\<lfloor>_\<rfloor> :: name \<Rightarrow> atom"} & 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1407
  @{text "\<lceil>_\<rceil> :: atom \<Rightarrow> name"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1408
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1409
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1410
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1411
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1412
  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
  1413
  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
  1414
  @{typ name} is a permutation type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1415
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1416
  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
  1417
  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
  1418
  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
  1419
  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
  1420
  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
  1421
  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
  1422
  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
  1423
  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
  1424
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1425
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1426
  \begin{tabular}{r@ {\hspace{3mm}}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1427
  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
  1428
  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
  1429
  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
  1430
  \end{tabular}\hfill\numbered{atomprops}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1431
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1432
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1433
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1434
  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
  1435
  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
  1436
  type.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1437
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1438
  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
  1439
  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
  1440
  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
  1441
  \<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
  1442
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1443
  @{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
  1444
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1445
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1446
  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
  1447
  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
  1448
  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
  1449
  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
  1450
  simplification rule:
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1451
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1452
  @{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
  1453
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1454
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1455
  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
  1456
  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
  1457
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1458
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1459
          lemma
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1460
	    fixes a b :: "name"
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1461
	    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
  1462
	  by simp
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1463
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1464
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1465
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1466
  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
  1467
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1468
  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
  1469
  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
  1470
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1471
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1472
  \begin{tabular}{@ {}l}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1473
  \isacommand{atom\_decl}~~@{text "name"}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1474
  \end{tabular}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1475
  \end{isabelle}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1476
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1477
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1478
  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
  1479
  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
  1480
  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
  1481
  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
  1482
  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
  1483
  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
  1484
  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
  1485
  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
  1486
  place.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1487
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1488
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1489
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1490
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1491
section {* Related Work\label{related} *}
2033
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1492
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1493
text {*
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1494
  Add here comparison with old work.
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1495
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1496
    Using a single atom type to represent atoms of different sorts and
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1497
  representing permutations as functions are not new ideas; see
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1498
  \cite{GunterOsbornPopescu09} \footnote{function rep.}  The main contribution
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1499
  of this paper is to show an example of how to make better theorem proving
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1500
  tools by choosing the right level of abstraction for the underlying
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1501
  theory---our design choices take advantage of Isabelle's type system, type
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1502
  classes and reasoning infrastructure.  The novel technical contribution is a
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1503
  mechanism for dealing with ``Church-style'' lambda-terms \cite{Church40} and
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1504
  HOL-based languages \cite{PittsHOL4} where variables and variable binding
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1505
  depend on type annotations.
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1506
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1507
  The paper is organised as follows\ldots
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1508
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2740
diff changeset
  1509
2523
e903c32ec24f more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2522
diff changeset
  1510
  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
  1511
  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
  1512
  type class suffices. 
2736
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1513
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1514
  With this
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1515
  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
  1516
  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
  1517
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1518
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1519
  @{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
  1520
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1521
  \noindent 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1522
  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
  1523
  of the objects on which the permutation acts. For atoms 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1524
  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
  1525
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1526
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1527
  \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1528
  @{text "[] \<bullet> c"} & @{text "="} & @{text c}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1529
  @{text "(a b)::\<pi> \<bullet> c"} & @{text "="} & 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1530
     $\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
  1531
                    @{text b} & \textrm{if}~@{text "\<pi> \<bullet> c = a"}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1532
                    @{text "\<pi> \<bullet> c"} & \textrm{otherwise}\end{cases}$
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1533
  \end{tabular}\hfill\numbered{atomperm}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1534
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1535
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1536
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1537
  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
  1538
  @{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
  1539
  define @{text "\<pi> \<bullet> c \<equiv> c"}.
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1540
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1541
  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
  1542
  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
  1543
  permutation, since the type system excludes lists containing atoms of
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1544
  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
  1545
  generalise induction hypotheses by quantifying over permutations, we have to
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1546
  build quantifications like
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1547
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1548
  @{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
  1549
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1550
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1551
  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
  1552
  The reason is that the permutation operation behaves differently for 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1553
  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
  1554
  single quantification to stand for all permutations. Similarly, the 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1555
  notion of support
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1556
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1557
  @{text [display,indent=10] "supp _ :: \<beta> \<Rightarrow> \<alpha> set"}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1558
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1559
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1560
  which we will define later, cannot be
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1561
  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
  1562
  is that support can behave differently for each @{text
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1563
  "\<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
  1564
  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
  1565
  with having to state premises of the form
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1566
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1567
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1568
  \begin{tabular}{@ {}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1569
  @{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
  1570
  \end{tabular}\hfill\numbered{fssequence}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1571
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1572
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1573
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1574
  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
  1575
  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
  1576
  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
  1577
  the type systems to exclude them. 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1578
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1579
  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
  1580
  \cite{Urban08}).  Although an
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1581
  advantage of this representation is that the basic operations on
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1582
  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
  1583
  two permutations (written @{text "_ @ _"}) is just list append, and
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1584
  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
  1585
  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
  1586
  induction principle for lists, a disadvantage is that permutations 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1587
  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
  1588
  them according to the relation
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1589
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1590
  
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1591
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1592
  \begin{tabular}{@ {}l}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1593
  @{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
  1594
  \end{tabular}\hfill\numbered{permequ}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1595
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1596
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1597
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1598
  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
  1599
  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
  1600
  is well-behaved in the sense that it satisfies some
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1601
  \emph{permutation properties}. In the list representation we need
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1602
  to state these properties as follows:
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1603
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1604
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1605
  \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1606
  \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1607
  i) & @{text "[] \<bullet> x = x"}\\
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1608
  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
  1609
  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
  1610
  \end{tabular}\hfill\numbered{permprops}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1611
  \end{isabelle}
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1612
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1613
  \noindent
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1614
  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
  1615
  to produce the same result for related permutations.  Moreover, 
61d30863e5d1 updated pearl papers
Christian Urban <urbanc@in.tum.de>
parents: 2734
diff changeset
  1616
  ``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
  1617
  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
  1618
  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
  1619
  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
  1620
  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
  1621
*}
74bd7bfb484b some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents: 2005
diff changeset
  1622
1785
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1623
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1624
section {* Conclusion *}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1625
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1626
text {*
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1627
  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
  1628
  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
  1629
  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
  1630
  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
  1631
  new version of Nominal Isabelle.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1632
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1633
  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
  1634
  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
  1635
  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
  1636
  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
  1637
  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
  1638
  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
  1639
  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
  1640
  @{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
  1641
  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
  1642
  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
  1643
  involved in building Nominal Isabelle.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1644
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1645
  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
  1646
  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
  1647
  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
  1648
  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
  1649
  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
  1650
  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
  1651
  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
  1652
  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
  1653
  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
  1654
  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
  1655
  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
  1656
  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
  1657
  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
  1658
  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
  1659
  zero to return zero.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1660
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1661
  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
  1662
  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
  1663
  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
  1664
  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
  1665
  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
  1666
  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
  1667
  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
  1668
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1669
  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
  1670
  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
  1671
  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
  1672
  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
  1673
  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
  1674
  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
  1675
  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
  1676
  conveniently with such binders.
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1677
 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1678
  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
  1679
  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
  1680
  Mercurial repository linked at 
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1681
  \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
  1682
  {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
  1683
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1684
  \noindent
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1685
  {\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
  1686
  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
  1687
  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
  1688
  put the work into the right context.  
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1689
*}
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1690
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1691
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1692
(*<*)
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1693
end
95df71c3df2f added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
  1694
(*>*)