Nominal/Nominal2_Base_Exec.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 04 Oct 2012 11:10:23 +0100
changeset 3200 995d47b09ab4
parent 3182 5335c0ea743a
permissions -rw-r--r--
removed fork_mono flag
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1018
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1019
subsubsection {* Equivariance for product operations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1020
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1021
lemma fst_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1022
  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
  1023
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1024
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1025
lemma snd_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1026
  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
  1027
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1028
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1029
lemma split_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1030
  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
  1031
  unfolding split_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1032
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1033
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1034
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1035
subsubsection {* Equivariance for list operations *}
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
lemma append_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1038
  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
  1039
  by (induct xs) auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1040
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1041
lemma rev_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1042
  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
  1043
  by (induct xs) (simp_all add: append_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1044
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1045
lemma map_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1046
  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
  1047
  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
  1048
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1049
lemma removeAll_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1050
  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
  1051
  by (induct xs) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1052
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1053
lemma filter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1054
  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
  1055
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1056
apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1057
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
  1058
apply(simp only: permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1059
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1060
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1061
lemma distinct_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1062
  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
  1063
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1064
apply(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1065
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
  1066
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1067
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1068
lemma length_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1069
  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
  1070
by (induct xs) (simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1071
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1072
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1073
subsubsection {* Equivariance for @{typ "'a option"} *}
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
lemma option_map_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1076
  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
  1077
  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
  1078
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1079
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1080
subsubsection {* Equivariance for @{typ "'a fset"} *}
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
lemma in_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1083
  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
  1084
unfolding in_fset
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1085
by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1086
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1087
lemma union_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1088
  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
  1089
  by (induct S) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1090
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1091
lemma inter_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1092
  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
  1093
  unfolding list_eq_def inter_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1094
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1095
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1096
lemma inter_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1097
  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
  1098
  by (lifting inter_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1099
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1100
lemma sub_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1101
  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
  1102
  unfolding sub_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1103
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1104
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1105
lemma subset_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1106
  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
  1107
  by (lifting sub_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1108
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1109
lemma map_fset_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1110
  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
  1111
  by (lifting map_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1112
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1113
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1114
section {* Supp, Freshness and Supports *}
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
context pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1117
begin
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
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1120
  supp :: "'a \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1121
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1122
  "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
  1123
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1124
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1125
  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
  1126
where   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1127
  "a \<sharp> x \<equiv> a \<notin> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1128
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1129
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1130
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1131
lemma supp_conv_fresh: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1132
  shows "supp x = {a. \<not> a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1133
  unfolding fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1134
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1135
lemma swap_rel_trans:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1136
  assumes "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1137
  assumes "sort_of b = sort_of c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1138
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1139
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1140
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1141
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1142
  assume "a = b \<or> c = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1143
  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
  1144
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1145
  assume *: "\<not> (a = b \<or> c = b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1146
  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
  1147
    using assms by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1148
  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
  1149
    using assms * by (simp add: swap_triple)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1150
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1151
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1152
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1153
lemma swap_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1154
  assumes a: "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1155
  and     b: "b \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1156
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1157
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1158
  assume asm: "sort_of a = sort_of b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1159
  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
  1160
    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
  1161
  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
  1162
  then obtain c 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1163
    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
  1164
    by (rule obtain_atom) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1165
  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
  1166
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1167
  assume "sort_of a \<noteq> sort_of b"
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" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1169
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1170
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1171
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1172
subsection {* supp and fresh are equivariant *}
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
lemma supp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1176
  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
  1177
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1178
  by (perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1179
     (simp only: permute_eqvt[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1180
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1181
lemma fresh_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1182
  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
  1183
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1184
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1185
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1186
lemma fresh_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1187
  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
  1188
  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
  1189
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1190
lemma fresh_permute_left:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1191
  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
  1192
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1193
  assume "a \<sharp> p \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1194
  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
  1195
  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
  1196
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1197
  assume "- p \<bullet> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1198
  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
  1199
  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
  1200
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1201
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1202
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1203
section {* supports *}
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
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1206
  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
  1207
where  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1208
  "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
  1209
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1210
lemma supp_is_subset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1211
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1212
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1213
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1214
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1215
  shows "(supp x) \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1216
proof (rule ccontr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1217
  assume "\<not> (supp x \<subseteq> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1218
  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
  1219
  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
  1220
  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
  1221
  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
  1222
  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
  1223
  with b1 show False by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1224
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1225
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1226
lemma supports_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1227
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1228
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1229
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1230
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1231
  shows "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1232
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1233
  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
  1234
  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
  1235
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1236
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1237
lemma supp_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1238
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1239
  shows "(supp x) supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1240
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1241
proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1242
  fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1243
  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
  1244
  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
  1245
  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
  1246
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1247
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1248
lemma supports_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1249
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1250
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1251
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1252
  and     a3: "a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1253
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1254
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1255
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1256
  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
  1257
  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
  1258
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1259
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1260
lemma supp_is_least_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1261
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1262
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1263
  assumes  a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1264
  and      a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1265
  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
  1266
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1267
proof (rule equalityI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1268
  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
  1269
  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
  1270
  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
  1271
  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
  1272
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1273
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1274
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1275
lemma subsetCI: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1276
  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
  1277
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1278
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1279
lemma finite_supp_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1280
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1281
  assumes a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1282
  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
  1283
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1284
  using a1 a2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1285
proof (rule supp_is_least_supports)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1286
  fix S'
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1287
  assume "finite S'" and "S' supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1288
  show "S \<subseteq> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1289
  proof (rule subsetCI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1290
    fix a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1291
    assume "a \<in> S" and "a \<notin> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1292
    have "finite (S \<union> S')"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1293
      using `finite S` `finite S'` by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1294
    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
  1295
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1296
    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
  1297
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1298
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1299
      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
  1300
    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
  1301
      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
  1302
      by (rule a3)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1303
    ultimately show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1304
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1305
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1306
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1307
section {* Support w.r.t. relations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1308
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1309
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1310
  This definition is used for unquotient types, where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1311
  alpha-equivalence does not coincide with equality.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1312
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1313
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1314
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1315
  "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
  1316
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1317
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1318
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1319
section {* Finitely-supported types *}
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
class fs = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1322
  assumes finite_supp: "finite (supp x)"
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
lemma pure_supp: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1325
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1326
  shows "supp x = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1327
  unfolding supp_def by (simp add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1328
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1329
lemma pure_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1330
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1331
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1332
  unfolding fresh_def by (simp add: pure_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1333
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1334
instance pure < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1335
by default (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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1338
subsection  {* Type @{typ atom} is finitely-supported. *}
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
lemma supp_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1341
  shows "supp a = {a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1342
  by (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1343
     (auto simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1344
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1345
lemma fresh_atom: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1346
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1347
  unfolding fresh_def supp_atom by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1348
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1349
instance atom :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1350
by default (simp add: supp_atom)
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1353
section {* Type @{typ perm} is finitely-supported. *}
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
lemma perm_swap_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1356
  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
  1357
unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1358
by (metis add_diff_cancel minus_perm_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1359
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1360
lemma supports_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1361
  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
  1362
  unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1363
  unfolding perm_swap_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1364
  by (simp add: swap_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1365
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1366
lemma finite_perm_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1367
  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
  1368
  unfolding permute_atom_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1369
  using finite_gpermute_neq .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1370
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1371
lemma supp_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1372
  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
  1373
apply (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1374
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
  1375
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
  1376
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1377
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1378
lemma fresh_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1379
  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
  1380
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1381
  by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1382
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1383
lemma supp_swap:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1384
  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
  1385
  by (auto simp add: supp_perm swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1386
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1387
lemma fresh_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1388
  shows "a \<sharp> (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1389
  unfolding fresh_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1390
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1391
lemma supp_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1392
  shows "supp (0::perm) = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1393
  unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1394
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1395
lemma fresh_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1396
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1397
  assumes "a \<sharp> p" "a \<sharp> q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1398
  shows "a \<sharp> (p + q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1399
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1400
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1401
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1402
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1403
lemma supp_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1404
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1405
  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
  1406
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1407
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1408
lemma fresh_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1409
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1410
  shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1411
  unfolding fresh_def supp_perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1412
  by (simp) (metis permute_minus_cancel(1))
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1413
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1414
lemma supp_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1415
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1416
  shows "supp (- p) = supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1417
  unfolding supp_conv_fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1418
  by (simp add: fresh_minus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1419
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1420
lemma plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1421
  fixes p q::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1422
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1423
  shows "p + q = q + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1424
unfolding perm_eq_iff
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1425
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1426
  fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1427
  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
  1428
  proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1429
    { 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
  1430
      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
  1431
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1432
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1433
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1434
    { 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
  1435
      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
  1436
      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
  1437
      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
  1438
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1439
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1440
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1441
    { 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
  1442
      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
  1443
      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
  1444
      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
  1445
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1446
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1447
    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
  1448
      using asm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1449
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1450
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1451
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1452
lemma supp_plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1453
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1454
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1455
  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
  1456
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1457
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1458
    assume "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1459
    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
  1460
    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
  1461
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1462
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1463
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1464
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1465
    assume "a \<in> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1466
    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
  1467
    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
  1468
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1469
    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
  1470
      by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1471
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1472
  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
  1473
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1474
  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
  1475
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1476
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1477
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1478
instance perm :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1479
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
  1480
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1481
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1482
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1483
section {* Finite Support instances for other types *}
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
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
  1487
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1488
lemma supp_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1489
  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
  1490
  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
  1491
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1492
lemma fresh_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1493
  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
  1494
  by (simp add: fresh_def supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1495
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1496
lemma supp_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1497
  shows "supp () = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1498
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1499
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1500
lemma fresh_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1501
  shows "a \<sharp> ()"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1502
  by (simp add: fresh_def supp_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1503
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1504
instance prod :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1505
  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
  1506
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1507
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1508
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
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
lemma supp_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1511
  shows "supp (Inl x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1512
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1513
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1514
lemma supp_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1515
  shows "supp (Inr x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1516
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1517
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1518
lemma fresh_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1519
  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
  1520
  by (simp add: fresh_def supp_Inl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1521
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1522
lemma fresh_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1523
  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
  1524
  by (simp add: fresh_def supp_Inr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1525
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1526
instance sum :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1527
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1528
apply (case_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1529
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
  1530
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1531
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1532
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1533
subsection {* Type @{typ "'a option"} is finitely supported *}
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
lemma supp_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1536
  shows "supp None = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1537
by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1538
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1539
lemma supp_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1540
  shows "supp (Some x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1541
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1542
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1543
lemma fresh_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1544
  shows "a \<sharp> None"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1545
  by (simp add: fresh_def supp_None)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1546
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1547
lemma fresh_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1548
  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
  1549
  by (simp add: fresh_def supp_Some)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1550
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1551
instance option :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1552
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1553
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1554
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
  1555
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1556
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1557
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1558
subsubsection {* Type @{typ "'a list"} is finitely supported *}
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
lemma supp_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1561
  shows "supp [] = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1562
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1563
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1564
lemma fresh_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1565
  shows "a \<sharp> []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1566
  by (simp add: fresh_def supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1567
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1568
lemma supp_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1569
  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
  1570
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
  1571
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1572
lemma fresh_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1573
  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
  1574
  by (simp add: fresh_def supp_Cons)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1575
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1576
lemma supp_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1577
  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
  1578
  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
  1579
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1580
lemma fresh_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1581
  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
  1582
  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
  1583
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1584
lemma supp_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1585
  shows "supp (rev xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1586
  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
  1587
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1588
lemma fresh_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1589
  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
  1590
  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
  1591
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1592
lemma supp_removeAll:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1593
  fixes x::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1594
  shows "supp (removeAll x xs) = supp xs - {x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1595
  by (induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1596
     (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
  1597
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1598
lemma supp_of_atom_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1599
  fixes as::"atom list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1600
  shows "supp as = set as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1601
by (induct as)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1602
   (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
  1603
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1604
instance list :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1605
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1606
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1607
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
  1608
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1609
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1610
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1611
section {* Support and Freshness for Applications *}
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
lemma fresh_conv_MOST: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1614
  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
  1615
  unfolding fresh_def supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1616
  unfolding MOST_iff_cofinite by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1617
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1618
lemma fresh_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1619
  assumes "a \<sharp> f" and "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1620
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1621
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1622
  unfolding fresh_conv_MOST
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1623
  unfolding permute_fun_app_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1624
  by (elim MOST_rev_mp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1625
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1626
lemma supp_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1627
  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
  1628
  using fresh_fun_app
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1629
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1630
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1631
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1632
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1633
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
  1634
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1635
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1636
  "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
  1637
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1638
lemma eqvt_boolI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1639
  fixes f::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1640
  shows "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1641
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1642
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1643
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1644
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1645
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
  1646
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1647
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1648
 "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
  1649
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1650
lemma eqvtI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1651
  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
  1652
unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1653
by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1654
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1655
lemma eqvt_at_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1656
  assumes "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1657
  shows "eqvt_at f (q \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1658
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1659
  { fix p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1660
    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
  1661
      using assms by (simp add: eqvt_at_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1662
    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
  1663
    also have "\<dots> = f ((p + q) \<bullet> 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
    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
  1666
  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
  1667
    by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1668
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1669
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1670
lemma supp_fun_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1671
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1672
  shows "supp f = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1673
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1674
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1675
  unfolding supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1676
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1677
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1678
lemma fresh_fun_eqvt:
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1679
  assumes a: "eqvt f"
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1680
  shows "a \<sharp> f"
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1681
  using a
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1682
  unfolding fresh_def
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1683
  by (simp add: supp_fun_eqvt)
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1684
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1685
lemma fresh_fun_eqvt_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1686
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1687
  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
  1688
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1689
  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
  1690
  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
  1691
    unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1692
    using supp_fun_app by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1693
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1694
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1695
lemma supp_fun_app_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1696
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1697
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1698
  using fresh_fun_eqvt_app[OF a]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1699
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1700
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1701
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1702
lemma supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1703
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1704
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1705
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1706
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1707
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1708
unfolding fresh_def[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1709
using asm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1710
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
  1711
apply(rule fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1712
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1713
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1714
lemma finite_supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1715
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1716
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1717
  shows "finite (supp (f x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1718
apply(rule finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1719
apply(rule supp_eqvt_at[OF asm fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1720
apply(rule fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1721
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1722
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1723
lemma fresh_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1724
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1725
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1726
  and     fresh: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1727
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1728
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1729
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1730
using supp_eqvt_at[OF asm fin]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1731
by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1732
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1733
text {* for handling of freshness of functions *}
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1734
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1735
simproc_setup fresh_fun_simproc ("a \<sharp> (f::'a::pt \<Rightarrow>'b::pt)") = {* fn _ => fn ss => fn ctrm =>
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1736
  let 
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1737
    val Const(@{const_name fresh}, _) $ _ $ f = term_of ctrm
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1738
  in
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1739
    case (Term.add_frees f [], Term.add_vars f []) of
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1740
      ([], []) => SOME(@{thm fresh_fun_eqvt[simplified eqvt_def, THEN Eq_TrueI]})
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1741
    | (x::_, []) => let
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1742
         val thy = Proof_Context.theory_of (Simplifier.the_context ss)        
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1743
         val argx = Free x
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1744
         val absf = absfree x f
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1745
         val cty_inst = [SOME (ctyp_of thy (fastype_of argx)), SOME (ctyp_of thy (fastype_of f))]
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1746
         val ctrm_inst = [NONE, SOME (cterm_of thy absf), SOME (cterm_of thy argx)] 
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1747
         val thm = Drule.instantiate' cty_inst ctrm_inst @{thm fresh_fun_app}
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1748
      in
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1749
        SOME(thm RS @{thm Eq_TrueI}) 
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1750
      end  
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1751
    | (_, _) => NONE
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1752
  end
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  1753
*}
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1754
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1755
subsection {* helper functions for nominal_functions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1756
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1757
lemma THE_defaultI2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1758
  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
  1759
  shows "Q (THE_default d P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1760
by (iprover intro: assms THE_defaultI')
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1761
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1762
lemma the_default_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1763
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1764
  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
  1765
  apply(rule THE_default1_equality [symmetric])
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(simp add: ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1768
  apply(rule unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1769
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1770
  apply(rule subst[OF permute_fun_app_eq])
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
  apply(rule THE_defaultI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1773
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1774
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1775
lemma fundef_ex1_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1776
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1777
  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
  1778
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1779
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1780
  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
  1781
  apply(simp only: f_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1782
  apply(subst the_default_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1783
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1784
  apply(rule THE_default1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1785
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1786
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1787
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1788
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1789
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1790
  apply(rule THE_defaultI2) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1791
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1792
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1793
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1794
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1795
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1796
  apply(simp)
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
lemma fundef_ex1_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1800
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1801
  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
  1802
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1803
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1804
  shows "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1805
  unfolding eqvt_at_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1806
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1807
  by (auto intro: fundef_ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1808
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1809
lemma fundef_ex1_prop:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1810
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1811
  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
  1812
  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
  1813
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1814
  shows "P x (f x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1815
  unfolding f_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1816
  using ex1
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1817
  apply(erule_tac ex1E)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1818
  apply(rule THE_defaultI2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1819
  apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1820
  apply(rule P_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1821
  apply(assumption)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1822
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1823
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1824
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1825
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
  1826
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1827
text {* support and freshness for atom sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1828
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1829
lemma supp_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1830
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1831
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1832
  shows "supp S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1833
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1834
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1835
  apply(simp add: swap_set_not_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1836
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1837
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1838
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1839
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1840
lemma supp_cofinite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1841
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1842
  assumes "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1843
  shows "supp S = (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1844
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1845
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1846
  apply(simp add: swap_set_both_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1847
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1848
  apply(subst swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1849
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1850
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1851
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1852
lemma fresh_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1853
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1854
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1855
  shows "a \<sharp> S \<longleftrightarrow> a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1856
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1857
  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
  1858
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1859
lemma fresh_minus_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1860
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1861
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1862
  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
  1863
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1864
  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
  1865
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1866
lemma Union_supports_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1867
  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
  1868
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1869
  { fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1870
    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
  1871
      unfolding permute_set_def by force
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1872
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1873
  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
  1874
    unfolding supports_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1875
    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
  1876
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1877
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1878
lemma Union_of_finite_supp_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1879
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1880
  assumes fin: "finite S"   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1881
  shows "finite (\<Union>x\<in>S. supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1882
  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
  1883
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1884
lemma Union_included_in_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1885
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1886
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1887
  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
  1888
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1889
  have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1890
    unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1891
    by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1892
  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
  1893
    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
  1894
  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
  1895
  also have "\<dots> \<subseteq> supp S" using eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1896
    by (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1897
  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
  1898
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1899
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1900
lemma supp_of_finite_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1901
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1902
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1903
  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
  1904
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1905
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1906
apply(rule Union_supports_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1907
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
  1908
apply(rule Union_included_in_supp[OF fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1909
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1910
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1911
lemma finite_sets_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1912
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1913
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1914
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1915
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1916
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
  1917
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1918
lemma supp_of_finite_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1919
  fixes S T::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1920
  assumes fin1: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1921
  and     fin2: "finite T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1922
  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
  1923
  using fin1 fin2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1924
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1925
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1926
lemma supp_of_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1927
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1928
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1929
  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
  1930
  using fin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1931
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1932
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1933
lemma fresh_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1934
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1935
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1936
  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
  1937
  using fin unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1938
  by (simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1939
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1940
lemma supp_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1941
  shows "supp {} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1942
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1943
  by (simp add: 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 fresh_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1946
  shows "a \<sharp> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1947
  by (simp add: fresh_def supp_set_empty)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1948
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1949
lemma supp_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1950
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1951
  shows "supp (set xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1952
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1953
apply(simp add: supp_set_empty supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1954
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
  1955
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1956
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1957
lemma fresh_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1958
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1959
  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
  1960
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1961
by (simp add: supp_set)
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1964
subsection {* Type @{typ "'a multiset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1965
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1966
lemma set_of_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1967
  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
  1968
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
  1969
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1970
lemma supp_set_of:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1971
  shows "supp (set_of M) \<subseteq> supp M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1972
  apply (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1973
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1974
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1975
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1976
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1977
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1978
lemma Union_finite_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1979
  fixes M::"'a::fs multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1980
  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
  1981
proof - 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1982
  have "finite (\<Union>(supp ` {x. x \<in># M}))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1983
    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
  1984
  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
  1985
    by (simp only: image_Collect)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1986
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1987
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1988
lemma Union_supports_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1989
  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
  1990
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1991
  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
  1992
    unfolding permute_multiset_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1993
    apply(induct M)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1994
    apply(simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1995
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1996
  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
  1997
    unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1998
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1999
    apply(rule sw)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2000
    apply(rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2001
    apply(simp_all only: fresh_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2002
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2003
    apply(metis neq0_conv)+
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2004
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2005
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2006
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2007
lemma Union_included_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2008
  fixes M::"('a::fs multiset)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2009
  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
  2010
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2011
  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
  2012
  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
  2013
  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
  2014
  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
  2015
  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
  2016
qed
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
lemma supp_of_multisets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2019
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2020
  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
  2021
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2022
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2023
apply(rule Union_supports_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2024
apply(rule Union_finite_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2025
apply(rule Union_included_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2026
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2027
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2028
lemma multisets_supp_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2029
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2030
  shows "finite (supp M)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2031
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
  2032
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2033
lemma supp_of_multiset_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2034
  fixes M N::"('a::fs) multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2035
  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
  2036
  by (auto simp add: supp_of_multisets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2037
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2038
lemma supp_empty_mset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2039
  shows "supp {#} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2040
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2041
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2042
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2043
instance multiset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2044
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2045
  apply (rule multisets_supp_finite)
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
subsection {* Type @{typ "'a fset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2049
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2050
lemma supp_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2051
  shows "supp (fset S) = supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2052
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2053
  by (simp add: fset_eqvt fset_cong)
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 supp_empty_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2056
  shows "supp {||} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2057
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2058
  by simp
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 fresh_empty_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2061
  shows "a \<sharp> {||}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2062
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2063
by (simp)
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 supp_insert_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2066
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2067
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2068
  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
  2069
  apply(subst supp_fset[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2070
  apply(simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2071
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2072
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2073
lemma fresh_insert_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2074
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2075
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2076
  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
  2077
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2078
  by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2079
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2080
lemma fset_finite_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2081
  fixes S::"('a::fs) fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2082
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2083
  by (induct S) (simp_all add: finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2084
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2085
lemma supp_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2086
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2087
  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
  2088
by (induct S) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2089
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2090
lemma fresh_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2091
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2092
  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
  2093
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2094
by (simp add: supp_union_fset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2095
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2096
instance fset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2097
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2098
  apply (rule fset_finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2099
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2100
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2101
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2102
section {* Freshness and Fresh-Star *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2103
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2104
lemma fresh_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2105
  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
  2106
  by (simp add: fresh_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2107
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2108
lemma fresh_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2109
  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
  2110
  by rule (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2111
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2112
(* 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
  2113
(* added to the simplifier with mksimps                  *) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2114
lemma [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2115
  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
  2116
  by (simp add: fresh_Pair)
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_PairD:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2119
  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
  2120
  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
  2121
  by (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2122
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2123
declaration {* fn _ =>
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2124
let
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2125
  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
  2126
in
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2127
  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
  2128
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2129
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2130
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2131
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
  2132
  induction principles. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2133
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2134
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2135
  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
  2136
where 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2137
  "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
  2138
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2139
lemma fresh_star_supp_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2140
  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
  2141
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
  2142
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2143
lemma fresh_star_perm_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2144
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2145
  assumes fresh: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2146
  and     fin: "finite as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2147
  shows "supp p \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2148
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2149
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
  2150
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2151
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2152
lemma fresh_star_atom_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2153
  assumes fresh: "as \<sharp>* bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2154
  and     fin: "finite as" "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2155
  shows "bs \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2156
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2157
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2158
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
  2159
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2160
lemma atom_fresh_star_disjoint:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2161
  assumes fin: "finite bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2162
  shows "as \<sharp>* bs \<longleftrightarrow> (as \<inter> bs = {})"
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
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2165
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
  2166
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2167
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2168
lemma fresh_star_Pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2169
  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
  2170
  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
  2171
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2172
lemma fresh_star_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2173
  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
  2174
  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
  2175
  and   "as \<sharp>* []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2176
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
  2177
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2178
lemma fresh_star_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2179
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2180
  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
  2181
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2182
by (simp add: fresh_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2183
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2184
lemma fresh_star_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2185
  fixes a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2186
  shows "as \<sharp>* {a} \<longleftrightarrow> as \<sharp>* a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2187
  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
  2188
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2189
lemma fresh_star_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2190
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2191
  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
  2192
by (simp add: fresh_star_def fresh_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_Un:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2195
  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
  2196
  by (auto simp add: fresh_star_def)
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_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2199
  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
  2200
  by (auto simp add: fresh_star_def)
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_Un_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2203
  "((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
  2204
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2205
  apply(rule)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2206
  apply(erule meta_mp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2207
  apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2208
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2209
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2210
lemma fresh_star_insert_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2211
  "(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
  2212
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2213
  by rule (simp_all add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2214
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2215
lemma fresh_star_empty_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2216
  "({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2217
  by (simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2218
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2219
lemma fresh_star_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2220
  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
  2221
  by (simp add: fresh_star_def fresh_Unit) 
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
lemma fresh_star_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2224
  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
  2225
  by (rule, simp_all add: fresh_star_Pair)
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 fresh_star_zero:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2228
  shows "as \<sharp>* (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2229
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2230
  by (simp add: fresh_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2231
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2232
lemma fresh_star_plus:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2233
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2234
  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
  2235
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2236
  by (simp add: fresh_plus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2237
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2238
lemma fresh_star_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2239
  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
  2240
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2241
  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
  2242
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2243
lemma fresh_star_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2244
  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
  2245
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2246
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2247
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2248
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2249
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2250
section {* Induction principle for permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2251
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2252
lemma smaller_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2253
  assumes a: "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2254
  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
  2255
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2256
  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
  2257
    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
  2258
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2259
  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
  2260
  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
  2261
  ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2262
  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
  2263
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2264
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2265
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2266
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
  2267
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2268
  and zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2269
  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
  2270
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2271
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2272
  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
  2273
  then show "P p" using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2274
  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
  2275
    case (psubset p)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2276
    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
  2277
    have as: "supp p \<subseteq> S" by fact
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2278
    { assume "supp p = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2279
      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
  2280
      then have "P p" using zero by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2281
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2282
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2283
    { assume "supp p \<noteq> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2284
      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
  2285
      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
  2286
        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
  2287
      let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2288
      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
  2289
      then have "P ?q" using ih by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2290
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2291
      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
  2292
      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
  2293
      moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2294
      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
  2295
      ultimately have "P p" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2296
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2297
    ultimately show "P p" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2298
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2299
qed
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 perm_simple_struct_induct[case_names zero swap]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2302
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2303
  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
  2304
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2305
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
  2306
   (auto intro: zero swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2307
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2308
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
  2309
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2310
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2311
  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
  2312
  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
  2313
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2314
using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2315
by (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2316
   (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
  2317
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2318
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
  2319
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2320
  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
  2321
  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
  2322
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2323
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
  2324
   (auto intro: zero swap plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2325
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2326
lemma supp_perm_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2327
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2328
  shows "supp p \<subseteq> {b} \<longleftrightarrow> p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2329
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2330
  { assume "supp p \<subseteq> {b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2331
    then have "p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2332
      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
  2333
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2334
  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
  2335
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2336
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2337
lemma supp_perm_pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2338
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2339
  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
  2340
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2341
  { assume "supp p \<subseteq> {a, b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2342
    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
  2343
      apply (induct p rule: perm_struct_induct) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2344
      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
  2345
      apply (simp add: swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2346
      done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2347
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2348
  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
  2349
    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
  2350
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2351
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2352
lemma supp_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2353
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2354
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2355
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2356
  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
  2357
    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
  2358
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2359
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2360
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2361
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2362
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2363
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2364
    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
  2365
    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
  2366
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2367
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2368
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2369
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
  2370
lemma supp_perm_eq_test:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2371
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2372
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2373
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2374
  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
  2375
    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
  2376
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2377
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2378
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2379
    show "0 \<bullet> x = x" by simp
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 (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2382
    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
  2383
    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
  2384
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2385
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2386
    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
  2387
    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
  2388
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2389
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2390
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2391
lemma perm_supp_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2392
  assumes a: "(supp p) \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2393
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2394
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2395
  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
  2396
    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
  2397
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2398
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2399
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2400
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2401
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2402
    case (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2403
    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
  2404
    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
  2405
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2406
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2407
    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
  2408
    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
  2409
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2410
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2411
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2412
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2413
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2414
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2415
lemma supp_perm_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2416
  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
  2417
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2418
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2419
  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
  2420
  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
  2421
    unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2422
  then have "supp x \<sharp>* (-q + p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2423
    unfolding fresh_star_def fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2424
  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
  2425
  then show "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2426
    by (metis permute_minus_cancel(1) permute_plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2427
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2428
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2429
text {* disagreement set *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2430
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2431
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2432
  dset :: "perm \<Rightarrow> perm \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2433
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2434
  "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
  2435
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2436
lemma ds_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2437
  assumes "dset p q \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2438
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2439
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2440
unfolding dset_def fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2441
by (auto intro: supp_perm_perm_eq)
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 atom_set_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2444
  assumes a: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2445
  shows "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2446
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2447
  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
  2448
    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
  2449
  then show "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2450
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2451
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2452
    show "0 \<bullet> as = as" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2453
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2454
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2455
    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
  2456
    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
  2457
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2458
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2459
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2460
section {* Avoiding of atom sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2461
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2462
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2463
  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
  2464
  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
  2465
  which 'translates' between both sets.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2466
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2467
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2468
lemma at_set_avoiding_aux:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2469
  fixes Xs::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2470
  and   As::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2471
  assumes b: "Xs \<subseteq> As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2472
  and     c: "finite As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2473
  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
  2474
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2475
  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
  2476
  then show ?thesis using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2477
  proof (induct rule: finite_subset_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2478
    case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2479
    have "0 \<bullet> {} \<inter> As = {}" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2480
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2481
    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
  2482
    ultimately show ?case by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2483
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2484
    case (insert x Xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2485
    then obtain p where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2486
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2487
      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
  2488
    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
  2489
    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
  2490
    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
  2491
    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
  2492
      using `finite As` `finite Xs`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2493
      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
  2494
    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
  2495
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2496
    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
  2497
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2498
    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
  2499
      by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2500
    let ?q = "(x \<rightleftharpoons> y) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2501
    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
  2502
      unfolding insert_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2503
      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
  2504
      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
  2505
      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
  2506
    have "?q \<bullet> insert x Xs \<inter> As = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2507
      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
  2508
      unfolding q by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2509
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2510
    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
  2511
      unfolding supp_swap by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2512
    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
  2513
      by (simp add: supp_plus_perm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2514
    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
  2515
      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
  2516
      by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2517
    ultimately show ?case by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2518
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2519
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2520
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2521
lemma at_set_avoiding:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2522
  assumes a: "finite Xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2523
  and     b: "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2524
  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
  2525
  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
  2526
  unfolding fresh_star_def fresh_def by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2527
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2528
lemma at_set_avoiding1:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2529
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2530
  and     "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2531
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2532
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2533
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
  2534
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2535
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2536
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2537
lemma at_set_avoiding2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2538
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2539
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2540
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2541
  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
  2542
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2543
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
  2544
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2545
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2546
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2547
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2548
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2549
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2550
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2551
lemma at_set_avoiding3:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2552
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2553
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2554
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2555
  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
  2556
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2557
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
  2558
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2559
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2560
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2561
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2562
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2563
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2564
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2565
lemma at_set_avoiding2_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2566
  assumes "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2567
  and     b: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2568
  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
  2569
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2570
  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
  2571
  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
  2572
    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
  2573
  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
  2574
    unfolding fresh_star_def Ball_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2575
    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
  2576
  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
  2577
  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
  2578
qed
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2581
section {* Renaming permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2582
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2583
lemma set_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2584
  assumes b: "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2585
  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
  2586
using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2587
proof (induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2588
  case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2589
  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
  2590
    by (simp add: permute_set_def supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2591
  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
  2592
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2593
  case (insert a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2594
  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
  2595
  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
  2596
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2597
  { assume 1: "q \<bullet> a = p \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2598
    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
  2599
    moreover 
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
      using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2602
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2603
    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
  2604
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2605
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2606
  { 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
  2607
    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
  2608
    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
  2609
      by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2610
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2611
    { 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
  2612
	using ** 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2613
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2614
	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
  2615
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2616
	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
  2617
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2618
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2619
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2620
      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
  2621
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2622
      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
  2623
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2624
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2625
      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
  2626
        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
  2627
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2628
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2629
    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
  2630
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2631
  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
  2632
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2633
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2634
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2635
lemma set_renaming_perm2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2636
  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
  2637
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2638
  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
  2639
  then obtain q 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2640
    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
  2641
    using set_renaming_perm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2642
  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
  2643
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2644
  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
  2645
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2646
    apply(subgoal_tac "b \<notin> supp q")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2647
    apply(simp add: fresh_def[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2648
    apply(simp add: fresh_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2649
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2650
    apply(rotate_tac 2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2651
    apply(drule subsetD[OF **])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2652
    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
  2653
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2654
  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
  2655
  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
  2656
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2657
    
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2658
lemma list_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2659
  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
  2660
proof (induct bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2661
  case (Cons a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2662
  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
  2663
  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
  2664
    by (blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2665
  { assume 1: "a \<in> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2666
    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
  2667
    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
  2668
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2669
    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
  2670
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2671
    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
  2672
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2673
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2674
  { assume 2: "a \<notin> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2675
    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
  2676
    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
  2677
      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
  2678
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2679
    { 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
  2680
	using **
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2681
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2682
	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
  2683
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2684
	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
  2685
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2686
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2687
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2688
      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
  2689
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2690
      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
  2691
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2692
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2693
      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
  2694
        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
  2695
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2696
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2697
    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
  2698
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2699
  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
  2700
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2701
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2702
 case Nil
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2703
  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
  2704
    by (simp add: supp_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2705
  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
  2706
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2707
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2708
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2709
section {* Concrete Atoms Types *}
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
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2712
  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
  2713
  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
  2714
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2715
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2716
class at_base = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2717
  fixes atom :: "'a \<Rightarrow> atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2718
  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
  2719
  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
  2720
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2721
declare atom_eqvt[eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2722
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2723
class at = at_base +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2724
  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
  2725
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2726
lemma sort_ineq [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2727
  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
  2728
  shows "atom a \<noteq> atom b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2729
using assms by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2730
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2731
lemma supp_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2732
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2733
  shows "supp a = {atom a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2734
  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
  2735
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2736
lemma fresh_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2737
  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
  2738
  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
  2739
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2740
  apply(simp_all add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2741
  apply(metis)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2742
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2743
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2744
lemma fresh_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2745
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2746
  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
  2747
  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
  2748
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2749
lemma fresh_star_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2750
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2751
  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
  2752
  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
  2753
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
  2754
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
  2755
  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
  2756
  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
  2757
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
  2758
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
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
  2760
  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
  2761
    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
  2762
      | 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
  2763
          (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
  2764
             _ $ (@{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
  2765
               (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
  2766
                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
  2767
                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
  2768
           | _ => 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
  2769
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
  2770
    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
  2771
    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
  2772
      |> 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
  2773
           _ $ (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
  2774
      |> 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
  2775
      |> 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
  2776
      |> 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
  2777
  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
  2778
    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
  2779
      @{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
  2780
         (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
  2781
            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
  2782
          | 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
  2783
    | _ => 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
  2784
  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
  2785
*}
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
  2786
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
  2787
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2788
instance at_base < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2789
proof qed (simp add: supp_at_base)
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 at_base_infinite [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2792
  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
  2793
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2794
  obtain a :: 'a where "True" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2795
  assume "finite ?U"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2796
  hence "finite (atom ` ?U)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2797
    by (rule finite_imageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2798
  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
  2799
    by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2800
  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
  2801
    unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2802
    by (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2803
  hence "b \<in> atom ` ?U" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2804
  with b(1) show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2805
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2806
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2807
lemma swap_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2808
  fixes x y::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2809
  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
  2810
  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
  2811
  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
  2812
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2813
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2814
  by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2815
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2816
lemma obtain_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2817
  assumes X: "finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2818
  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
  2819
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2820
  have "inj (atom :: 'a \<Rightarrow> atom)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2821
    by (simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2822
  with X have "finite (atom -` X :: 'a set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2823
    by (rule finite_vimageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2824
  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
  2825
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2826
  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
  2827
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2828
  thus ?thesis ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2829
qed
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
lemma obtain_fresh':
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2832
  assumes fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2833
  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
  2834
using obtain_at_base[where X="supp x"]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2835
by (auto simp add: fresh_def fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2836
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2837
lemma obtain_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2838
  fixes x::"'b::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2839
  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
  2840
  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
  2841
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2842
lemma supp_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2843
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2844
  shows "supp S = atom ` S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2845
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
  2846
apply(simp add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2847
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2848
done
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
(* FIXME 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2851
lemma supp_cofinite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2852
  assumes a: "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2853
  shows "supp S = atom ` (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2854
apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2855
*)
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 fresh_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2858
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2859
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2860
  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
  2861
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2862
  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
  2863
  apply(subst inj_image_mem_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2864
  apply(simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2865
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2866
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2867
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2868
lemma fresh_at_base_permute_iff [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2869
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2870
  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
  2871
  unfolding atom_eqvt[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2872
  by (simp add: fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2873
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
section {* Infrastructure for concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2876
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2877
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2878
  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
  2879
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2880
  "(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2881
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2882
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2883
  unfolding flip_def by (rule swap_self)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2884
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2885
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
  2886
  unfolding flip_def by (rule swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2887
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2888
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
  2889
  unfolding flip_def by (rule minus_swap)
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
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
  2892
  unfolding flip_def by (rule swap_cancel)
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_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
  2895
  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
  2896
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2897
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
  2898
  by (simp add: flip_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2899
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2900
lemma flip_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2901
  fixes a b c::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2902
  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
  2903
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2904
  by (simp add: swap_eqvt atom_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2905
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2906
lemma flip_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2907
  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
  2908
  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
  2909
  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
  2910
  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
  2911
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2912
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2913
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2914
  by simp_all
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
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
  2917
  only for single sort atoms from at *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2918
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2919
lemma permute_flip_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2920
  fixes a b c::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2921
  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
  2922
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2923
  apply (rule atom_eq_iff [THEN iffD1])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2924
  apply (subst atom_eqvt [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2925
  apply (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2926
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2927
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2928
lemma flip_at_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2929
  fixes a b::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2930
  shows "(a \<leftrightarrow> b) \<bullet> a = b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2931
  and   "(a \<leftrightarrow> b) \<bullet> b = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2932
  unfolding permute_flip_at by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2933
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2934
lemma flip_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2935
  fixes a b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2936
  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
  2937
  shows "(a \<leftrightarrow> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2938
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2939
by (simp add: flip_def swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2940
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2941
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2942
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2943
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
  2944
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2945
syntax
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2946
  "_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
  2947
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2948
translations
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2949
  "_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
  2950
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2951
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2952
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
  2953
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2954
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
  2955
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
  2956
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2957
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2958
  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
  2959
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2960
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2961
lemma exists_eq_simple_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2962
  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
  2963
  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
  2964
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2965
lemma exists_eq_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2966
  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
  2967
  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
  2968
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2969
lemma at_base_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2970
  fixes sort_fun :: "'b \<Rightarrow> atom_sort"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2971
  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
  2972
  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
  2973
  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
  2974
  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
  2975
  shows "OFCLASS('a, at_base_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2976
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2977
  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
  2978
  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
  2979
  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
  2980
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2981
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2982
  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
  2983
    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
  2984
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2985
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2986
  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
  2987
    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
  2988
qed
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
(*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2991
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2992
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2993
  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
  2994
  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
  2995
  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
  2996
  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
  2997
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2998
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2999
  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
  3000
  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
  3001
  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
  3002
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3003
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3004
  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
  3005
    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
  3006
  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
  3007
    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
  3008
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3009
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3010
  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
  3011
    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
  3012
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3013
*)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3014
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3015
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3016
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3017
  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
  3018
  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
  3019
  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
  3020
  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
  3021
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3022
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3023
  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
  3024
  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
  3025
  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
  3026
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3027
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3028
  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
  3029
    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
  3030
  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
  3031
    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
  3032
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3033
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3034
  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
  3035
    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
  3036
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3037
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3038
lemma at_class_sort:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3039
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3040
  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
  3041
  fixes a::"'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3042
  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
  3043
  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
  3044
  shows "sort_of (atom a) = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3045
  using atom_def type
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3046
  unfolding type_definition_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3047
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3048
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3049
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3050
  (@{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
  3051
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3052
  (@{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
  3053
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3054
section {* The freshness lemma according to Andy Pitts *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3055
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3056
lemma freshness_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3057
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3058
  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
  3059
  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
  3060
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3061
  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
  3062
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3063
  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
  3064
  proof (intro exI allI impI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3065
    fix a :: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3066
    assume a3: "atom a \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3067
    show "h a = h b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3068
    proof (cases "a = b")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3069
      assume "a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3070
      thus "h a = h b" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3071
    next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3072
      assume "a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3073
      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
  3074
      with a3 have "atom a \<sharp> h b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3075
        by (rule fresh_fun_app)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3076
      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
  3077
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3078
      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
  3079
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3080
      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
  3081
      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
  3082
        by (rule permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3083
      also have "\<dots> = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3084
        using d2 by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3085
      finally show "h a = h b"  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3086
    qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3087
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3088
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3089
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3090
lemma freshness_lemma_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3091
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3092
  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
  3093
  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
  3094
proof (rule ex_ex1I)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3095
  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
  3096
    by (rule freshness_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3097
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3098
  fix x y
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3099
  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
  3100
  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
  3101
  from a x y show "x = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3102
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3103
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3104
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3105
text {* packaging the freshness lemma into a function *}
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
definition
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3108
  Fresh :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3109
where
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3110
  "Fresh h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3111
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3112
lemma Fresh_apply:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3113
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3114
  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
  3115
  assumes b: "atom a \<sharp> h"
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3116
  shows "Fresh h = h a"
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3117
unfolding Fresh_def
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3118
proof (rule the_equality)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3119
  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
  3120
  proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3121
    fix a':: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3122
    assume c: "atom a' \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3123
    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
  3124
    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
  3125
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3126
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3127
  fix fr :: 'b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3128
  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
  3129
  with b show "fr = h a" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3130
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3131
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3132
lemma Fresh_apply':
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3133
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3134
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3135
  shows "Fresh h = h a"
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3136
  apply (rule Fresh_apply)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3137
  apply (auto simp add: fresh_Pair intro: a)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3138
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3139
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3140
lemma Fresh_eqvt:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3141
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3142
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3143
  shows "p \<bullet> (Fresh h) = Fresh (p \<bullet> h)"
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3144
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3145
  apply (clarsimp simp add: fresh_Pair)
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3146
  apply (subst Fresh_apply', assumption+)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3147
  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
  3148
  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
  3149
  apply (simp only: atom_eqvt permute_fun_app_eq [where f=h])
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3150
  apply (erule (1) Fresh_apply' [symmetric])
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3151
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3152
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3153
lemma Fresh_supports:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3154
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3155
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3156
  shows "(supp h) supports (Fresh h)"
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3157
  apply (simp add: supports_def fresh_def [symmetric])
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3158
  apply (simp add: Fresh_eqvt [OF a] swap_fresh_fresh)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3159
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3160
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3161
notation Fresh (binder "FRESH " 10)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3162
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3163
lemma FRESH_f_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3164
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3165
  fixes f :: "'b \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3166
  assumes P: "finite (supp P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3167
  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
  3168
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3169
  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
  3170
  show "(FRESH x. f (P x)) = f (FRESH x. P x)"
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3171
    apply (subst Fresh_apply' [where a=a, OF _ pure_fresh])
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3172
    apply (cut_tac `atom a \<sharp> P`)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3173
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3174
    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
  3175
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3176
    apply (subst Fresh_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3177
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3178
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3179
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3180
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3181
lemma FRESH_binop_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3182
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3183
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3184
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3185
  assumes P: "finite (supp P)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3186
  and     Q: "finite (supp Q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3187
  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
  3188
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3189
  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
  3190
  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
  3191
  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
  3192
  show ?thesis
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3193
    apply (subst Fresh_apply' [where a=a, OF _ pure_fresh])
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3194
    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
  3195
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3196
    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
  3197
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
3179
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3198
    apply (subst Fresh_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
9eeea01bdbc0 Propagare changes from Nominal2_Base to _Exec
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3176
diff changeset
  3199
    apply (subst Fresh_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3200
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3201
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3202
qed
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
lemma FRESH_conj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3205
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3206
  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
  3207
  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
  3208
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3209
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3210
lemma FRESH_disj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3211
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3212
  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
  3213
  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
  3214
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3215
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3216
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3217
section {* Library functions for the nominal infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3218
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3219
use "nominal_library.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3220
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3221
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3222
section {* Automation for creating concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3223
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3224
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
  3225
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3226
use "nominal_atoms.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3227
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3228
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3229
section {* automatic equivariance procedure for inductive definitions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3230
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3231
use "nominal_eqvt.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3232
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3233
instantiation atom_sort :: ord begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3234
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3235
fun less_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3236
  "less_atom_sort (Sort s1 l1) (Sort s2 []) \<longleftrightarrow> s1 < s2"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3237
| "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
  3238
| "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
  3239
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3240
definition less_eq_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3241
  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
  3242
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3243
instance ..
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3244
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3245
end
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3246
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3247
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
  3248
  by (induct l1 l2 rule: list_induct2') auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3249
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3250
lemma not_as_le_as: "\<not>((x :: atom_sort) < x)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3251
  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
  3252
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3253
instance atom_sort :: linorder
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3254
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
  3255
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3256
  assume x: "x < y" "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3257
  then show False
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3258
    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
  3259
  with x show "x = y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3260
    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
  3261
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3262
  fix x y z :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3263
  assume "x < y" "y < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3264
  then show "x < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3265
    apply (induct x z arbitrary: y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3266
    apply (case_tac [!] y) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3267
    apply (case_tac [!] list2) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3268
    apply (case_tac l1) apply auto[2]
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3269
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3270
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3271
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3272
  assume x: "\<not>x < y" "y \<noteq> x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3273
  then show "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3274
    apply (induct x y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3275
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3276
    apply (case_tac [!] l1)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3277
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3278
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3279
qed
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3280
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3281
instantiation atom :: linorder begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3282
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3283
definition less_eq_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3284
  [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
  3285
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3286
definition less_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3287
  [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
  3288
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3289
instance apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3290
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3291
  apply (case_tac x, case_tac y)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3292
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3293
  done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3294
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3295
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3296
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3297
lemma [code]:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3298
  "gpermute p = perm_apply (dest_perm p)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3299
  apply transfer
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3300
  unfolding Rel_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3301
  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
  3302
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3303
instantiation perm :: equal begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3304
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3305
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
  3306
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3307
instance
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3308
  apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3309
  unfolding equal_perm_def perm_eq_rep ..
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3310
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3311
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3312
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3313
(* Test: export_code swap in SML *)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3314
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3315
end