Nominal/Nominal2_Base_Exec.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 31 May 2012 11:59:56 +0100
changeset 3180 7b5db6c23753
parent 3176 31372760c2fb
child 3182 5335c0ea743a
permissions -rw-r--r--
added let-eqvt back
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     1
(*  Title:      Nominal2_Base
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     2
    Authors:    Christian Urban, Brian Huffman, Cezary Kaliszyk
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     3
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     4
    Basic definitions and lemma infrastructure for 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     5
    Nominal Isabelle. 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     6
*)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     7
theory Nominal2_Base
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     8
imports Main 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     9
        "~~/src/HOL/Library/Infinite_Set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    10
        "~~/src/HOL/Quotient_Examples/FSet"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    11
        "GPerm"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    12
  "~~/src/HOL/Library/List_lexord"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    13
  "~~/src/HOL/Library/Product_ord"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    14
  "~~/src/HOL/Library/Efficient_Nat"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    15
  "~~/src/HOL/Library/Char_ord"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    16
  "~~/src/HOL/Library/Code_Char_chr"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
    17
  "~~/src/HOL/Library/Code_Char_ord"
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    18
keywords
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    19
  "atom_decl" "equivariance" :: thy_decl
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    20
uses ("nominal_basics.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    21
     ("nominal_thmdecls.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    22
     ("nominal_permeq.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    23
     ("nominal_library.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    24
     ("nominal_atoms.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    25
     ("nominal_eqvt.ML")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    26
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    27
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    28
section {* Atoms and Sorts *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    29
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    30
text {* A simple implementation for atom_sorts is strings. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    31
(* types atom_sort = string *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    32
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    33
text {* To deal with Church-like binding we use trees of
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    34
  strings as sorts. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    35
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    36
datatype atom_sort = Sort "string" "atom_sort list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    37
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    38
datatype atom = Atom atom_sort nat
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    39
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    40
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    41
text {* Basic projection function. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    42
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    43
primrec
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    44
  sort_of :: "atom \<Rightarrow> atom_sort"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    45
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    46
  "sort_of (Atom s n) = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    47
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    48
primrec
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    49
  nat_of :: "atom \<Rightarrow> nat"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    50
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    51
  "nat_of (Atom s n) = n"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    52
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    53
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    54
text {* There are infinitely many atoms of each sort. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    55
lemma INFM_sort_of_eq: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    56
  shows "INFM a. sort_of a = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    57
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    58
  have "INFM i. sort_of (Atom s i) = s" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    59
  moreover have "inj (Atom s)" by (simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    60
  ultimately show "INFM a. sort_of a = s" by (rule INFM_inj)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    61
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    62
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    63
lemma infinite_sort_of_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    64
  shows "infinite {a. sort_of a = s}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    65
  using INFM_sort_of_eq unfolding INFM_iff_infinite .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    66
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    67
lemma atom_infinite [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    68
  shows "infinite (UNIV :: atom set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    69
  using subset_UNIV infinite_sort_of_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    70
  by (rule infinite_super)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    71
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    72
lemma obtain_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    73
  fixes X :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    74
  assumes X: "finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    75
  obtains a where "a \<notin> X" "sort_of a = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    76
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    77
  from X have "MOST a. a \<notin> X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    78
    unfolding MOST_iff_cofinite by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    79
  with INFM_sort_of_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    80
  have "INFM a. sort_of a = s \<and> a \<notin> X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    81
    by (rule INFM_conjI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    82
  then obtain a where "a \<notin> X" "sort_of a = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    83
    by (auto elim: INFM_E)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    84
  then show ?thesis ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    85
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    86
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    87
lemma atom_components_eq_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    88
  fixes a b :: atom
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    89
  shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    90
  by (induct a, induct b, simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    91
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    92
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    93
section {* Sort-Respecting Permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    94
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    95
definition "sort_respecting p \<longleftrightarrow> (\<forall>a. sort_of (gpermute p a) = sort_of a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    96
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    97
lemma sort_respecting_0[simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    98
  "sort_respecting (0\<Colon>atom gperm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    99
  by (simp add: sort_respecting_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   100
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   101
typedef (open) perm = "{p::atom gperm. sort_respecting p}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   102
  by (auto intro: exI[of _ "0"])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   103
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   104
setup_lifting type_definition_perm
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   105
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   106
lemma perm_eq_rep:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   107
  "p = q \<longleftrightarrow> Rep_perm p = Rep_perm q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   108
  by (simp add: Rep_perm_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   109
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   110
lift_definition mk_perm :: "atom gperm \<Rightarrow> perm" is
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   111
  "\<lambda>p. if sort_respecting p then p else 0" by simp
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   112
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   113
lemma Rep_perm_mk_perm [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   114
  "Rep_perm (mk_perm p) = (if sort_respecting p then p else 0)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   115
  by (simp add: mk_perm_def Abs_perm_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   116
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   117
instance perm :: size ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   118
3175
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   119
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   120
subsection {* Permutations form a (multiplicative) group *}
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   121
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   122
instantiation perm :: group_add
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   123
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   124
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   125
lift_definition zero_perm :: "perm" is "0" by simp
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   126
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   127
lift_definition uminus_perm :: "perm \<Rightarrow> perm" is "uminus"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   128
  unfolding sort_respecting_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   129
  by transfer (auto, metis perm_apply_minus)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   130
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   131
lift_definition plus_perm :: "perm \<Rightarrow> perm \<Rightarrow> perm" is "plus"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   132
  unfolding sort_respecting_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   133
  by transfer (simp add: perm_add_apply)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   134
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   135
definition "(p :: perm) - q = p + - q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   136
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   137
lemma Rep_perm_0 [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   138
  "Rep_perm 0 = 0"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   139
  by (metis (mono_tags) zero_perm.rep_eq)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   140
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   141
lemma Rep_perm_uminus [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   142
  "Rep_perm (- p) = - (Rep_perm p)"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   143
  by (metis uminus_perm.rep_eq)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   144
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   145
lemma Rep_perm_add [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   146
  "Rep_perm (p + q) = (Rep_perm p) + (Rep_perm q)"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   147
  by (simp add: plus_perm.rep_eq)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   148
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   149
instance
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   150
  apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   151
  unfolding minus_perm_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   152
  by (transfer, simp add: add_assoc)+
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   153
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   154
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   155
3175
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   156
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   157
section {* Implementation of swappings *}
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
   158
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   159
lift_definition swap :: "atom \<Rightarrow> atom \<Rightarrow> perm"  ("'(_ \<rightleftharpoons> _')")
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   160
  is "(\<lambda>a b. (if sort_of a = sort_of b then mk_perm (gswap a b) else 0))" .
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   161
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   162
lemma sort_respecting_swap [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   163
  "sort_of a = sort_of b \<Longrightarrow> sort_respecting (gswap a b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   164
  unfolding sort_respecting_def
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   165
  by transfer auto
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   166
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   167
lemma Rep_swap [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   168
  "Rep_perm (swap a b) = (if sort_of a = sort_of b then gswap a b else 0)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   169
  by (simp add: swap_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   170
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   171
lemma swap_different_sorts [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   172
  "sort_of a \<noteq> sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   173
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   174
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   175
lemma swap_cancel:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   176
  shows "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   177
  and   "(a \<rightleftharpoons> b) + (b \<rightleftharpoons> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   178
  by (simp_all add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   179
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   180
lemma swap_self [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   181
  "(a \<rightleftharpoons> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   182
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   183
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   184
lemma minus_swap [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   185
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   186
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   187
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   188
lemma swap_commute:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   189
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   190
  by (simp add: perm_eq_rep swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   191
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   192
lemma swap_triple:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   193
  assumes "a \<noteq> b" and "c \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   194
  assumes "sort_of a = sort_of b" "sort_of b = sort_of c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   195
  shows "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   196
  using assms by (simp add: perm_eq_rep swap_triple)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   197
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   198
section {* Permutation Types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   199
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   200
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   201
  Infix syntax for @{text permute} has higher precedence than
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   202
  addition, but lower than unary minus.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   203
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   204
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   205
class pt =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   206
  fixes permute :: "perm \<Rightarrow> 'a \<Rightarrow> 'a" ("_ \<bullet> _" [76, 75] 75)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   207
  assumes permute_zero [simp]: "0 \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   208
  assumes permute_plus [simp]: "(p + q) \<bullet> x = p \<bullet> (q \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   209
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   210
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   211
lemma permute_diff [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   212
  shows "(p - q) \<bullet> x = p \<bullet> - q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   213
  unfolding diff_minus by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   214
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   215
lemma permute_minus_cancel [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   216
  shows "p \<bullet> - p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   217
  and   "- p \<bullet> p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   218
  unfolding permute_plus [symmetric] by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   219
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   220
lemma permute_swap_cancel [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   221
  shows "(a \<rightleftharpoons> b) \<bullet> (a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   222
  unfolding permute_plus [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   223
  by (simp add: swap_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   224
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   225
lemma permute_swap_cancel2 [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   226
  shows "(a \<rightleftharpoons> b) \<bullet> (b \<rightleftharpoons> a) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   227
  unfolding permute_plus [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   228
  by (simp add: swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   229
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   230
lemma inj_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   231
  shows "inj (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   232
  by (rule inj_on_inverseI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   233
     (rule permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   234
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   235
lemma surj_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   236
  shows "surj (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   237
  by (rule surjI, rule permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   238
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   239
lemma bij_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   240
  shows "bij (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   241
  by (rule bijI [OF inj_permute surj_permute])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   242
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   243
lemma inv_permute: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   244
  shows "inv (permute p) = permute (- p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   245
  by (rule inv_equality) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   246
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   247
lemma permute_minus: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   248
  shows "permute (- p) = inv (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   249
  by (simp add: inv_permute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   250
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   251
lemma permute_eq_iff [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   252
  shows "p \<bullet> x = p \<bullet> y \<longleftrightarrow> x = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   253
  by (rule inj_permute [THEN inj_eq])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   254
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   255
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   256
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   257
subsection {* Permutations for atoms *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   258
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   259
instantiation atom :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   260
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   261
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   262
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   263
  "p \<bullet> a = gpermute (Rep_perm p) a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   264
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   265
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   266
  by default (simp_all add: permute_atom_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   267
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   268
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   269
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   270
lemma sort_of_permute [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   271
  shows "sort_of (p \<bullet> a) = sort_of a"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   272
  by (metis Rep_perm mem_Collect_eq sort_respecting_def permute_atom_def)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   273
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   274
lemma swap_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   275
  shows "(a \<rightleftharpoons> b) \<bullet> c =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   276
           (if sort_of a = sort_of b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   277
            then (if c = a then b else if c = b then a else c) else c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   278
  by (auto simp add: permute_atom_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   279
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   280
lemma swap_atom_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   281
  "sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   282
  "sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> b = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   283
  "c \<noteq> a \<Longrightarrow> c \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> c = c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   284
  unfolding swap_atom by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   285
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   286
lemma perm_eq_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   287
  fixes p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   288
  shows "p = q \<longleftrightarrow> (\<forall>a::atom. p \<bullet> a = q \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   289
  unfolding permute_atom_def perm_eq_rep
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   290
  by (simp add: gperm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   291
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   292
subsection {* Permutations for permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   293
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   294
instantiation perm :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   295
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   296
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   297
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   298
  "p \<bullet> q = p + q - p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   299
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   300
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   301
  by default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   302
     (simp_all add: permute_perm_def diff_minus minus_add add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   303
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   304
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   305
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   306
lemma permute_self:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   307
  shows "p \<bullet> p = p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   308
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   309
  by (simp add: diff_minus add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   310
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   311
lemma pemute_minus_self:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   312
  shows "- p \<bullet> p = p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   313
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   314
  by (simp add: diff_minus add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   315
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   316
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   317
subsection {* Permutations for functions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   318
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   319
instantiation "fun" :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   320
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   321
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   322
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   323
  "p \<bullet> f = (\<lambda>x. p \<bullet> (f (- p \<bullet> x)))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   324
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   325
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   326
  by default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   327
     (simp_all add: permute_fun_def minus_add)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   328
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   329
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   330
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   331
lemma permute_fun_app_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   332
  shows "p \<bullet> (f x) = (p \<bullet> f) (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   333
  unfolding permute_fun_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   334
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   335
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   336
subsection {* Permutations for booleans *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   337
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   338
instantiation bool :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   339
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   340
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   341
definition "p \<bullet> (b::bool) = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   342
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   343
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   344
  by (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   345
     (simp_all add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   346
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   347
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   348
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   349
lemma permute_boolE:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   350
  fixes P::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   351
  shows "p \<bullet> P \<Longrightarrow> P"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   352
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   353
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   354
lemma permute_boolI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   355
  fixes P::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   356
  shows "P \<Longrightarrow> p \<bullet> P"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   357
  by(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   358
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   359
subsection {* Permutations for sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   360
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   361
instantiation "set" :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   362
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   363
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   364
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   365
  "p \<bullet> X = {p \<bullet> x | x. x \<in> X}" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   366
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   367
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   368
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   369
apply (auto simp add: permute_set_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   370
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   371
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   372
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   373
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   374
lemma permute_set_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   375
  shows "p \<bullet> X = {x. - p \<bullet> x \<in> X}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   376
unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   377
by (auto) (metis permute_minus_cancel(1))
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   378
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   379
lemma permute_set_eq_image:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   380
  shows "p \<bullet> X = permute p ` X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   381
  unfolding permute_set_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   382
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   383
lemma permute_set_eq_vimage:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   384
  shows "p \<bullet> X = permute (- p) -` X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   385
  unfolding permute_set_eq vimage_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   386
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   387
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   388
lemma permute_finite [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   389
  shows "finite (p \<bullet> X) = finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   390
  unfolding permute_set_eq_vimage
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   391
  using bij_permute by (rule finite_vimage_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   392
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   393
lemma swap_set_not_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   394
  assumes a: "a \<notin> S" "b \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   395
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   396
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   397
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   398
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   399
lemma swap_set_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   400
  assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   401
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   402
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   403
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   404
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   405
lemma swap_set_in_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   406
  assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   407
  shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   408
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   409
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   410
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   411
lemma swap_set_both_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   412
  assumes a: "a \<in> S" "b \<in> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   413
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   414
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   415
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   416
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   417
lemma mem_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   418
  shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   419
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   420
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   421
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   422
lemma empty_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   423
  shows "p \<bullet> {} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   424
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   425
  by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   426
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   427
lemma insert_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   428
  shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   429
  unfolding permute_set_eq_image image_insert ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   430
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   431
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   432
subsection {* Permutations for @{typ unit} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   433
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   434
instantiation unit :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   435
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   436
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   437
definition "p \<bullet> (u::unit) = u"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   438
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   439
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   440
by (default) (simp_all add: permute_unit_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   441
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   442
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   443
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   444
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   445
subsection {* Permutations for products *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   446
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   447
instantiation prod :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   448
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   449
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   450
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   451
  permute_prod 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   452
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   453
  Pair_eqvt: "p \<bullet> (x, y) = (p \<bullet> x, p \<bullet> y)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   454
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   455
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   456
by default auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   457
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   458
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   459
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   460
subsection {* Permutations for sums *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   461
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   462
instantiation sum :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   463
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   464
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   465
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   466
  permute_sum 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   467
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   468
  Inl_eqvt: "p \<bullet> (Inl x) = Inl (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   469
| Inr_eqvt: "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   470
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   471
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   472
by (default) (case_tac [!] x, simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   473
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   474
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   475
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   476
subsection {* Permutations for @{typ "'a list"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   477
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   478
instantiation list :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   479
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   480
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   481
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   482
  permute_list 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   483
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   484
  Nil_eqvt:  "p \<bullet> [] = []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   485
| Cons_eqvt: "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   486
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   487
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   488
by (default) (induct_tac [!] x, simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   489
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   490
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   491
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   492
lemma set_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   493
  shows "p \<bullet> (set xs) = set (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   494
  by (induct xs) (simp_all add: empty_eqvt insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   495
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   496
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   497
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   498
subsection {* Permutations for @{typ "'a option"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   499
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   500
instantiation option :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   501
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   502
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   503
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   504
  permute_option 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   505
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   506
  None_eqvt: "p \<bullet> None = None"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   507
| Some_eqvt: "p \<bullet> (Some x) = Some (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   508
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   509
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   510
by (default) (induct_tac [!] x, simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   511
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   512
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   513
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   514
subsection {* Permutations for @{typ "'a multiset"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   515
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   516
instantiation multiset :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   517
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   518
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   519
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   520
  "p \<bullet> M = {# p \<bullet> x. x :# M #}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   521
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   522
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   523
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   524
  fix M :: "'a multiset" and p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   525
  show "0 \<bullet> M = M" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   526
    unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   527
    by (induct_tac M) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   528
  show "(p + q) \<bullet> M = p \<bullet> q \<bullet> M" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   529
    unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   530
    by (induct_tac M) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   531
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   532
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   533
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   534
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   535
lemma permute_multiset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   536
  fixes M N::"('a::pt) multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   537
  shows "(p \<bullet> {#}) = ({#} ::('a::pt) multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   538
  and   "(p \<bullet> {# x #}) = {# p \<bullet> x #}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   539
  and   "(p \<bullet> (M + N)) = (p \<bullet> M) + (p \<bullet> N)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   540
  unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   541
  by (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   542
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   543
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   544
subsection {* Permutations for @{typ "'a fset"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   545
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   546
instantiation fset :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   547
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   548
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   549
quotient_definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   550
  "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   551
is
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   552
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   553
  by (simp add: set_eqvt[symmetric])
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   554
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   555
instance
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   556
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   557
  fix x :: "'a fset" and p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   558
  have lst: "\<And>l :: 'a list. 0 \<bullet> l = l" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   559
  show "0 \<bullet> x = x" by (lifting lst)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   560
  have lst: "\<And>p q :: perm. \<And>x :: 'a list. (p + q) \<bullet> x = p \<bullet> q \<bullet> x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   561
  show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (lifting lst)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   562
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   563
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   564
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   565
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   566
lemma permute_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   567
  fixes S::"('a::pt) fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   568
  shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   569
  and   "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   570
  by (lifting permute_list.simps)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   571
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   572
lemma fset_eqvt: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   573
  shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   574
  by (lifting set_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   575
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   576
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   577
subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   578
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   579
instantiation char :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   580
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   581
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   582
definition "p \<bullet> (c::char) = c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   583
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   584
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   585
by (default) (simp_all add: permute_char_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   586
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   587
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   588
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   589
instantiation nat :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   590
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   591
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   592
definition "p \<bullet> (n::nat) = n"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   593
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   594
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   595
by (default) (simp_all add: permute_nat_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   596
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   597
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   598
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   599
instantiation int :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   600
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   601
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   602
definition "p \<bullet> (i::int) = i"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   603
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   604
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   605
by (default) (simp_all add: permute_int_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   606
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   607
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   608
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   609
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   610
section {* Pure types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   611
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   612
text {* Pure types will have always empty support. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   613
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   614
class pure = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   615
  assumes permute_pure: "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   616
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   617
text {* Types @{typ unit} and @{typ bool} are pure. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   618
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   619
instance unit :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   620
proof qed (rule permute_unit_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   621
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   622
instance bool :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   623
proof qed (rule permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   624
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   625
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   626
text {* Other type constructors preserve purity. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   627
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   628
instance "fun" :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   629
by default (simp add: permute_fun_def permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   630
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   631
instance set :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   632
by default (simp add: permute_set_def permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   633
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   634
instance prod :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   635
by default (induct_tac x, simp add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   636
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   637
instance sum :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   638
by default (induct_tac x, simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   639
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   640
instance list :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   641
by default (induct_tac x, simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   642
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   643
instance option :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   644
by default (induct_tac x, simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   645
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   646
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   647
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   648
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   649
instance char :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   650
proof qed (rule permute_char_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   651
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   652
instance nat :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   653
proof qed (rule permute_nat_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   654
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   655
instance int :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   656
proof qed (rule permute_int_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   657
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   658
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   659
section {* Infrastructure for Equivariance and Perm_simp *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   660
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   661
subsection {* Basic functions about permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   662
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   663
use "nominal_basics.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   664
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   665
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   666
subsection {* Eqvt infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   667
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   668
text {* Setup of the theorem attributes @{text eqvt} and @{text eqvt_raw} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   669
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   670
use "nominal_thmdecls.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   671
setup "Nominal_ThmDecls.setup"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   672
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   673
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   674
lemmas [eqvt] =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   675
  (* pt types *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   676
  permute_prod.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   677
  permute_list.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   678
  permute_option.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   679
  permute_sum.simps
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   680
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   681
  (* sets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   682
  empty_eqvt insert_eqvt set_eqvt 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   683
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   684
  (* fsets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   685
  permute_fset fset_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   686
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   687
  (* multisets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   688
  permute_multiset
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   689
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   690
subsection {* perm_simp infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   691
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   692
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   693
  "unpermute p = permute (- p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   694
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   695
lemma eqvt_apply:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   696
  fixes f :: "'a::pt \<Rightarrow> 'b::pt" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   697
  and x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   698
  shows "p \<bullet> (f x) \<equiv> (p \<bullet> f) (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   699
  unfolding permute_fun_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   700
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   701
lemma eqvt_lambda:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   702
  fixes f :: "'a::pt \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   703
  shows "p \<bullet> f \<equiv> (\<lambda>x. p \<bullet> (f (unpermute p x)))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   704
  unfolding permute_fun_def unpermute_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   705
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   706
lemma eqvt_bound:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   707
  shows "p \<bullet> unpermute p x \<equiv> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   708
  unfolding unpermute_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   709
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   710
text {* provides perm_simp methods *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   711
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   712
use "nominal_permeq.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   713
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   714
method_setup perm_simp =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   715
 {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_simp_meth *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   716
 {* pushes permutations inside. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   717
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   718
method_setup perm_strict_simp =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   719
 {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_strict_simp_meth *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   720
 {* pushes permutations inside, raises an error if it cannot solve all permutations. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   721
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   722
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   723
subsubsection {* Equivariance for permutations and swapping *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   724
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   725
lemma permute_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   726
  shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   727
  unfolding permute_perm_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   728
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   729
(* the normal version of this lemma would cause loops *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   730
lemma permute_eqvt_raw [eqvt_raw]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   731
  shows "p \<bullet> permute \<equiv> permute"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   732
apply(simp add: fun_eq_iff permute_fun_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   733
apply(subst permute_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   734
apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   735
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   736
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   737
lemma zero_perm_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   738
  shows "p \<bullet> (0::perm) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   739
  unfolding permute_perm_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   740
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   741
lemma add_perm_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   742
  fixes p p1 p2 :: perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   743
  shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   744
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   745
  by (simp add: perm_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   746
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   747
lemma swap_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   748
  shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   749
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   750
  by (auto simp add: swap_atom perm_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   751
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   752
lemma uminus_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   753
  fixes p q::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   754
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   755
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   756
  by (simp add: diff_minus minus_add add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   757
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   758
subsubsection {* Equivariance of Logical Operators *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   759
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   760
lemma eq_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   761
  shows "p \<bullet> (x = y) \<longleftrightarrow> (p \<bullet> x) = (p \<bullet> y)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   762
  unfolding permute_eq_iff permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   763
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   764
lemma Not_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   765
  shows "p \<bullet> (\<not> A) \<longleftrightarrow> \<not> (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   766
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   767
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   768
lemma conj_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   769
  shows "p \<bullet> (A \<and> B) \<longleftrightarrow> (p \<bullet> A) \<and> (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   770
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   771
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   772
lemma imp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   773
  shows "p \<bullet> (A \<longrightarrow> B) \<longleftrightarrow> (p \<bullet> A) \<longrightarrow> (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   774
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   775
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   776
declare imp_eqvt[folded induct_implies_def, eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   777
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   778
lemma all_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   779
  shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   780
  unfolding All_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   781
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   782
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   783
declare all_eqvt[folded induct_forall_def, eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   784
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   785
lemma ex_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   786
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   787
  unfolding Ex_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   788
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   789
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   790
lemma ex1_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   791
  shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   792
  unfolding Ex1_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   793
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   794
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   795
lemma if_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   796
  shows "p \<bullet> (if b then x else y) = (if p \<bullet> b then p \<bullet> x else p \<bullet> y)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   797
  by (simp add: permute_fun_def permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   798
3180
7b5db6c23753 added let-eqvt back
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
   799
lemma Let_eqvt [eqvt]:
7b5db6c23753 added let-eqvt back
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
   800
  shows "p \<bullet> Let x y = Let (p \<bullet> x) (p \<bullet> y)"
7b5db6c23753 added let-eqvt back
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
   801
  unfolding Let_def permute_fun_app_eq ..
7b5db6c23753 added let-eqvt back
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
   802
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   803
lemma True_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   804
  shows "p \<bullet> True = True"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   805
  unfolding permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   806
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   807
lemma False_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   808
  shows "p \<bullet> False = False"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   809
  unfolding permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   810
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   811
lemma disj_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   812
  shows "p \<bullet> (A \<or> B) \<longleftrightarrow> (p \<bullet> A) \<or> (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   813
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   814
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   815
lemma all_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   816
  shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. p \<bullet> P (- p \<bullet> x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   817
  by (perm_simp add: permute_minus_cancel) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   818
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   819
lemma ex_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   820
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. p \<bullet> P (- p \<bullet> x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   821
  by (perm_simp add: permute_minus_cancel) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   822
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   823
lemma ex1_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   824
  shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. p \<bullet> P (- p \<bullet> x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   825
  by (perm_simp add: permute_minus_cancel) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   826
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   827
lemma the_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   828
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   829
  shows "(p \<bullet> (THE x. P x)) = (THE x. (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   830
  apply(rule the1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   831
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   832
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   833
  apply(rule unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   834
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   835
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   836
  apply(rule theI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   837
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   838
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   839
lemma the_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   840
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   841
  shows "(p \<bullet> (THE x. P x)) = (THE x. p \<bullet> P (- p \<bullet> x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   842
  apply(rule the1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   843
  apply(simp add: ex1_eqvt2[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   844
  apply(simp add: permute_bool_def unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   845
  apply(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   846
  apply(rule theI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   847
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   848
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   849
subsubsection {* Equivariance of Set operators *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   850
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   851
lemma mem_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   852
  shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   853
  unfolding permute_bool_def permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   854
  by (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   855
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   856
lemma Collect_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   857
  shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   858
  unfolding permute_set_eq permute_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   859
  by (auto simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   860
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   861
lemma inter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   862
  shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   863
  unfolding Int_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   864
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   865
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   866
lemma Bex_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   867
  shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   868
  unfolding Bex_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   869
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   870
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   871
lemma Ball_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   872
  shows "p \<bullet> (\<forall>x \<in> S. P x) = (\<forall>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   873
  unfolding Ball_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   874
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   875
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   876
lemma image_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   877
  shows "p \<bullet> (f ` A) = (p \<bullet> f) ` (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   878
  unfolding image_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   879
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   880
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   881
lemma Image_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   882
  shows "p \<bullet> (R `` A) = (p \<bullet> R) `` (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   883
  unfolding Image_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   884
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   885
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   886
lemma UNIV_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   887
  shows "p \<bullet> UNIV = UNIV"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   888
  unfolding UNIV_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   889
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   890
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   891
lemma union_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   892
  shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   893
  unfolding Un_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   894
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   895
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   896
lemma Diff_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   897
  fixes A B :: "'a::pt set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   898
  shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   899
  unfolding set_diff_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   900
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   901
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   902
lemma Compl_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   903
  fixes A :: "'a::pt set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   904
  shows "p \<bullet> (- A) = - (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   905
  unfolding Compl_eq_Diff_UNIV
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   906
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   907
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   908
lemma subset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   909
  shows "p \<bullet> (S \<subseteq> T) \<longleftrightarrow> (p \<bullet> S) \<subseteq> (p \<bullet> T)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   910
  unfolding subset_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   911
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   912
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   913
lemma psubset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   914
  shows "p \<bullet> (S \<subset> T) \<longleftrightarrow> (p \<bullet> S) \<subset> (p \<bullet> T)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   915
  unfolding psubset_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   916
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   917
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   918
lemma vimage_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   919
  shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   920
  unfolding vimage_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   921
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   922
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   923
lemma Union_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   924
  shows "p \<bullet> (\<Union> S) = \<Union> (p \<bullet> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   925
  unfolding Union_eq 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   926
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   927
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   928
lemma Inter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   929
  shows "p \<bullet> (\<Inter> S) = \<Inter> (p \<bullet> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   930
  unfolding Inter_eq 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   931
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   932
3147
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   933
lemma foldr_eqvt[eqvt]:
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   934
  "p \<bullet> foldr a b c = foldr (p \<bullet> a) (p \<bullet> b) (p \<bullet> c)"
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   935
  apply (induct b)
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   936
  apply simp_all
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   937
  apply (perm_simp)
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   938
  apply simp
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   939
  done
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   940
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   941
(* FIXME: eqvt attribute *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   942
lemma Sigma_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   943
  shows "(p \<bullet> (X \<times> Y)) = (p \<bullet> X) \<times> (p \<bullet> Y)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   944
unfolding Sigma_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   945
unfolding SUP_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   946
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   947
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   948
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   949
  In order to prove that lfp is equivariant we need two
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   950
  auxiliary classes which specify that (op <=) and
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   951
  Inf are equivariant. Instances for bool and fun are 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   952
  given.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   953
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   954
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   955
class le_eqvt =  order + 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   956
  assumes le_eqvt [eqvt]: "p \<bullet> (x \<le> y) = ((p \<bullet> x) \<le> (p \<bullet> (y::('a::{pt, order}))))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   957
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   958
class inf_eqvt = complete_lattice +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   959
  assumes inf_eqvt [eqvt]: "p \<bullet> (Inf X) = Inf (p \<bullet> (X::('a::{pt, Inf}) set))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   960
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   961
instantiation bool :: le_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   962
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   963
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   964
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   965
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   966
apply perm_simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   967
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   968
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   969
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   970
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   971
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   972
instantiation "fun" :: (pt, le_eqvt) le_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   973
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   974
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   975
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   976
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   977
unfolding le_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   978
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   979
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   980
done 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   981
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   982
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   983
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   984
instantiation bool :: inf_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   985
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   986
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   987
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   988
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   989
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   990
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   991
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   992
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   993
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   994
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   995
instantiation "fun" :: (pt, inf_eqvt) inf_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   996
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   997
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   998
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   999
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1000
unfolding Inf_fun_def INF_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1001
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1002
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1003
done 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1004
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1005
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1006
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1007
lemma lfp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1008
  fixes F::"('a \<Rightarrow> 'b) \<Rightarrow> ('a::pt \<Rightarrow> 'b::{inf_eqvt, le_eqvt})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1009
  shows "p \<bullet> (lfp F) = lfp (p \<bullet> F)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1010
unfolding lfp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1011
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1012
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1013
lemma finite_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1014
  shows "p \<bullet> finite A = finite (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1015
unfolding finite_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1016
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1017
3175
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  1018
lemma Let_eqvt [eqvt]:
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  1019
  "p \<bullet> Let x y = Let (p \<bullet> x) (p \<bullet> y)"
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  1020
  unfolding Let_def permute_fun_app_eq ..
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1021
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1022
subsubsection {* Equivariance for product operations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1023
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1024
lemma fst_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1025
  shows "p \<bullet> (fst x) = fst (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1026
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1027
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1028
lemma snd_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1029
  shows "p \<bullet> (snd x) = snd (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1030
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1031
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1032
lemma split_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1033
  shows "p \<bullet> (split P x) = split (p \<bullet> P) (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1034
  unfolding split_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1035
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1036
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1037
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1038
subsubsection {* Equivariance for list operations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1039
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1040
lemma append_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1041
  shows "p \<bullet> (xs @ ys) = (p \<bullet> xs) @ (p \<bullet> ys)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1042
  by (induct xs) auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1043
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1044
lemma rev_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1045
  shows "p \<bullet> (rev xs) = rev (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1046
  by (induct xs) (simp_all add: append_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1047
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1048
lemma map_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1049
  shows "p \<bullet> (map f xs) = map (p \<bullet> f) (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1050
  by (induct xs) (simp_all, simp only: permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1051
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1052
lemma removeAll_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1053
  shows "p \<bullet> (removeAll x xs) = removeAll (p \<bullet> x) (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1054
  by (induct xs) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1055
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1056
lemma filter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1057
  shows "p \<bullet> (filter f xs) = filter (p \<bullet> f) (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1058
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1059
apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1060
apply(simp only: filter.simps permute_list.simps if_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1061
apply(simp only: permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1062
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1063
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1064
lemma distinct_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1065
  shows "p \<bullet> (distinct xs) = distinct (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1066
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1067
apply(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1068
apply(simp add: conj_eqvt Not_eqvt mem_eqvt set_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1069
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1070
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1071
lemma length_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1072
  shows "p \<bullet> (length xs) = length (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1073
by (induct xs) (simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1074
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1075
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1076
subsubsection {* Equivariance for @{typ "'a option"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1077
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1078
lemma option_map_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1079
  shows "p \<bullet> (Option.map f x) = Option.map (p \<bullet> f) (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1080
  by (cases x) (simp_all, simp add: permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1081
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1082
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1083
subsubsection {* Equivariance for @{typ "'a fset"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1084
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1085
lemma in_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1086
  shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1087
unfolding in_fset
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1088
by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1089
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1090
lemma union_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1091
  shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1092
  by (induct S) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1093
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1094
lemma inter_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1095
  shows "p \<bullet> (inter_list S T) = inter_list (p \<bullet> S) (p \<bullet> T)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1096
  unfolding list_eq_def inter_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1097
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1098
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1099
lemma inter_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1100
  shows "(p \<bullet> (S |\<inter>| T)) = ((p \<bullet> S) |\<inter>| (p \<bullet> T))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1101
  by (lifting inter_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1102
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1103
lemma sub_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1104
  shows "p \<bullet> (sub_list S T) = sub_list (p \<bullet> S) (p \<bullet> T)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1105
  unfolding sub_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1106
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1107
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1108
lemma subset_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1109
  shows "(p \<bullet> (S |\<subseteq>| T)) = ((p \<bullet> S) |\<subseteq>| (p \<bullet> T))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1110
  by (lifting sub_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1111
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1112
lemma map_fset_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1113
  shows "p \<bullet> (map_fset f S) = map_fset (p \<bullet> f) (p \<bullet> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1114
  by (lifting map_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1115
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1116
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1117
section {* Supp, Freshness and Supports *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1118
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1119
context pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1120
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1121
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1122
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1123
  supp :: "'a \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1124
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1125
  "supp x = {a. infinite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1126
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1127
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1128
  fresh :: "atom \<Rightarrow> 'a \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1129
where   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1130
  "a \<sharp> x \<equiv> a \<notin> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1131
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1132
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1133
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1134
lemma supp_conv_fresh: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1135
  shows "supp x = {a. \<not> a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1136
  unfolding fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1137
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1138
lemma swap_rel_trans:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1139
  assumes "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1140
  assumes "sort_of b = sort_of c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1141
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1142
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1143
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1144
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1145
  assume "a = b \<or> c = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1146
  with assms show "(a \<rightleftharpoons> b) \<bullet> x = x" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1147
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1148
  assume *: "\<not> (a = b \<or> c = b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1149
  have "((a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c)) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1150
    using assms by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1151
  also have "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1152
    using assms * by (simp add: swap_triple)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1153
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1154
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1155
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1156
lemma swap_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1157
  assumes a: "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1158
  and     b: "b \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1159
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1160
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1161
  assume asm: "sort_of a = sort_of b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1162
  have "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}" "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1163
    using a b unfolding fresh_def supp_def by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1164
  then have "finite ({c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x} \<union> {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x})" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1165
  then obtain c 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1166
    where "(a \<rightleftharpoons> c) \<bullet> x = x" "(b \<rightleftharpoons> c) \<bullet> x = x" "sort_of c = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1167
    by (rule obtain_atom) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1168
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" using asm by (rule_tac swap_rel_trans) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1169
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1170
  assume "sort_of a \<noteq> sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1171
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1172
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1173
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1174
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1175
subsection {* supp and fresh are equivariant *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1176
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1177
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1178
lemma supp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1179
  shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1180
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1181
  by (perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1182
     (simp only: permute_eqvt[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1183
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1184
lemma fresh_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1185
  shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1186
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1187
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1188
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1189
lemma fresh_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1190
  shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1191
  by (simp only: fresh_eqvt[symmetric] permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1192
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1193
lemma fresh_permute_left:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1194
  shows "a \<sharp> p \<bullet> x \<longleftrightarrow> - p \<bullet> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1195
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1196
  assume "a \<sharp> p \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1197
  then have "- p \<bullet> a \<sharp> - p \<bullet> p \<bullet> x" by (simp only: fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1198
  then show "- p \<bullet> a \<sharp> x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1199
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1200
  assume "- p \<bullet> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1201
  then have "p \<bullet> - p \<bullet> a \<sharp> p \<bullet> x" by (simp only: fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1202
  then show "a \<sharp> p \<bullet> x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1203
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1204
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1205
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1206
section {* supports *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1207
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1208
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1209
  supports :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" (infixl "supports" 80)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1210
where  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1211
  "S supports x \<equiv> \<forall>a b. (a \<notin> S \<and> b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1212
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1213
lemma supp_is_subset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1214
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1215
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1216
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1217
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1218
  shows "(supp x) \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1219
proof (rule ccontr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1220
  assume "\<not> (supp x \<subseteq> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1221
  then obtain a where b1: "a \<in> supp x" and b2: "a \<notin> S" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1222
  from a1 b2 have "\<forall>b. b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x" unfolding supports_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1223
  then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1224
  with a2 have "finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}" by (simp add: finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1225
  then have "a \<notin> (supp x)" unfolding supp_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1226
  with b1 show False by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1227
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1228
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1229
lemma supports_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1230
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1231
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1232
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1233
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1234
  shows "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1235
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1236
  have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1237
  then show "finite (supp x)" using a2 by (simp add: finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1238
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1239
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1240
lemma supp_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1241
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1242
  shows "(supp x) supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1243
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1244
proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1245
  fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1246
  assume "a \<notin> (supp x) \<and> b \<notin> (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1247
  then have "a \<sharp> x" and "b \<sharp> x" by (simp_all add: fresh_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1248
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1249
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1250
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1251
lemma supports_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1252
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1253
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1254
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1255
  and     a3: "a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1256
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1257
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1258
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1259
  have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1260
  then show "a \<notin> (supp x)" using a3 by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1261
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1262
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1263
lemma supp_is_least_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1264
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1265
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1266
  assumes  a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1267
  and      a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1268
  and      a3: "\<And>S'. finite S' \<Longrightarrow> (S' supports x) \<Longrightarrow> S \<subseteq> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1269
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1270
proof (rule equalityI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1271
  show "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1272
  with a2 have fin: "finite (supp x)" by (rule rev_finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1273
  have "(supp x) supports x" by (rule supp_supports)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1274
  with fin a3 show "S \<subseteq> supp x" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1275
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1276
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1277
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1278
lemma subsetCI: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1279
  shows "(\<And>x. x \<in> A \<Longrightarrow> x \<notin> B \<Longrightarrow> False) \<Longrightarrow> A \<subseteq> B"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1280
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1281
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1282
lemma finite_supp_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1283
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1284
  assumes a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1285
  assumes a3: "\<And>a b. \<lbrakk>a \<in> S; b \<notin> S; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1286
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1287
  using a1 a2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1288
proof (rule supp_is_least_supports)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1289
  fix S'
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1290
  assume "finite S'" and "S' supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1291
  show "S \<subseteq> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1292
  proof (rule subsetCI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1293
    fix a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1294
    assume "a \<in> S" and "a \<notin> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1295
    have "finite (S \<union> S')"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1296
      using `finite S` `finite S'` by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1297
    then obtain b where "b \<notin> S \<union> S'" and "sort_of b = sort_of a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1298
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1299
    then have "b \<notin> S" and "b \<notin> S'"  and "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1300
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1301
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1302
      using `a \<notin> S'` `S' supports x` by (simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1303
    moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1304
      using `a \<in> S` `b \<notin> S` `sort_of a = sort_of b`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1305
      by (rule a3)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1306
    ultimately show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1307
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1308
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1309
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1310
section {* Support w.r.t. relations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1311
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1312
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1313
  This definition is used for unquotient types, where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1314
  alpha-equivalence does not coincide with equality.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1315
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1316
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1317
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1318
  "supp_rel R x = {a. infinite {b. \<not>(R ((a \<rightleftharpoons> b) \<bullet> x) x)}}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1319
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1320
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1321
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1322
section {* Finitely-supported types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1323
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1324
class fs = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1325
  assumes finite_supp: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1326
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1327
lemma pure_supp: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1328
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1329
  shows "supp x = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1330
  unfolding supp_def by (simp add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1331
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1332
lemma pure_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1333
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1334
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1335
  unfolding fresh_def by (simp add: pure_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1336
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1337
instance pure < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1338
by default (simp add: pure_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1339
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1340
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1341
subsection  {* Type @{typ atom} is finitely-supported. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1342
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1343
lemma supp_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1344
  shows "supp a = {a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1345
  by (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1346
     (auto simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1347
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1348
lemma fresh_atom: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1349
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1350
  unfolding fresh_def supp_atom by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1351
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1352
instance atom :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1353
by default (simp add: supp_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1354
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1355
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1356
section {* Type @{typ perm} is finitely-supported. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1357
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1358
lemma perm_swap_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1359
  shows "(a \<rightleftharpoons> b) \<bullet> p = p \<longleftrightarrow> (p \<bullet> (a \<rightleftharpoons> b)) = (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1360
unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1361
by (metis add_diff_cancel minus_perm_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1362
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1363
lemma supports_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1364
  shows "{a. p \<bullet> a \<noteq> a} supports p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1365
  unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1366
  unfolding perm_swap_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1367
  by (simp add: swap_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1368
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1369
lemma finite_perm_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1370
  shows "finite {a::atom. p \<bullet> a \<noteq> a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1371
  unfolding permute_atom_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1372
  using finite_gpermute_neq .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1373
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1374
lemma supp_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1375
  shows "supp p = {a. p \<bullet> a \<noteq> a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1376
apply (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1377
apply (simp_all add: perm_swap_eq swap_eqvt supports_perm finite_perm_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1378
apply (auto simp add: perm_eq_iff swap_atom perm_swap_eq swap_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1379
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1380
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1381
lemma fresh_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1382
  shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1383
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1384
  by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1385
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1386
lemma supp_swap:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1387
  shows "supp (a \<rightleftharpoons> b) = (if a = b \<or> sort_of a \<noteq> sort_of b then {} else {a, b})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1388
  by (auto simp add: supp_perm swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1389
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1390
lemma fresh_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1391
  shows "a \<sharp> (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1392
  unfolding fresh_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1393
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1394
lemma supp_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1395
  shows "supp (0::perm) = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1396
  unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1397
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1398
lemma fresh_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1399
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1400
  assumes "a \<sharp> p" "a \<sharp> q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1401
  shows "a \<sharp> (p + q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1402
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1403
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1404
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1405
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1406
lemma supp_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1407
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1408
  shows "supp (p + q) \<subseteq> supp p \<union> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1409
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1410
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1411
lemma fresh_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1412
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1413
  shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1414
  unfolding fresh_def supp_perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1415
  by (simp) (metis permute_minus_cancel(1))
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1416
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1417
lemma supp_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1418
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1419
  shows "supp (- p) = supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1420
  unfolding supp_conv_fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1421
  by (simp add: fresh_minus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1422
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1423
lemma plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1424
  fixes p q::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1425
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1426
  shows "p + q = q + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1427
unfolding perm_eq_iff
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1428
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1429
  fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1430
  show "(p + q) \<bullet> a = (q + p) \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1431
  proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1432
    { assume "a \<notin> supp p" "a \<notin> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1433
      then have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1434
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1435
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1436
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1437
    { assume a: "a \<in> supp p" "a \<notin> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1438
      then have "p \<bullet> a \<in> supp p" by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1439
      then have "p \<bullet> a \<notin> supp q" using asm by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1440
      with a have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1441
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1442
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1443
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1444
    { assume a: "a \<notin> supp p" "a \<in> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1445
      then have "q \<bullet> a \<in> supp q" by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1446
      then have "q \<bullet> a \<notin> supp p" using asm by auto 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1447
      with a have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1448
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1449
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1450
    ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1451
      using asm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1452
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1453
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1454
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1455
lemma supp_plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1456
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1457
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1458
  shows "supp (p + q) = supp p \<union> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1459
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1460
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1461
    assume "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1462
    then have "a \<notin> supp q" using asm by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1463
    then have "a \<in> supp (p + q)" using `a \<in> supp p` 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1464
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1465
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1466
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1467
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1468
    assume "a \<in> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1469
    then have "a \<notin> supp p" using asm by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1470
    then have "a \<in> supp (q + p)" using `a \<in> supp q` 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1471
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1472
    then have "a \<in> supp (p + q)" using asm plus_perm_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1473
      by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1474
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1475
  ultimately have "supp p \<union> supp q \<subseteq> supp (p + q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1476
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1477
  then show "supp (p + q) = supp p \<union> supp q" using supp_plus_perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1478
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1479
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1480
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1481
instance perm :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1482
by default (simp add: supp_perm finite_perm_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1483
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1484
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1485
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1486
section {* Finite Support instances for other types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1487
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1488
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1489
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1490
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1491
lemma supp_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1492
  shows "supp (x, y) = supp x \<union> supp y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1493
  by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1494
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1495
lemma fresh_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1496
  shows "a \<sharp> (x, y) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1497
  by (simp add: fresh_def supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1498
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1499
lemma supp_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1500
  shows "supp () = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1501
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1502
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1503
lemma fresh_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1504
  shows "a \<sharp> ()"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1505
  by (simp add: fresh_def supp_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1506
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1507
instance prod :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1508
  by default (auto simp add: supp_Pair finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1509
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1510
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1511
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1512
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1513
lemma supp_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1514
  shows "supp (Inl x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1515
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1516
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1517
lemma supp_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1518
  shows "supp (Inr x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1519
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1520
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1521
lemma fresh_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1522
  shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1523
  by (simp add: fresh_def supp_Inl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1524
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1525
lemma fresh_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1526
  shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1527
  by (simp add: fresh_def supp_Inr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1528
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1529
instance sum :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1530
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1531
apply (case_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1532
apply (simp_all add: supp_Inl supp_Inr finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1533
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1534
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1535
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1536
subsection {* Type @{typ "'a option"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1537
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1538
lemma supp_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1539
  shows "supp None = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1540
by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1541
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1542
lemma supp_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1543
  shows "supp (Some x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1544
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1545
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1546
lemma fresh_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1547
  shows "a \<sharp> None"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1548
  by (simp add: fresh_def supp_None)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1549
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1550
lemma fresh_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1551
  shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1552
  by (simp add: fresh_def supp_Some)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1553
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1554
instance option :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1555
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1556
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1557
apply (simp_all add: supp_None supp_Some finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1558
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1559
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1560
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1561
subsubsection {* Type @{typ "'a list"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1562
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1563
lemma supp_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1564
  shows "supp [] = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1565
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1566
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1567
lemma fresh_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1568
  shows "a \<sharp> []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1569
  by (simp add: fresh_def supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1570
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1571
lemma supp_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1572
  shows "supp (x # xs) = supp x \<union> supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1573
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1574
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1575
lemma fresh_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1576
  shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1577
  by (simp add: fresh_def supp_Cons)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1578
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1579
lemma supp_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1580
  shows "supp (xs @ ys) = supp xs \<union> supp ys"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1581
  by (induct xs) (auto simp add: supp_Nil supp_Cons)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1582
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1583
lemma fresh_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1584
  shows "a \<sharp> (xs @ ys) \<longleftrightarrow> a \<sharp> xs \<and> a \<sharp> ys"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1585
  by (induct xs) (simp_all add: fresh_Nil fresh_Cons)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1586
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1587
lemma supp_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1588
  shows "supp (rev xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1589
  by (induct xs) (auto simp add: supp_append supp_Cons supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1590
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1591
lemma fresh_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1592
  shows "a \<sharp> rev xs \<longleftrightarrow> a \<sharp> xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1593
  by (induct xs) (auto simp add: fresh_append fresh_Cons fresh_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1594
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1595
lemma supp_removeAll:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1596
  fixes x::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1597
  shows "supp (removeAll x xs) = supp xs - {x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1598
  by (induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1599
     (auto simp add: supp_Nil supp_Cons supp_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1600
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1601
lemma supp_of_atom_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1602
  fixes as::"atom list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1603
  shows "supp as = set as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1604
by (induct as)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1605
   (simp_all add: supp_Nil supp_Cons supp_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1606
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1607
instance list :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1608
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1609
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1610
apply (simp_all add: supp_Nil supp_Cons finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1611
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1612
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1613
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1614
section {* Support and Freshness for Applications *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1615
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1616
lemma fresh_conv_MOST: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1617
  shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1618
  unfolding fresh_def supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1619
  unfolding MOST_iff_cofinite by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1620
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1621
lemma fresh_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1622
  assumes "a \<sharp> f" and "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1623
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1624
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1625
  unfolding fresh_conv_MOST
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1626
  unfolding permute_fun_app_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1627
  by (elim MOST_rev_mp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1628
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1629
lemma supp_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1630
  shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1631
  using fresh_fun_app
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1632
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1633
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1634
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1635
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1636
subsection {* Equivariance Predicate @{text eqvt} and @{text eqvt_at}*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1637
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1638
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1639
  "eqvt f \<equiv> \<forall>p. p \<bullet> f = f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1640
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1641
lemma eqvt_boolI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1642
  fixes f::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1643
  shows "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1644
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1645
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1646
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1647
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1648
text {* equivariance of a function at a given argument *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1649
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1650
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1651
 "eqvt_at f x \<equiv> \<forall>p. p \<bullet> (f x) = f (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1652
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1653
lemma eqvtI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1654
  shows "(\<And>p. p \<bullet> f \<equiv> f) \<Longrightarrow> eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1655
unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1656
by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1657
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1658
lemma eqvt_at_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1659
  assumes "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1660
  shows "eqvt_at f (q \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1661
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1662
  { fix p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1663
    have "p \<bullet> (f (q \<bullet> x)) = p \<bullet> q \<bullet> (f x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1664
      using assms by (simp add: eqvt_at_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1665
    also have "\<dots> = (p + q) \<bullet> (f x)" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1666
    also have "\<dots> = f ((p + q) \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1667
      using assms by (simp add: eqvt_at_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1668
    finally have "p \<bullet> (f (q \<bullet> x)) = f (p \<bullet> q \<bullet> x)" by simp } 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1669
  then show "eqvt_at f (q \<bullet> x)" unfolding eqvt_at_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1670
    by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1671
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1672
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1673
lemma supp_fun_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1674
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1675
  shows "supp f = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1676
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1677
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1678
  unfolding supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1679
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1680
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1681
lemma fresh_fun_eqvt_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1682
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1683
  shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1684
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1685
  from a have "supp f = {}" by (simp add: supp_fun_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1686
  then show "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1687
    unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1688
    using supp_fun_app by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1689
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1690
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1691
lemma supp_fun_app_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1692
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1693
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1694
  using fresh_fun_eqvt_app[OF a]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1695
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1696
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1697
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1698
lemma supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1699
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1700
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1701
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1702
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1703
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1704
unfolding fresh_def[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1705
using asm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1706
apply(simp add: eqvt_at_def swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1707
apply(rule fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1708
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1709
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1710
lemma finite_supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1711
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1712
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1713
  shows "finite (supp (f x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1714
apply(rule finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1715
apply(rule supp_eqvt_at[OF asm fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1716
apply(rule fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1717
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1718
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1719
lemma fresh_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1720
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1721
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1722
  and     fresh: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1723
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1724
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1725
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1726
using supp_eqvt_at[OF asm fin]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1727
by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1728
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1729
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1730
subsection {* helper functions for nominal_functions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1731
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1732
lemma THE_defaultI2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1733
  assumes "\<exists>!x. P x" "\<And>x. P x \<Longrightarrow> Q x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1734
  shows "Q (THE_default d P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1735
by (iprover intro: assms THE_defaultI')
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1736
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1737
lemma the_default_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1738
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1739
  shows "(p \<bullet> (THE_default d P)) = (THE_default (p \<bullet> d) (p \<bullet> P))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1740
  apply(rule THE_default1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1741
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1742
  apply(simp add: ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1743
  apply(rule unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1744
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1745
  apply(rule subst[OF permute_fun_app_eq])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1746
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1747
  apply(rule THE_defaultI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1748
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1749
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1750
lemma fundef_ex1_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1751
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1752
  assumes f_def: "f == (\<lambda>x::'a. THE_default (d x) (G x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1753
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1754
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1755
  shows "(p \<bullet> (f x)) = f (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1756
  apply(simp only: f_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1757
  apply(subst the_default_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1758
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1759
  apply(rule THE_default1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1760
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1761
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1762
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1763
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1764
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1765
  apply(rule THE_defaultI2) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1766
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1767
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1768
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1769
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1770
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1771
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1772
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1773
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1774
lemma fundef_ex1_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1775
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1776
  assumes f_def: "f == (\<lambda>x::'a. THE_default (d x) (G x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1777
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1778
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1779
  shows "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1780
  unfolding eqvt_at_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1781
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1782
  by (auto intro: fundef_ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1783
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1784
lemma fundef_ex1_prop:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1785
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1786
  assumes f_def: "f \<equiv> (\<lambda>x::'a. THE_default (d x) (G x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1787
  assumes P_all: "\<And>x y. G x y \<Longrightarrow> P x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1788
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1789
  shows "P x (f x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1790
  unfolding f_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1791
  using ex1
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1792
  apply(erule_tac ex1E)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1793
  apply(rule THE_defaultI2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1794
  apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1795
  apply(rule P_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1796
  apply(assumption)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1797
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1798
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1799
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1800
section {* Support of Finite Sets of Finitely Supported Elements *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1801
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1802
text {* support and freshness for atom sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1803
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1804
lemma supp_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1805
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1806
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1807
  shows "supp S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1808
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1809
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1810
  apply(simp add: swap_set_not_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1811
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1812
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1813
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1814
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1815
lemma supp_cofinite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1816
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1817
  assumes "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1818
  shows "supp S = (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1819
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1820
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1821
  apply(simp add: swap_set_both_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1822
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1823
  apply(subst swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1824
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1825
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1826
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1827
lemma fresh_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1828
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1829
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1830
  shows "a \<sharp> S \<longleftrightarrow> a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1831
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1832
  by (simp add: supp_finite_atom_set[OF assms])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1833
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1834
lemma fresh_minus_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1835
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1836
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1837
  shows "a \<sharp> S - T \<longleftrightarrow> (a \<notin> T \<longrightarrow> a \<sharp> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1838
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1839
  by (auto simp add: supp_finite_atom_set assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1840
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1841
lemma Union_supports_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1842
  shows "(\<Union>x \<in> S. supp x) supports S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1843
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1844
  { fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1845
    have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1846
      unfolding permute_set_def by force
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1847
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1848
  then show "(\<Union>x \<in> S. supp x) supports S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1849
    unfolding supports_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1850
    by (simp add: fresh_def[symmetric] swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1851
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1852
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1853
lemma Union_of_finite_supp_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1854
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1855
  assumes fin: "finite S"   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1856
  shows "finite (\<Union>x\<in>S. supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1857
  using fin by (induct) (auto simp add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1858
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1859
lemma Union_included_in_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1860
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1861
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1862
  shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1863
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1864
  have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1865
    unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1866
    by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1867
  have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1868
    by (rule supp_finite_atom_set[symmetric]) (rule Union_of_finite_supp_sets[OF fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1869
  also have "\<dots> = supp ((\<lambda>S. \<Union> supp ` S) S)" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1870
  also have "\<dots> \<subseteq> supp S" using eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1871
    by (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1872
  finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1873
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1874
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1875
lemma supp_of_finite_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1876
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1877
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1878
  shows "(supp S) = (\<Union>x\<in>S. supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1879
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1880
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1881
apply(rule Union_supports_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1882
apply(rule Union_of_finite_supp_sets[OF fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1883
apply(rule Union_included_in_supp[OF fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1884
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1885
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1886
lemma finite_sets_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1887
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1888
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1889
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1890
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1891
by (simp only: supp_of_finite_sets Union_of_finite_supp_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1892
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1893
lemma supp_of_finite_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1894
  fixes S T::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1895
  assumes fin1: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1896
  and     fin2: "finite T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1897
  shows "supp (S \<union> T) = supp S \<union> supp T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1898
  using fin1 fin2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1899
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1900
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1901
lemma supp_of_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1902
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1903
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1904
  shows "supp (insert x S) = supp x \<union> supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1905
  using fin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1906
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1907
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1908
lemma fresh_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1909
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1910
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1911
  shows "a \<sharp> (insert x S) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1912
  using fin unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1913
  by (simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1914
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1915
lemma supp_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1916
  shows "supp {} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1917
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1918
  by (simp add: empty_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1919
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1920
lemma fresh_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1921
  shows "a \<sharp> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1922
  by (simp add: fresh_def supp_set_empty)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1923
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1924
lemma supp_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1925
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1926
  shows "supp (set xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1927
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1928
apply(simp add: supp_set_empty supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1929
apply(simp add: supp_Cons supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1930
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1931
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1932
lemma fresh_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1933
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1934
  shows "a \<sharp> (set xs) \<longleftrightarrow> a \<sharp> xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1935
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1936
by (simp add: supp_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1937
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1938
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1939
subsection {* Type @{typ "'a multiset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1940
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1941
lemma set_of_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1942
  shows "p \<bullet> (set_of M) = set_of (p \<bullet> M)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1943
by (induct M) (simp_all add: insert_eqvt empty_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1944
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1945
lemma supp_set_of:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1946
  shows "supp (set_of M) \<subseteq> supp M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1947
  apply (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1948
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1949
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1950
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1951
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1952
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1953
lemma Union_finite_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1954
  fixes M::"'a::fs multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1955
  shows "finite (\<Union>{supp x | x. x \<in># M})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1956
proof - 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1957
  have "finite (\<Union>(supp ` {x. x \<in># M}))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1958
    by (induct M) (simp_all add: Collect_imp_eq Collect_neg_eq finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1959
  then show "finite (\<Union>{supp x | x. x \<in># M})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1960
    by (simp only: image_Collect)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1961
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1962
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1963
lemma Union_supports_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1964
  shows "\<Union>{supp x | x. x :# M} supports M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1965
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1966
  have sw: "\<And>a b. ((\<And>x. x :# M \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x) \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> M = M)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1967
    unfolding permute_multiset_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1968
    apply(induct M)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1969
    apply(simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1970
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1971
  show "(\<Union>{supp x | x. x :# M}) supports M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1972
    unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1973
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1974
    apply(rule sw)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1975
    apply(rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1976
    apply(simp_all only: fresh_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1977
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1978
    apply(metis neq0_conv)+
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1979
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1980
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1981
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1982
lemma Union_included_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1983
  fixes M::"('a::fs multiset)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1984
  shows "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1985
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1986
  have "(\<Union>{supp x | x. x \<in># M}) = (\<Union>{supp x | x. x \<in> set_of M})" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1987
  also have "... \<subseteq> (\<Union>x \<in> set_of M. supp x)" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1988
  also have "... = supp (set_of M)" by (simp add: subst supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1989
  also have " ... \<subseteq> supp M" by (rule supp_set_of)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1990
  finally show "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M" .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1991
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1992
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1993
lemma supp_of_multisets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1994
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1995
  shows "(supp M) = (\<Union>{supp x | x. x :# M})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1996
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1997
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1998
apply(rule Union_supports_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1999
apply(rule Union_finite_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2000
apply(rule Union_included_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2001
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2002
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2003
lemma multisets_supp_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2004
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2005
  shows "finite (supp M)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2006
by (simp only: supp_of_multisets Union_finite_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2007
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2008
lemma supp_of_multiset_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2009
  fixes M N::"('a::fs) multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2010
  shows "supp (M + N) = supp M \<union> supp N"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2011
  by (auto simp add: supp_of_multisets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2012
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2013
lemma supp_empty_mset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2014
  shows "supp {#} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2015
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2016
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2017
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2018
instance multiset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2019
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2020
  apply (rule multisets_supp_finite)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2021
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2022
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2023
subsection {* Type @{typ "'a fset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2024
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2025
lemma supp_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2026
  shows "supp (fset S) = supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2027
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2028
  by (simp add: fset_eqvt fset_cong)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2029
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2030
lemma supp_empty_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2031
  shows "supp {||} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2032
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2033
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2034
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2035
lemma fresh_empty_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2036
  shows "a \<sharp> {||}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2037
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2038
by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2039
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2040
lemma supp_insert_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2041
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2042
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2043
  shows "supp (insert_fset x S) = supp x \<union> supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2044
  apply(subst supp_fset[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2045
  apply(simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2046
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2047
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2048
lemma fresh_insert_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2049
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2050
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2051
  shows "a \<sharp> insert_fset x S \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2052
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2053
  by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2054
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2055
lemma fset_finite_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2056
  fixes S::"('a::fs) fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2057
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2058
  by (induct S) (simp_all add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2059
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2060
lemma supp_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2061
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2062
  shows "supp (S |\<union>| T) = supp S \<union> supp T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2063
by (induct S) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2064
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2065
lemma fresh_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2066
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2067
  shows "a \<sharp> S |\<union>| T \<longleftrightarrow> a \<sharp> S \<and> a \<sharp> T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2068
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2069
by (simp add: supp_union_fset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2070
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2071
instance fset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2072
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2073
  apply (rule fset_finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2074
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2075
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2076
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2077
section {* Freshness and Fresh-Star *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2078
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2079
lemma fresh_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2080
  shows "(a \<sharp> () \<Longrightarrow> PROP C) \<equiv> PROP C"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2081
  by (simp add: fresh_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2082
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2083
lemma fresh_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2084
  shows "(a \<sharp> (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> a \<sharp> y \<Longrightarrow> PROP C)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2085
  by rule (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2086
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2087
(* this rule needs to be added before the fresh_prodD is *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2088
(* added to the simplifier with mksimps                  *) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2089
lemma [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2090
  shows "a \<sharp> x1 \<Longrightarrow> a \<sharp> x2 \<Longrightarrow> a \<sharp> (x1, x2)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2091
  by (simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2092
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2093
lemma fresh_PairD:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2094
  shows "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2095
  and   "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2096
  by (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2097
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2098
declaration {* fn _ =>
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2099
let
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2100
  val mksimps_pairs = (@{const_name Nominal2_Base.fresh}, @{thms fresh_PairD}) :: mksimps_pairs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2101
in
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2102
  Simplifier.map_ss (fn ss => Simplifier.set_mksimps (mksimps mksimps_pairs) ss)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2103
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2104
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2105
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2106
text {* The fresh-star generalisation of fresh is used in strong
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2107
  induction principles. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2108
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2109
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2110
  fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2111
where 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2112
  "as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2113
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2114
lemma fresh_star_supp_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2115
  shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2116
by (auto simp add: fresh_star_def fresh_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2117
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2118
lemma fresh_star_perm_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2119
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2120
  assumes fresh: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2121
  and     fin: "finite as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2122
  shows "supp p \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2123
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2124
apply(simp add: supp_finite_atom_set fin fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2125
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2126
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2127
lemma fresh_star_atom_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2128
  assumes fresh: "as \<sharp>* bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2129
  and     fin: "finite as" "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2130
  shows "bs \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2131
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2132
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2133
by (auto simp add: supp_finite_atom_set fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2134
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2135
lemma atom_fresh_star_disjoint:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2136
  assumes fin: "finite bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2137
  shows "as \<sharp>* bs \<longleftrightarrow> (as \<inter> bs = {})"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2138
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2139
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2140
by (auto simp add: supp_finite_atom_set fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2141
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2142
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2143
lemma fresh_star_Pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2144
  shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2145
  by (auto simp add: fresh_star_def fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2146
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2147
lemma fresh_star_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2148
  shows "as \<sharp>* (xs @ ys) \<longleftrightarrow> as \<sharp>* xs \<and> as \<sharp>* ys"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2149
  and   "as \<sharp>* (x # xs) \<longleftrightarrow> as \<sharp>* x \<and> as \<sharp>* xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2150
  and   "as \<sharp>* []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2151
by (auto simp add: fresh_star_def fresh_Nil fresh_Cons fresh_append)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2152
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2153
lemma fresh_star_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2154
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2155
  shows "as \<sharp>* set xs \<longleftrightarrow> as \<sharp>* xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2156
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2157
by (simp add: fresh_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2158
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2159
lemma fresh_star_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2160
  fixes a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2161
  shows "as \<sharp>* {a} \<longleftrightarrow> as \<sharp>* a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2162
  by (simp add: fresh_star_def fresh_finite_insert fresh_set_empty)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2163
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2164
lemma fresh_star_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2165
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2166
  shows "as \<sharp>* fset S \<longleftrightarrow> as \<sharp>* S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2167
by (simp add: fresh_star_def fresh_def) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2168
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2169
lemma fresh_star_Un:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2170
  shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2171
  by (auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2172
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2173
lemma fresh_star_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2174
  shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2175
  by (auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2176
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2177
lemma fresh_star_Un_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2178
  "((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2179
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2180
  apply(rule)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2181
  apply(erule meta_mp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2182
  apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2183
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2184
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2185
lemma fresh_star_insert_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2186
  "(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2187
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2188
  by rule (simp_all add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2189
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2190
lemma fresh_star_empty_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2191
  "({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2192
  by (simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2193
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2194
lemma fresh_star_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2195
  shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2196
  by (simp add: fresh_star_def fresh_Unit) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2197
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2198
lemma fresh_star_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2199
  shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2200
  by (rule, simp_all add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2201
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2202
lemma fresh_star_zero:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2203
  shows "as \<sharp>* (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2204
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2205
  by (simp add: fresh_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2206
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2207
lemma fresh_star_plus:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2208
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2209
  shows "\<lbrakk>a \<sharp>* p;  a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2210
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2211
  by (simp add: fresh_plus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2212
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2213
lemma fresh_star_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2214
  shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2215
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2216
  by (metis mem_permute_iff permute_minus_cancel(1) fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2217
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2218
lemma fresh_star_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2219
  shows "p \<bullet> (as \<sharp>* x) \<longleftrightarrow> (p \<bullet> as) \<sharp>* (p \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2220
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2221
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2222
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2223
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2224
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2225
section {* Induction principle for permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2226
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2227
lemma smaller_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2228
  assumes a: "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2229
  shows "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subset> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2230
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2231
  have "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subseteq> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2232
    unfolding supp_perm by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2233
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2234
  have "a \<notin> supp ((p \<bullet> a \<rightleftharpoons> a) + p)" by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2235
  then have "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<noteq> supp p" using a by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2236
  ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2237
  show "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subset> supp p" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2238
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2239
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2240
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2241
lemma perm_struct_induct[consumes 1, case_names zero swap]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2242
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2243
  and zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2244
  and swap: "\<And>p a b. \<lbrakk>P p; supp p \<subseteq> S; a \<in> S; b \<in> S; a \<noteq> b; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2245
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2246
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2247
  have "finite (supp p)" by (simp add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2248
  then show "P p" using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2249
  proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2250
    case (psubset p)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2251
    then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2252
    have as: "supp p \<subseteq> S" by fact
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2253
    { assume "supp p = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2254
      then have "p = 0" by (simp add: supp_perm perm_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2255
      then have "P p" using zero by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2256
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2257
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2258
    { assume "supp p \<noteq> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2259
      then obtain a where a0: "a \<in> supp p" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2260
      then have a1: "p \<bullet> a \<in> S" "a \<in> S" "sort_of (p \<bullet> a) = sort_of a" "p \<bullet> a \<noteq> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2261
        using as by (auto simp add: supp_atom supp_perm swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2262
      let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2263
      have a2: "supp ?q \<subset> supp p" using a0 smaller_supp by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2264
      then have "P ?q" using ih by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2265
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2266
      have "supp ?q \<subseteq> S" using as a2 by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2267
      ultimately  have "P ((p \<bullet> a \<rightleftharpoons> a) + ?q)" using as a1 swap by simp 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2268
      moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2269
      have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: perm_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2270
      ultimately have "P p" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2271
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2272
    ultimately show "P p" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2273
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2274
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2275
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2276
lemma perm_simple_struct_induct[case_names zero swap]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2277
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2278
  and     swap: "\<And>p a b. \<lbrakk>P p; a \<noteq> b; sort_of a = sort_of b\<rbrakk> \<Longrightarrow> P ((a \<rightleftharpoons> b) + p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2279
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2280
by (rule_tac S="supp p" in perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2281
   (auto intro: zero swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2282
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2283
lemma perm_struct_induct2[consumes 1, case_names zero swap plus]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2284
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2285
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2286
  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b; a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2287
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2288
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2289
using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2290
by (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2291
   (auto intro: zero plus swap simp add: supp_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2292
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2293
lemma perm_simple_struct_induct2[case_names zero swap plus]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2294
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2295
  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2296
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2297
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2298
by (rule_tac S="supp p" in perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2299
   (auto intro: zero swap plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2300
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2301
lemma supp_perm_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2302
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2303
  shows "supp p \<subseteq> {b} \<longleftrightarrow> p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2304
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2305
  { assume "supp p \<subseteq> {b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2306
    then have "p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2307
      by (induct p rule: perm_struct_induct) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2308
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2309
  then show "supp p \<subseteq> {b} \<longleftrightarrow> p = 0" by (auto simp add: supp_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2310
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2311
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2312
lemma supp_perm_pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2313
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2314
  shows "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2315
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2316
  { assume "supp p \<subseteq> {a, b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2317
    then have "p = 0 \<or> p = (b \<rightleftharpoons> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2318
      apply (induct p rule: perm_struct_induct) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2319
      apply (auto simp add: swap_cancel supp_zero_perm supp_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2320
      apply (simp add: swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2321
      done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2322
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2323
  then show "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2324
    by (auto simp add: supp_zero_perm supp_swap split: if_splits)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2325
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2326
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2327
lemma supp_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2328
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2329
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2330
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2331
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2332
    unfolding supp_perm fresh_star_def fresh_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2333
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2334
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2335
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2336
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2337
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2338
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2339
    then have "a \<sharp> x" "b \<sharp> x" "p \<bullet> x = x" by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2340
    then show "((a \<rightleftharpoons> b) + p) \<bullet> x = x" by (simp add: swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2341
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2342
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2343
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2344
text {* same lemma as above, but proved with a different induction principle *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2345
lemma supp_perm_eq_test:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2346
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2347
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2348
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2349
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2350
    unfolding supp_perm fresh_star_def fresh_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2351
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2352
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2353
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2354
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2355
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2356
    case (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2357
    then have "a \<sharp> x" "b \<sharp> x" by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2358
    then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2359
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2360
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2361
    have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2362
    then show "(p1 + p2) \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2363
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2364
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2365
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2366
lemma perm_supp_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2367
  assumes a: "(supp p) \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2368
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2369
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2370
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2371
    unfolding supp_perm fresh_star_def fresh_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2372
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2373
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2374
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2375
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2376
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2377
    case (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2378
    then have "a \<sharp> x" "b \<sharp> x" by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2379
    then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2380
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2381
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2382
    have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2383
    then show "(p1 + p2) \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2384
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2385
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2386
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2387
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2388
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2389
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2390
lemma supp_perm_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2391
  assumes a: "\<forall>a \<in> supp x. p \<bullet> a = q \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2392
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2393
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2394
  from a have "\<forall>a \<in> supp x. (-q + p) \<bullet> a = a" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2395
  then have "\<forall>a \<in> supp x. a \<notin> supp (-q + p)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2396
    unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2397
  then have "supp x \<sharp>* (-q + p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2398
    unfolding fresh_star_def fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2399
  then have "(-q + p) \<bullet> x = x" by (simp only: supp_perm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2400
  then show "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2401
    by (metis permute_minus_cancel(1) permute_plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2402
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2403
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2404
text {* disagreement set *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2405
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2406
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2407
  dset :: "perm \<Rightarrow> perm \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2408
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2409
  "dset p q = {a::atom. p \<bullet> a \<noteq> q \<bullet> a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2410
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2411
lemma ds_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2412
  assumes "dset p q \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2413
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2414
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2415
unfolding dset_def fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2416
by (auto intro: supp_perm_perm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2417
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2418
lemma atom_set_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2419
  assumes a: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2420
  shows "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2421
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2422
  from a have "supp p \<subseteq> {a. a \<notin> as}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2423
    unfolding supp_perm fresh_star_def fresh_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2424
  then show "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2425
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2426
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2427
    show "0 \<bullet> as = as" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2428
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2429
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2430
    then have "a \<notin> as" "b \<notin> as" "p \<bullet> as = as" by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2431
    then show "((a \<rightleftharpoons> b) + p) \<bullet> as = as" by (simp add: swap_set_not_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2432
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2433
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2434
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2435
section {* Avoiding of atom sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2436
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2437
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2438
  For every set of atoms, there is another set of atoms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2439
  avoiding a finitely supported c and there is a permutation
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2440
  which 'translates' between both sets.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2441
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2442
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2443
lemma at_set_avoiding_aux:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2444
  fixes Xs::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2445
  and   As::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2446
  assumes b: "Xs \<subseteq> As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2447
  and     c: "finite As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2448
  shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) = (Xs \<union> (p \<bullet> Xs))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2449
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2450
  from b c have "finite Xs" by (rule finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2451
  then show ?thesis using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2452
  proof (induct rule: finite_subset_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2453
    case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2454
    have "0 \<bullet> {} \<inter> As = {}" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2455
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2456
    have "supp (0::perm) = {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2457
    ultimately show ?case by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2458
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2459
    case (insert x Xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2460
    then obtain p where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2461
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2462
      p2: "supp p = (Xs \<union> (p \<bullet> Xs))" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2463
    from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2464
    with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2465
    hence px: "p \<bullet> x = x" unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2466
    have "finite (As \<union> p \<bullet> Xs \<union> supp p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2467
      using `finite As` `finite Xs`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2468
      by (simp add: permute_set_eq_image finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2469
    then obtain y where "y \<notin> (As \<union> p \<bullet> Xs \<union> supp p)" "sort_of y = sort_of x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2470
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2471
    hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "y \<notin> supp p" "sort_of y = sort_of x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2472
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2473
    hence py: "p \<bullet> y = y" "x \<noteq> y" using `x \<in> As`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2474
      by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2475
    let ?q = "(x \<rightleftharpoons> y) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2476
    have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2477
      unfolding insert_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2478
      using `p \<bullet> x = x` `sort_of y = sort_of x`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2479
      using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2480
      by (simp add: swap_atom swap_set_not_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2481
    have "?q \<bullet> insert x Xs \<inter> As = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2482
      using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2483
      unfolding q by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2484
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2485
    have "supp (x \<rightleftharpoons> y) \<inter> supp p = {}" using px py `sort_of y = sort_of x`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2486
      unfolding supp_swap by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2487
    then have "supp ?q = (supp (x \<rightleftharpoons> y) \<union> supp p)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2488
      by (simp add: supp_plus_perm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2489
    then have "supp ?q = insert x Xs \<union> ?q \<bullet> insert x Xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2490
      using p2 `sort_of y = sort_of x` `x \<noteq> y` unfolding q supp_swap
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2491
      by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2492
    ultimately show ?case by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2493
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2494
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2495
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2496
lemma at_set_avoiding:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2497
  assumes a: "finite Xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2498
  and     b: "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2499
  obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) = (Xs \<union> (p \<bullet> Xs))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2500
  using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2501
  unfolding fresh_star_def fresh_def by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2502
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2503
lemma at_set_avoiding1:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2504
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2505
  and     "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2506
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2507
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2508
apply(erule_tac c="c" in at_set_avoiding)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2509
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2510
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2511
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2512
lemma at_set_avoiding2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2513
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2514
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2515
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2516
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2517
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2518
apply(erule_tac c="(c, x)" in at_set_avoiding)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2519
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2520
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2521
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2522
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2523
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2524
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2525
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2526
lemma at_set_avoiding3:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2527
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2528
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2529
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2530
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p = xs \<union> (p \<bullet> xs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2531
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2532
apply(erule_tac c="(c, x)" in at_set_avoiding)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2533
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2534
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2535
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2536
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2537
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2538
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2539
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2540
lemma at_set_avoiding2_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2541
  assumes "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2542
  and     b: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2543
  shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2544
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2545
  have a: "{a} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2546
  obtain p where p1: "(p \<bullet> {a}) \<sharp>* c" and p2: "supp x \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2547
    using at_set_avoiding2[of "{a}" "c" "x"] assms a by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2548
  have c: "(p \<bullet> a) \<sharp> c" using p1
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2549
    unfolding fresh_star_def Ball_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2550
    by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2551
  hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2552
  then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2553
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2554
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2555
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2556
section {* Renaming permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2557
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2558
lemma set_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2559
  assumes b: "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2560
  shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2561
using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2562
proof (induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2563
  case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2564
  have "(\<forall>b \<in> {}. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> {} \<union> p \<bullet> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2565
    by (simp add: permute_set_def supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2566
  then show "\<exists>q. (\<forall>b \<in> {}. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> {} \<union> p \<bullet> {}" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2567
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2568
  case (insert a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2569
  then have " \<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> p \<bullet> bs" by simp 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2570
  then obtain q where *: "\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> bs \<union> p \<bullet> bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2571
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2572
  { assume 1: "q \<bullet> a = p \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2573
    have "\<forall>b \<in> (insert a bs). q \<bullet> b = p \<bullet> b" using 1 * by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2574
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2575
    have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2576
      using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2577
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2578
    have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2579
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2580
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2581
  { assume 2: "q \<bullet> a \<noteq> p \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2582
    def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2583
    have "\<forall>b \<in> insert a bs. q' \<bullet> b = p \<bullet> b" using 2 * `a \<notin> bs` unfolding q'_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2584
      by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2585
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2586
    { have "{q \<bullet> a, p \<bullet> a} \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2587
	using ** 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2588
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2589
	apply (subgoal_tac "q \<bullet> a \<in> bs \<union> p \<bullet> bs")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2590
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2591
	apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2592
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2593
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2594
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2595
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by (simp add: supp_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2596
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2597
      have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2598
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2599
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2600
      have "supp q' \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2601
        unfolding q'_def using supp_plus_perm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2602
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2603
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2604
    have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2605
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2606
  ultimately show "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2607
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2608
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2609
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2610
lemma set_renaming_perm2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2611
  shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2612
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2613
  have "finite (bs \<inter> supp p)" by (simp add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2614
  then obtain q 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2615
    where *: "\<forall>b \<in> bs \<inter> supp p. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> (bs \<inter> supp p) \<union> (p \<bullet> (bs \<inter> supp p))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2616
    using set_renaming_perm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2617
  from ** have "supp q \<subseteq> bs \<union> (p \<bullet> bs)" by (auto simp add: inter_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2618
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2619
  have "\<forall>b \<in> bs - supp p. q \<bullet> b = p \<bullet> b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2620
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2621
    apply(subgoal_tac "b \<notin> supp q")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2622
    apply(simp add: fresh_def[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2623
    apply(simp add: fresh_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2624
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2625
    apply(rotate_tac 2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2626
    apply(drule subsetD[OF **])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2627
    apply(simp add: inter_eqvt supp_eqvt permute_self)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2628
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2629
  ultimately have "(\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" using * by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2630
  then show "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2631
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2632
    
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2633
lemma list_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2634
  shows "\<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> (p \<bullet> set bs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2635
proof (induct bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2636
  case (Cons a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2637
  then have " \<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> p \<bullet> (set bs)"  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2638
  then obtain q where *: "\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> set bs \<union> p \<bullet> (set bs)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2639
    by (blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2640
  { assume 1: "a \<in> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2641
    have "q \<bullet> a = p \<bullet> a" using * 1 by (induct bs) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2642
    then have "\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b" using * by simp 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2643
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2644
    have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2645
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2646
    have "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2647
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2648
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2649
  { assume 2: "a \<notin> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2650
    def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2651
    have "\<forall>b \<in> set (a # bs). q' \<bullet> b = p \<bullet> b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2652
      unfolding q'_def using 2 * `a \<notin> set bs` by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2653
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2654
    { have "{q \<bullet> a, p \<bullet> a} \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2655
	using **
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2656
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2657
	apply (subgoal_tac "q \<bullet> a \<in> set bs \<union> p \<bullet> set bs")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2658
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2659
	apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2660
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2661
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2662
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2663
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> set (a # bs) \<union> p \<bullet> set (a # bs)" by (simp add: supp_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2664
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2665
      have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2666
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2667
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2668
      have "supp q' \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2669
        unfolding q'_def using supp_plus_perm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2670
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2671
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2672
    have "\<exists>q. (\<forall>b \<in> set (a # bs).  q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2673
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2674
  ultimately show "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2675
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2676
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2677
 case Nil
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2678
  have "(\<forall>b \<in> set []. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> set [] \<union> p \<bullet> set []" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2679
    by (simp add: supp_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2680
  then show "\<exists>q. (\<forall>b \<in> set []. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set [] \<union> p \<bullet> (set [])" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2681
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2682
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2683
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2684
section {* Concrete Atoms Types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2685
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2686
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2687
  Class @{text at_base} allows types containing multiple sorts of atoms.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2688
  Class @{text at} only allows types with a single sort.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2689
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2690
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2691
class at_base = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2692
  fixes atom :: "'a \<Rightarrow> atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2693
  assumes atom_eq_iff [simp]: "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2694
  assumes atom_eqvt: "p \<bullet> (atom a) = atom (p \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2695
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2696
declare atom_eqvt[eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2697
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2698
class at = at_base +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2699
  assumes sort_of_atom_eq [simp]: "sort_of (atom a) = sort_of (atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2700
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2701
lemma sort_ineq [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2702
  assumes "sort_of (atom a) \<noteq> sort_of (atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2703
  shows "atom a \<noteq> atom b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2704
using assms by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2705
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2706
lemma supp_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2707
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2708
  shows "supp a = {atom a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2709
  by (simp add: supp_atom [symmetric] supp_def atom_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2710
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2711
lemma fresh_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2712
  shows  "sort_of a \<noteq> sort_of (atom b) \<Longrightarrow> a \<sharp> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2713
  and "a \<sharp> b \<longleftrightarrow> a \<noteq> atom b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2714
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2715
  apply(simp_all add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2716
  apply(metis)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2717
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2718
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2719
lemma fresh_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2720
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2721
  shows "a \<sharp> atom b \<longleftrightarrow> a \<sharp> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2722
  by (simp add: fresh_def supp_at_base supp_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2723
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2724
lemma fresh_star_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2725
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2726
  shows "as \<sharp>* atom b \<longleftrightarrow> as \<sharp>* b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2727
  by (simp add: fresh_star_def fresh_atom_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2728
3175
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2729
lemma if_fresh_at_base [simp]:
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2730
  shows "atom a \<sharp> x \<Longrightarrow> P (if a = x then t else s) = P s"
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2731
  and   "atom a \<sharp> x \<Longrightarrow> P (if x = a then t else s) = P s"
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2732
by (simp_all add: fresh_at_base)
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2733
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2734
simproc_setup fresh_ineq ("x \<noteq> (y::'a::at_base)") = {* fn _ => fn ss => fn ctrm =>
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2735
  let
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2736
    fun first_is_neg lhs rhs [] = NONE
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2737
      | first_is_neg lhs rhs (thm::thms) =
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2738
          (case Thm.prop_of thm of
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2739
             _ $ (@{term "HOL.Not"} $ (Const ("HOL.eq", _) $ l $ r)) =>
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2740
               (if l = lhs andalso r = rhs then SOME(thm)
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2741
                else if r = lhs andalso l = rhs then SOME(thm RS @{thm not_sym})
3176
31372760c2fb fixed bug in simproc (also in the exec-version)
Christian Urban <urbanc@in.tum.de>
parents: 3175
diff changeset
  2742
                else first_is_neg lhs rhs thms)
3175
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2743
           | _ => first_is_neg lhs rhs thms)
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2744
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2745
    val simp_thms = @{thms fresh_Pair fresh_at_base atom_eq_iff}
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2746
    val prems = Simplifier.prems_of ss
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2747
      |> filter (fn thm => case Thm.prop_of thm of
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2748
           _ $ (Const (@{const_name fresh}, _) $ _ $ _) => true | _ => false)
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2749
      |> map (simplify (HOL_basic_ss addsimps simp_thms))
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2750
      |> map HOLogic.conj_elims
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2751
      |> flat
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2752
  in
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2753
    case term_of ctrm of
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2754
      @{term "HOL.Not"} $ (Const ("HOL.eq", _) $ lhs $ rhs) =>
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2755
         (case first_is_neg lhs rhs prems of
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2756
            SOME(thm) => SOME(thm RS @{thm Eq_TrueI})
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2757
          | NONE => NONE)
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2758
    | _ => NONE
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2759
  end
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2760
*}
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2761
52730e5ec8cb Synchronize Nominal2_Base_Exec with Nominal2_Base, equivariance for Let, avoid overloading approx twice and changes for new isabelle
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3173
diff changeset
  2762
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2763
instance at_base < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2764
proof qed (simp add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2765
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2766
lemma at_base_infinite [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2767
  shows "infinite (UNIV :: 'a::at_base set)" (is "infinite ?U")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2768
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2769
  obtain a :: 'a where "True" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2770
  assume "finite ?U"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2771
  hence "finite (atom ` ?U)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2772
    by (rule finite_imageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2773
  then obtain b where b: "b \<notin> atom ` ?U" "sort_of b = sort_of (atom a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2774
    by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2775
  from b(2) have "b = atom ((atom a \<rightleftharpoons> b) \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2776
    unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2777
    by (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2778
  hence "b \<in> atom ` ?U" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2779
  with b(1) show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2780
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2781
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2782
lemma swap_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2783
  fixes x y::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2784
  shows "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> x = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2785
  and   "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> y = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2786
  and   "atom x \<noteq> a \<Longrightarrow> atom x \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2787
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2788
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2789
  by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2790
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2791
lemma obtain_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2792
  assumes X: "finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2793
  obtains a::"'a::at_base" where "atom a \<notin> X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2794
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2795
  have "inj (atom :: 'a \<Rightarrow> atom)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2796
    by (simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2797
  with X have "finite (atom -` X :: 'a set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2798
    by (rule finite_vimageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2799
  with at_base_infinite have "atom -` X \<noteq> (UNIV :: 'a set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2800
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2801
  then obtain a :: 'a where "atom a \<notin> X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2802
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2803
  thus ?thesis ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2804
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2805
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2806
lemma obtain_fresh':
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2807
  assumes fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2808
  obtains a::"'a::at_base" where "atom a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2809
using obtain_at_base[where X="supp x"]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2810
by (auto simp add: fresh_def fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2811
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2812
lemma obtain_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2813
  fixes x::"'b::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2814
  obtains a::"'a::at_base" where "atom a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2815
  by (rule obtain_fresh') (auto simp add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2816
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2817
lemma supp_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2818
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2819
  shows "supp S = atom ` S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2820
apply(simp add: supp_of_finite_sets[OF a])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2821
apply(simp add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2822
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2823
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2824
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2825
(* FIXME 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2826
lemma supp_cofinite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2827
  assumes a: "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2828
  shows "supp S = atom ` (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2829
apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2830
*)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2831
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2832
lemma fresh_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2833
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2834
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2835
  shows "atom a \<sharp> S \<longleftrightarrow> a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2836
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2837
  apply(simp add: supp_finite_set_at_base[OF a])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2838
  apply(subst inj_image_mem_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2839
  apply(simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2840
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2841
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2842
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2843
lemma fresh_at_base_permute_iff [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2844
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2845
  shows "atom (p \<bullet> a) \<sharp> p \<bullet> x \<longleftrightarrow> atom a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2846
  unfolding atom_eqvt[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2847
  by (simp add: fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2848
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2849
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2850
section {* Infrastructure for concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2851
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2852
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2853
  flip :: "'a::at_base \<Rightarrow> 'a \<Rightarrow> perm" ("'(_ \<leftrightarrow> _')")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2854
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2855
  "(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2856
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2857
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2858
  unfolding flip_def by (rule swap_self)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2859
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2860
lemma flip_commute: "(a \<leftrightarrow> b) = (b \<leftrightarrow> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2861
  unfolding flip_def by (rule swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2862
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2863
lemma minus_flip [simp]: "- (a \<leftrightarrow> b) = (a \<leftrightarrow> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2864
  unfolding flip_def by (rule minus_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2865
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2866
lemma add_flip_cancel: "(a \<leftrightarrow> b) + (a \<leftrightarrow> b) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2867
  unfolding flip_def by (rule swap_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2868
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2869
lemma permute_flip_cancel [simp]: "(a \<leftrightarrow> b) \<bullet> (a \<leftrightarrow> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2870
  unfolding permute_plus [symmetric] add_flip_cancel by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2871
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2872
lemma permute_flip_cancel2 [simp]: "(a \<leftrightarrow> b) \<bullet> (b \<leftrightarrow> a) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2873
  by (simp add: flip_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2874
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2875
lemma flip_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2876
  fixes a b c::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2877
  shows "p \<bullet> (a \<leftrightarrow> b) = (p \<bullet> a \<leftrightarrow> p \<bullet> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2878
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2879
  by (simp add: swap_eqvt atom_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2880
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2881
lemma flip_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2882
  shows "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2883
  and   "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> b = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2884
  and   "\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> c = c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2885
  and   "sort_of (atom a) \<noteq> sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2886
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2887
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2888
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2889
  by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2890
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2891
text {* the following two lemmas do not hold for at_base, 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2892
  only for single sort atoms from at *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2893
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2894
lemma permute_flip_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2895
  fixes a b c::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2896
  shows "(a \<leftrightarrow> b) \<bullet> c = (if c = a then b else if c = b then a else c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2897
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2898
  apply (rule atom_eq_iff [THEN iffD1])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2899
  apply (subst atom_eqvt [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2900
  apply (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2901
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2902
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2903
lemma flip_at_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2904
  fixes a b::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2905
  shows "(a \<leftrightarrow> b) \<bullet> a = b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2906
  and   "(a \<leftrightarrow> b) \<bullet> b = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2907
  unfolding permute_flip_at by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2908
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2909
lemma flip_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2910
  fixes a b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2911
  assumes "atom a \<sharp> x" "atom b \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2912
  shows "(a \<leftrightarrow> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2913
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2914
by (simp add: flip_def swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2915
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2916
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2917
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2918
subsection {* Syntax for coercing at-elements to the atom-type *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2919
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2920
syntax
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2921
  "_atom_constrain" :: "logic \<Rightarrow> type \<Rightarrow> logic" ("_:::_" [4, 0] 3)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2922
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2923
translations
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2924
  "_atom_constrain a t" => "CONST atom (_constrain a t)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2925
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2926
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2927
subsection {* A lemma for proving instances of class @{text at}. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2928
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2929
setup {* Sign.add_const_constraint (@{const_name "permute"}, NONE) *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2930
setup {* Sign.add_const_constraint (@{const_name "atom"}, NONE) *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2931
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2932
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2933
  New atom types are defined as subtypes of @{typ atom}.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2934
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2935
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2936
lemma exists_eq_simple_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2937
  shows "\<exists>a. a \<in> {a. sort_of a = s}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2938
  by (rule_tac x="Atom s 0" in exI, simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2939
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2940
lemma exists_eq_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2941
  shows "\<exists>a. a \<in> {a. sort_of a \<in> range sort_fun}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2942
  by (rule_tac x="Atom (sort_fun x) y" in exI, simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2943
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2944
lemma at_base_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2945
  fixes sort_fun :: "'b \<Rightarrow> atom_sort"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2946
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2947
  assumes type: "type_definition Rep Abs {a. sort_of a \<in> range sort_fun}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2948
  assumes atom_def: "\<And>a. atom a = Rep a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2949
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2950
  shows "OFCLASS('a, at_base_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2951
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2952
  interpret type_definition Rep Abs "{a. sort_of a \<in> range sort_fun}" by (rule type)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2953
  have sort_of_Rep: "\<And>a. sort_of (Rep a) \<in> range sort_fun" using Rep by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2954
  fix a b :: 'a and p p1 p2 :: perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2955
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2956
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2957
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2958
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2959
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2960
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2961
  show "p \<bullet> atom a = atom (p \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2962
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2963
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2964
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2965
(*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2966
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2967
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2968
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2969
  assumes type: "type_definition Rep Abs {a. sort_of a \<in> range (\<lambda>x::unit. s)}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2970
  assumes atom_def: "\<And>a. atom a = Rep a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2971
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2972
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2973
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2974
  interpret type_definition Rep Abs "{a. sort_of a \<in> range (\<lambda>x::unit. s)}" by (rule type)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2975
  have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2976
  fix a b :: 'a and p p1 p2 :: perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2977
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2978
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2979
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2980
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2981
  show "sort_of (atom a) = sort_of (atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2982
    unfolding atom_def by (simp add: sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2983
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2984
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2985
  show "p \<bullet> atom a = atom (p \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2986
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2987
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2988
*)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2989
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2990
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2991
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2992
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2993
  assumes type: "type_definition Rep Abs {a. sort_of a = s}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2994
  assumes atom_def: "\<And>a. atom a = Rep a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2995
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2996
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2997
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2998
  interpret type_definition Rep Abs "{a. sort_of a = s}" by (rule type)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2999
  have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3000
  fix a b :: 'a and p p1 p2 :: perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3001
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3002
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3003
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3004
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3005
  show "sort_of (atom a) = sort_of (atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3006
    unfolding atom_def by (simp add: sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3007
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3008
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3009
  show "p \<bullet> atom a = atom (p \<bullet> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3010
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3011
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3012
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3013
lemma at_class_sort:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3014
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3015
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3016
  fixes a::"'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3017
  assumes type: "type_definition Rep Abs {a. sort_of a = s}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3018
  assumes atom_def: "\<And>a. atom a = Rep a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3019
  shows "sort_of (atom a) = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3020
  using atom_def type
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3021
  unfolding type_definition_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3022
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3023
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3024
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3025
  (@{const_name "permute"}, SOME @{typ "perm \<Rightarrow> 'a::pt \<Rightarrow> 'a"}) *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3026
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3027
  (@{const_name "atom"}, SOME @{typ "'a::at_base \<Rightarrow> atom"}) *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3028
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3029
section {* The freshness lemma according to Andy Pitts *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3030
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3031
lemma freshness_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3032
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3033
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3034
  shows  "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3035
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3036
  from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3037
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3038
  show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3039
  proof (intro exI allI impI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3040
    fix a :: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3041
    assume a3: "atom a \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3042
    show "h a = h b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3043
    proof (cases "a = b")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3044
      assume "a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3045
      thus "h a = h b" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3046
    next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3047
      assume "a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3048
      hence "atom a \<sharp> b" by (simp add: fresh_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3049
      with a3 have "atom a \<sharp> h b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3050
        by (rule fresh_fun_app)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3051
      with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3052
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3053
      from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3054
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3055
      from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3056
      also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3057
        by (rule permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3058
      also have "\<dots> = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3059
        using d2 by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3060
      finally show "h a = h b"  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3061
    qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3062
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3063
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3064
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3065
lemma freshness_lemma_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3066
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3067
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3068
  shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3069
proof (rule ex_ex1I)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3070
  from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3071
    by (rule freshness_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3072
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3073
  fix x y
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3074
  assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3075
  assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3076
  from a x y show "x = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3077
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3078
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3079
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3080
text {* packaging the freshness lemma into a function *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3081
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3082
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3083
  fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3084
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3085
  "fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3086
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3087
lemma fresh_fun_apply:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3088
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3089
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3090
  assumes b: "atom a \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3091
  shows "fresh_fun h = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3092
unfolding fresh_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3093
proof (rule the_equality)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3094
  show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3095
  proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3096
    fix a':: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3097
    assume c: "atom a' \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3098
    from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3099
    with b c show "h a' = h a" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3100
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3101
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3102
  fix fr :: 'b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3103
  assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3104
  with b show "fr = h a" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3105
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3106
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3107
lemma fresh_fun_apply':
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3108
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3109
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3110
  shows "fresh_fun h = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3111
  apply (rule fresh_fun_apply)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3112
  apply (auto simp add: fresh_Pair intro: a)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3113
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3114
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3115
lemma fresh_fun_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3116
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3117
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3118
  shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3119
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3120
  apply (clarsimp simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3121
  apply (subst fresh_fun_apply', assumption+)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3122
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3123
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3124
  apply (simp only: atom_eqvt permute_fun_app_eq [where f=h])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3125
  apply (erule (1) fresh_fun_apply' [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3126
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3127
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3128
lemma fresh_fun_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3129
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3130
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3131
  shows "(supp h) supports (fresh_fun h)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3132
  apply (simp add: supports_def fresh_def [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3133
  apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3134
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3135
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3136
notation fresh_fun (binder "FRESH " 10)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3137
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3138
lemma FRESH_f_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3139
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3140
  fixes f :: "'b \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3141
  assumes P: "finite (supp P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3142
  shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3143
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3144
  obtain a::'a where "atom a \<sharp> P" using P by (rule obtain_fresh')
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3145
  show "(FRESH x. f (P x)) = f (FRESH x. P x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3146
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3147
    apply (cut_tac `atom a \<sharp> P`)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3148
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3149
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3150
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3151
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3152
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3153
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3154
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3155
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3156
lemma FRESH_binop_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3157
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3158
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3159
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3160
  assumes P: "finite (supp P)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3161
  and     Q: "finite (supp Q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3162
  shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3163
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3164
  from assms have "finite (supp (P, Q))" by (simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3165
  then obtain a::'a where "atom a \<sharp> (P, Q)" by (rule obtain_fresh') 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3166
  then have "atom a \<sharp> P" and "atom a \<sharp> Q" by (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3167
  show ?thesis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3168
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3169
    apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3170
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3171
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3172
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3173
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3174
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3175
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3176
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3177
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3178
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3179
lemma FRESH_conj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3180
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3181
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3182
  shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3183
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3184
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3185
lemma FRESH_disj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3186
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3187
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3188
  shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3189
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3190
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3191
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3192
section {* Library functions for the nominal infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3193
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3194
use "nominal_library.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3195
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3196
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3197
section {* Automation for creating concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3198
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3199
text {* at the moment only single-sort concrete atoms are supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3200
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3201
use "nominal_atoms.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3202
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3203
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3204
section {* automatic equivariance procedure for inductive definitions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3205
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3206
use "nominal_eqvt.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3207
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3208
instantiation atom_sort :: ord begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3209
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3210
fun less_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3211
  "less_atom_sort (Sort s1 l1) (Sort s2 []) \<longleftrightarrow> s1 < s2"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3212
| "less_atom_sort (Sort s1 []) (Sort s2 (h # t)) \<longleftrightarrow> s1 \<le> s2"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3213
| "less_atom_sort (Sort s1 (h1 # t1)) (Sort s2 (h2 # t2)) \<longleftrightarrow> s1 < s2 \<or> s1 \<le> s2 \<and> ((less_atom_sort h1 h2) \<or> (h1 = h2 \<and> less_atom_sort (Sort s1 t1) (Sort s2 t2)))"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3214
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3215
definition less_eq_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3216
  less_eq_atom_sort_def: "less_eq_atom_sort (x :: atom_sort) y \<longleftrightarrow> x < y \<or> x = y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3217
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3218
instance ..
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3219
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3220
end
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3221
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3222
lemma less_st_less: "(Sort s1 l1) < (Sort s2 l2) \<longleftrightarrow> s1 < s2 \<or> s1 \<le> s2 \<and> l1 < l2"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3223
  by (induct l1 l2 rule: list_induct2') auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3224
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3225
lemma not_as_le_as: "\<not>((x :: atom_sort) < x)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3226
  apply (rule less_atom_sort.induct[of "\<lambda>x y. x = y \<longrightarrow> \<not>x < y" "x" "x", simplified]) ..
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3227
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3228
instance atom_sort :: linorder
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3229
proof (default, auto simp add: less_eq_atom_sort_def not_as_le_as)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3230
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3231
  assume x: "x < y" "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3232
  then show False
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3233
    by (induct x y rule: less_atom_sort.induct) (case_tac l1, auto)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3234
  with x show "x = y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3235
    by (induct x y rule: less_atom_sort.induct) (case_tac l1, auto)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3236
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3237
  fix x y z :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3238
  assume "x < y" "y < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3239
  then show "x < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3240
    apply (induct x z arbitrary: y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3241
    apply (case_tac [!] y) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3242
    apply (case_tac [!] list2) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3243
    apply (case_tac l1) apply auto[2]
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3244
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3245
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3246
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3247
  assume x: "\<not>x < y" "y \<noteq> x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3248
  then show "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3249
    apply (induct x y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3250
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3251
    apply (case_tac [!] l1)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3252
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3253
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3254
qed
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3255
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3256
instantiation atom :: linorder begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3257
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3258
definition less_eq_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3259
  [simp]: "less_eq_atom x y \<longleftrightarrow> sort_of x < sort_of y \<or> sort_of x \<le> sort_of y \<and> nat_of x \<le> nat_of y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3260
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3261
definition less_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3262
  [simp]: "less_atom x y \<longleftrightarrow> sort_of x < sort_of y \<or> sort_of x \<le> sort_of y \<and> nat_of x < nat_of y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3263
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3264
instance apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3265
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3266
  apply (case_tac x, case_tac y)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3267
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3268
  done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3269
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3270
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3271
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3272
lemma [code]:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3273
  "gpermute p = perm_apply (dest_perm p)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3274
  apply transfer
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3275
  unfolding Rel_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3276
  by (auto, metis perm_eq_def valid_dest_perm_raw_eq(2))
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3277
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3278
instantiation perm :: equal begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3279
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3280
definition "equal_perm a b \<longleftrightarrow> Rep_perm a = Rep_perm b"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3281
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3282
instance
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3283
  apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3284
  unfolding equal_perm_def perm_eq_rep ..
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3285
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3286
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3287
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3288
(* Test: export_code swap in SML *)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3289
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3290
end