Nominal/Nominal2_Base_Exec.thy
author Cezary Kaliszyk <cezarykaliszyk@gmail.com>
Tue, 22 May 2012 14:55:58 +0200
changeset 3173 9876d73adb2b
parent 3147 d24e70483051
child 3175 52730e5ec8cb
permissions -rw-r--r--
Executing Lambda Terms
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
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   113
(*lemma sort_respecting_Rep_perm [simp, intro]:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   114
  "sort_respecting (Rep_perm p)"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   115
  using Rep_perm [of p] by simp*)
3139
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
lemma Rep_perm_mk_perm [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   118
  "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
   119
  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
   120
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   121
(*lemma mk_perm_Rep_perm [simp, code abstype]:
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   122
  "mk_perm (Rep_perm dxs) = dxs"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   123
  by (simp add: mk_perm_def Rep_perm_inverse)*)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   124
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   125
instance perm :: size ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   126
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   127
instantiation perm :: group_add
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   128
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   129
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   130
lift_definition zero_perm :: "perm" is "0" by simp
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   131
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   132
lift_definition uminus_perm :: "perm \<Rightarrow> perm" is "uminus"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   133
  unfolding sort_respecting_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   134
  by transfer (auto, metis perm_apply_minus)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   135
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   136
lift_definition plus_perm :: "perm \<Rightarrow> perm \<Rightarrow> perm" is "plus"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   137
  unfolding sort_respecting_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   138
  by transfer (simp add: perm_add_apply)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   140
definition "(p :: perm) - q = p + - q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   141
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   142
lemma Rep_perm_0 [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   143
  "Rep_perm 0 = 0"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   144
  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
   145
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   146
lemma Rep_perm_uminus [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   147
  "Rep_perm (- p) = - (Rep_perm p)"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   148
  by (metis uminus_perm.rep_eq)
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   149
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   150
lemma Rep_perm_add [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   151
  "Rep_perm (p + q) = (Rep_perm p) + (Rep_perm q)"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   152
  by (simp add: plus_perm.rep_eq)
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
instance
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   155
  apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   156
  unfolding minus_perm_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   157
  by (transfer, simp add: add_assoc)+
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   158
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   159
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   160
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   161
lift_definition swap :: "atom \<Rightarrow> atom \<Rightarrow> perm"  ("'(_ \<rightleftharpoons> _')")
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   162
  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
   163
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   164
lemma sort_respecting_swap [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   165
  "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
   166
  unfolding sort_respecting_def
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   167
  by transfer auto
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   168
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   169
lemma Rep_swap [simp, code abstract]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   170
  "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
   171
  by (simp add: swap_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   172
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   173
lemma swap_different_sorts [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   174
  "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
   175
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   176
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   177
lemma swap_cancel:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   178
  shows "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   179
  and   "(a \<rightleftharpoons> b) + (b \<rightleftharpoons> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   180
  by (simp_all add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   181
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   182
lemma swap_self [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   183
  "(a \<rightleftharpoons> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   184
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   185
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   186
lemma minus_swap [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   187
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   188
  by (simp add: perm_eq_rep)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   189
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   190
lemma swap_commute:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   191
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   192
  by (simp add: perm_eq_rep swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   193
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   194
lemma swap_triple:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   195
  assumes "a \<noteq> b" and "c \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   196
  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
   197
  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
   198
  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
   199
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   200
section {* Permutation Types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   201
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   202
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   203
  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
   204
  addition, but lower than unary minus.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   205
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   206
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   207
class pt =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   208
  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
   209
  assumes permute_zero [simp]: "0 \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   210
  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
   211
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   212
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   213
lemma permute_diff [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   214
  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
   215
  unfolding diff_minus by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   216
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   217
lemma permute_minus_cancel [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   218
  shows "p \<bullet> - p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   219
  and   "- p \<bullet> p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   220
  unfolding permute_plus [symmetric] by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   221
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   222
lemma permute_swap_cancel [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   223
  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
   224
  unfolding permute_plus [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   225
  by (simp add: swap_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   226
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   227
lemma permute_swap_cancel2 [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   228
  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
   229
  unfolding permute_plus [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   230
  by (simp add: swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   231
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   232
lemma inj_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   233
  shows "inj (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   234
  by (rule inj_on_inverseI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   235
     (rule permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   236
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   237
lemma surj_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   238
  shows "surj (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   239
  by (rule surjI, rule permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   240
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   241
lemma bij_permute [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   242
  shows "bij (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   243
  by (rule bijI [OF inj_permute surj_permute])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   244
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   245
lemma inv_permute: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   246
  shows "inv (permute p) = permute (- p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   247
  by (rule inv_equality) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   248
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   249
lemma permute_minus: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   250
  shows "permute (- p) = inv (permute p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   251
  by (simp add: inv_permute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   252
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   253
lemma permute_eq_iff [simp]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   254
  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
   255
  by (rule inj_permute [THEN inj_eq])
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
end
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
subsection {* Permutations for atoms *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   260
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   261
instantiation atom :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   262
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   263
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   264
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   265
  "p \<bullet> a = gpermute (Rep_perm p) a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   266
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   267
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   268
  by default (simp_all add: permute_atom_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   271
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   272
lemma sort_of_permute [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   273
  shows "sort_of (p \<bullet> a) = sort_of a"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   274
  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
   275
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   276
lemma swap_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   277
  shows "(a \<rightleftharpoons> b) \<bullet> c =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   278
           (if sort_of a = sort_of b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   279
            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
   280
  by (auto simp add: permute_atom_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   281
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   282
lemma swap_atom_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   283
  "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
   284
  "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
   285
  "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
   286
  unfolding swap_atom by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   287
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   288
lemma perm_eq_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   289
  fixes p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   290
  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
   291
  unfolding permute_atom_def perm_eq_rep
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   292
  by (simp add: gperm_eq)
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
subsection {* Permutations for permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   295
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   296
instantiation perm :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   297
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   298
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   299
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   300
  "p \<bullet> q = p + q - p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   301
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   302
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   303
  by default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   304
     (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
   305
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   306
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   307
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   308
lemma permute_self:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   309
  shows "p \<bullet> p = p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   310
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   311
  by (simp add: diff_minus add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   312
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   313
lemma pemute_minus_self:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   314
  shows "- p \<bullet> p = p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   315
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   316
  by (simp add: diff_minus add_assoc)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   317
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
subsection {* Permutations for functions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   320
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   321
instantiation "fun" :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   322
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   323
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   324
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   325
  "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
   326
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   327
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   328
  by default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   329
     (simp_all add: permute_fun_def minus_add)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   332
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   333
lemma permute_fun_app_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   334
  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
   335
  unfolding permute_fun_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   336
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
subsection {* Permutations for booleans *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   339
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   340
instantiation bool :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   341
begin
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
definition "p \<bullet> (b::bool) = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   344
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   345
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   346
  by (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   347
     (simp_all add: permute_bool_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   350
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   351
lemma permute_boolE:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   352
  fixes P::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   353
  shows "p \<bullet> P \<Longrightarrow> P"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   354
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   355
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   356
lemma permute_boolI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   357
  fixes P::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   358
  shows "P \<Longrightarrow> p \<bullet> P"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   359
  by(simp add: permute_bool_def)
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
subsection {* Permutations for sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   362
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   363
instantiation "set" :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   364
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   365
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   366
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   367
  "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
   368
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   369
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   370
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   371
apply (auto simp add: permute_set_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   372
done
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   375
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   376
lemma permute_set_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   377
  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
   378
unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   379
by (auto) (metis permute_minus_cancel(1))
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   380
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   381
lemma permute_set_eq_image:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   382
  shows "p \<bullet> X = permute p ` X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   383
  unfolding permute_set_def by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   384
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   385
lemma permute_set_eq_vimage:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   386
  shows "p \<bullet> X = permute (- p) -` X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   387
  unfolding permute_set_eq vimage_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   388
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   389
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   390
lemma permute_finite [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   391
  shows "finite (p \<bullet> X) = finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   392
  unfolding permute_set_eq_vimage
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   393
  using bij_permute by (rule finite_vimage_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   394
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   395
lemma swap_set_not_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   396
  assumes a: "a \<notin> S" "b \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   397
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   398
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   399
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   400
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   401
lemma swap_set_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   402
  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
   403
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   404
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   405
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   406
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   407
lemma swap_set_in_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   408
  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
   409
  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
   410
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   411
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   412
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   413
lemma swap_set_both_in:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   414
  assumes a: "a \<in> S" "b \<in> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   415
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   416
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   417
  using a by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   418
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   419
lemma mem_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   420
  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
   421
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   422
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   423
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   424
lemma empty_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   425
  shows "p \<bullet> {} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   426
  unfolding permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   427
  by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   428
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   429
lemma insert_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   430
  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
   431
  unfolding permute_set_eq_image image_insert ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   432
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
subsection {* Permutations for @{typ unit} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   435
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   436
instantiation unit :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   437
begin
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
definition "p \<bullet> (u::unit) = u"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   440
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   441
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   442
by (default) (simp_all add: permute_unit_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   445
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
subsection {* Permutations for products *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   448
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   449
instantiation prod :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   450
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   451
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   452
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   453
  permute_prod 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   454
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   455
  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
   456
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   457
instance
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   458
by default auto
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
end
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
subsection {* Permutations for sums *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   463
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   464
instantiation sum :: (pt, pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   465
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   466
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   467
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   468
  permute_sum 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   469
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   470
  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
   471
| 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
   472
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   473
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   474
by (default) (case_tac [!] x, simp_all)
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
end
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
subsection {* Permutations for @{typ "'a list"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   479
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   480
instantiation list :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   481
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   482
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   483
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   484
  permute_list 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   485
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   486
  Nil_eqvt:  "p \<bullet> [] = []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   487
| 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
   488
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   489
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   490
by (default) (induct_tac [!] x, simp_all)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   493
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   494
lemma set_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   495
  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
   496
  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
   497
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   498
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
subsection {* Permutations for @{typ "'a option"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   501
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   502
instantiation option :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   503
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   504
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   505
primrec 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   506
  permute_option 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   507
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   508
  None_eqvt: "p \<bullet> None = None"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   509
| 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
   510
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   511
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   512
by (default) (induct_tac [!] x, simp_all)
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
end
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
subsection {* Permutations for @{typ "'a multiset"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   517
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   518
instantiation multiset :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   519
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   520
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   521
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   522
  "p \<bullet> M = {# p \<bullet> x. x :# M #}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   523
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   524
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   525
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   526
  fix M :: "'a multiset" and p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   527
  show "0 \<bullet> M = M" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   528
    unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   529
    by (induct_tac M) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   530
  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
   531
    unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   532
    by (induct_tac M) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   533
qed
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   536
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   537
lemma permute_multiset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   538
  fixes M N::"('a::pt) multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   539
  shows "(p \<bullet> {#}) = ({#} ::('a::pt) multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   540
  and   "(p \<bullet> {# x #}) = {# p \<bullet> x #}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   541
  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
   542
  unfolding permute_multiset_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   543
  by (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   544
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
subsection {* Permutations for @{typ "'a fset"} *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   547
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   548
instantiation fset :: (pt) pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   549
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   550
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   551
quotient_definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   552
  "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
   553
is
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   554
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   555
  by (simp add: set_eqvt[symmetric])
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   556
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
   557
instance
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   558
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   559
  fix x :: "'a fset" and p q :: "perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   560
  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
   561
  show "0 \<bullet> x = x" by (lifting lst)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   562
  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
   563
  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
   564
qed
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   567
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   568
lemma permute_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   569
  fixes S::"('a::pt) fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   570
  shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   571
  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
   572
  by (lifting permute_list.simps)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   573
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   574
lemma fset_eqvt: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   575
  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
   576
  by (lifting set_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   577
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
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
   580
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   581
instantiation char :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   582
begin
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
definition "p \<bullet> (c::char) = c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   585
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   586
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   587
by (default) (simp_all add: permute_char_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   590
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   591
instantiation nat :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   592
begin
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
definition "p \<bullet> (n::nat) = n"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   595
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   596
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   597
by (default) (simp_all add: permute_nat_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   600
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   601
instantiation int :: pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   602
begin
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
definition "p \<bullet> (i::int) = i"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   605
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   606
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   607
by (default) (simp_all add: permute_int_def)
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
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   610
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
section {* Pure types *}
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
text {* Pure types will have always empty support. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   615
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   616
class pure = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   617
  assumes permute_pure: "p \<bullet> x = x"
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
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
   620
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   621
instance unit :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   622
proof qed (rule permute_unit_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   623
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   624
instance bool :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   625
proof qed (rule permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   626
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
text {* Other type constructors preserve purity. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   629
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   630
instance "fun" :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   631
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
   632
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   633
instance set :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   634
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
   635
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   636
instance prod :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   637
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
   638
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   639
instance sum :: (pure, pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   640
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
   641
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   642
instance list :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   643
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
   644
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   645
instance option :: (pure) pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   646
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
   647
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
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
   650
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   651
instance char :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   652
proof qed (rule permute_char_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   653
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   654
instance nat :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   655
proof qed (rule permute_nat_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   656
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   657
instance int :: pure
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   658
proof qed (rule permute_int_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   659
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
section {* Infrastructure for Equivariance and Perm_simp *}
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
subsection {* Basic functions about permutations *}
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
use "nominal_basics.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   666
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
subsection {* Eqvt infrastructure *}
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
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
   671
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   672
use "nominal_thmdecls.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   673
setup "Nominal_ThmDecls.setup"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   674
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   675
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   676
lemmas [eqvt] =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   677
  (* pt types *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   678
  permute_prod.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   679
  permute_list.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   680
  permute_option.simps 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   681
  permute_sum.simps
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   682
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   683
  (* sets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   684
  empty_eqvt insert_eqvt set_eqvt 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   685
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   686
  (* fsets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   687
  permute_fset fset_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   688
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   689
  (* multisets *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   690
  permute_multiset
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
subsection {* perm_simp infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   693
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   694
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   695
  "unpermute p = permute (- p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   696
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   697
lemma eqvt_apply:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   698
  fixes f :: "'a::pt \<Rightarrow> 'b::pt" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   699
  and x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   700
  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
   701
  unfolding permute_fun_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   702
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   703
lemma eqvt_lambda:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   704
  fixes f :: "'a::pt \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   705
  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
   706
  unfolding permute_fun_def unpermute_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   707
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   708
lemma eqvt_bound:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   709
  shows "p \<bullet> unpermute p x \<equiv> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   710
  unfolding unpermute_def by simp
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
text {* provides perm_simp methods *}
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
use "nominal_permeq.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   715
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   716
method_setup perm_simp =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   717
 {* 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
   718
 {* pushes permutations inside. *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   719
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   720
method_setup perm_strict_simp =
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   721
 {* 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
   722
 {* 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
   723
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
subsubsection {* Equivariance for permutations and swapping *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   726
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   727
lemma permute_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   728
  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
   729
  unfolding permute_perm_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   730
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   731
(* 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
   732
lemma permute_eqvt_raw [eqvt_raw]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   733
  shows "p \<bullet> permute \<equiv> permute"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   734
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
   735
apply(subst permute_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   736
apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   737
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   738
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   739
lemma zero_perm_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   740
  shows "p \<bullet> (0::perm) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   741
  unfolding permute_perm_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   742
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   743
lemma add_perm_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   744
  fixes p p1 p2 :: perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   745
  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
   746
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   747
  by (simp add: perm_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   748
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   749
lemma swap_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   750
  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
   751
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   752
  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
   753
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   754
lemma uminus_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   755
  fixes p q::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   756
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   757
  unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   758
  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
   759
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   760
subsubsection {* Equivariance of Logical Operators *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   761
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   762
lemma eq_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   763
  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
   764
  unfolding permute_eq_iff permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   765
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   766
lemma Not_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   767
  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
   768
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   769
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   770
lemma conj_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   771
  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
   772
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   773
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   774
lemma imp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   775
  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
   776
  by (simp add: permute_bool_def)
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
declare imp_eqvt[folded induct_implies_def, eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   779
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   780
lemma all_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   781
  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
   782
  unfolding All_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   783
  by (perm_simp) (rule refl)
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
declare all_eqvt[folded induct_forall_def, eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   786
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   787
lemma ex_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   788
  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
   789
  unfolding Ex_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   790
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   791
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   792
lemma ex1_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   793
  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
   794
  unfolding Ex1_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   795
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   796
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   797
lemma if_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   798
  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
   799
  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
   800
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   801
lemma True_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   802
  shows "p \<bullet> True = True"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   803
  unfolding permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   804
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   805
lemma False_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   806
  shows "p \<bullet> False = False"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   807
  unfolding permute_bool_def ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   808
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   809
lemma disj_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   810
  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
   811
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   812
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   813
lemma all_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   814
  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
   815
  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
   816
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   817
lemma ex_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   818
  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
   819
  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
   820
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   821
lemma ex1_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   822
  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
   823
  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
   824
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   825
lemma the_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   826
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   827
  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
   828
  apply(rule the1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   829
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   830
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   831
  apply(rule unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   832
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   833
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   834
  apply(rule theI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   835
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   836
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   837
lemma the_eqvt2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   838
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   839
  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
   840
  apply(rule the1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   841
  apply(simp add: ex1_eqvt2[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   842
  apply(simp add: permute_bool_def unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   843
  apply(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   844
  apply(rule theI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   845
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   846
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   847
subsubsection {* Equivariance of Set operators *}
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
lemma mem_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   850
  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
   851
  unfolding permute_bool_def permute_set_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   852
  by (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   853
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   854
lemma Collect_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   855
  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
   856
  unfolding permute_set_eq permute_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   857
  by (auto simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   858
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   859
lemma inter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   860
  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
   861
  unfolding Int_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   862
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   863
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   864
lemma Bex_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   865
  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
   866
  unfolding Bex_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   867
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   868
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   869
lemma Ball_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   870
  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
   871
  unfolding Ball_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   872
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   873
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   874
lemma image_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   875
  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
   876
  unfolding image_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   877
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   878
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   879
lemma Image_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   880
  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
   881
  unfolding Image_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   882
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   883
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   884
lemma UNIV_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   885
  shows "p \<bullet> UNIV = UNIV"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   886
  unfolding UNIV_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   887
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   888
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   889
lemma union_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   890
  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
   891
  unfolding Un_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   892
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   893
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   894
lemma Diff_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   895
  fixes A B :: "'a::pt set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   896
  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
   897
  unfolding set_diff_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   898
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   899
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   900
lemma Compl_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   901
  fixes A :: "'a::pt set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   902
  shows "p \<bullet> (- A) = - (p \<bullet> A)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   903
  unfolding Compl_eq_Diff_UNIV
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   904
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   905
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   906
lemma subset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   907
  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
   908
  unfolding subset_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   909
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   910
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   911
lemma psubset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   912
  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
   913
  unfolding psubset_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   914
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   915
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   916
lemma vimage_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   917
  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
   918
  unfolding vimage_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   919
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   920
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   921
lemma Union_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   922
  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
   923
  unfolding Union_eq 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   924
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   925
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   926
lemma Inter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   927
  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
   928
  unfolding Inter_eq 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   929
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   930
3147
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   931
lemma foldr_eqvt[eqvt]:
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   932
  "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
   933
  apply (induct b)
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   934
  apply simp_all
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   935
  apply (perm_simp)
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   936
  apply simp
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   937
  done
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3139
diff changeset
   938
3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   939
(* FIXME: eqvt attribute *)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   940
lemma Sigma_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   941
  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
   942
unfolding Sigma_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   943
unfolding SUP_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   944
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   945
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   946
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   947
  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
   948
  auxiliary classes which specify that (op <=) and
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   949
  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
   950
  given.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   951
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   952
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   953
class le_eqvt =  order + 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   954
  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
   955
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   956
class inf_eqvt = complete_lattice +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   957
  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
   958
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   959
instantiation bool :: le_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   960
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   961
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   962
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   963
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   964
apply perm_simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   965
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   966
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   967
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   968
end
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
instantiation "fun" :: (pt, le_eqvt) le_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   971
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   972
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   973
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   974
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   975
unfolding le_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   976
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   977
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   978
done 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   979
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   980
end
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
instantiation bool :: inf_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   983
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   984
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   985
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   986
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   987
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   988
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   989
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   990
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   991
end
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
instantiation "fun" :: (pt, inf_eqvt) inf_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   994
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   995
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   996
instance 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   997
apply(default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   998
unfolding Inf_fun_def INF_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   999
apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1000
apply(rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1001
done 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1002
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1003
end
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
lemma lfp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1006
  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
  1007
  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
  1008
unfolding lfp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1009
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1010
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1011
lemma finite_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1012
  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
  1013
unfolding finite_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1014
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1015
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1016
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1017
subsubsection {* Equivariance for product operations *}
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
lemma fst_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1020
  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
  1021
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1022
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1023
lemma snd_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1024
  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
  1025
  by (cases x) simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1026
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1027
lemma split_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1028
  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
  1029
  unfolding split_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1030
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1031
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1032
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1033
subsubsection {* Equivariance for list operations *}
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
lemma append_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1036
  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
  1037
  by (induct xs) auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1038
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1039
lemma rev_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1040
  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
  1041
  by (induct xs) (simp_all add: append_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1042
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1043
lemma map_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1044
  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
  1045
  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
  1046
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1047
lemma removeAll_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1048
  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
  1049
  by (induct xs) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1050
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1051
lemma filter_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1052
  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
  1053
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1054
apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1055
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
  1056
apply(simp only: permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1057
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1058
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1059
lemma distinct_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1060
  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
  1061
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1062
apply(simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1063
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
  1064
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1065
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1066
lemma length_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1067
  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
  1068
by (induct xs) (simp_all add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1069
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1070
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1071
subsubsection {* Equivariance for @{typ "'a option"} *}
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
lemma option_map_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1074
  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
  1075
  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
  1076
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1077
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1078
subsubsection {* Equivariance for @{typ "'a fset"} *}
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
lemma in_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1081
  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
  1082
unfolding in_fset
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1083
by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1084
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1085
lemma union_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1086
  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
  1087
  by (induct S) (simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1088
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1089
lemma inter_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1090
  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
  1091
  unfolding list_eq_def inter_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1092
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1093
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1094
lemma inter_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1095
  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
  1096
  by (lifting inter_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1097
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1098
lemma sub_list_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1099
  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
  1100
  unfolding sub_list_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1101
  by perm_simp simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1102
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1103
lemma subset_fset_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1104
  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
  1105
  by (lifting sub_list_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1106
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1107
lemma map_fset_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1108
  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
  1109
  by (lifting map_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1110
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1111
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1112
section {* Supp, Freshness and Supports *}
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
context pt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1115
begin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1116
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1117
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1118
  supp :: "'a \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1119
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1120
  "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
  1121
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1122
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1123
  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
  1124
where   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1125
  "a \<sharp> x \<equiv> a \<notin> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1126
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1127
end
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
lemma supp_conv_fresh: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1130
  shows "supp x = {a. \<not> a \<sharp> x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1131
  unfolding fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1132
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1133
lemma swap_rel_trans:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1134
  assumes "sort_of a = sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1135
  assumes "sort_of b = sort_of c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1136
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1137
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1138
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1139
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1140
  assume "a = b \<or> c = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1141
  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
  1142
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1143
  assume *: "\<not> (a = b \<or> c = b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1144
  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
  1145
    using assms by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1146
  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
  1147
    using assms * by (simp add: swap_triple)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1148
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1149
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1150
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1151
lemma swap_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1152
  assumes a: "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1153
  and     b: "b \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1154
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1155
proof (cases)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1156
  assume asm: "sort_of a = sort_of b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1157
  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
  1158
    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
  1159
  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
  1160
  then obtain c 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1161
    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
  1162
    by (rule obtain_atom) (auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1163
  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
  1164
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1165
  assume "sort_of a \<noteq> sort_of b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1166
  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
  1167
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1168
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1169
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1170
subsection {* supp and fresh are equivariant *}
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1173
lemma supp_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1174
  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
  1175
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1176
  by (perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1177
     (simp only: permute_eqvt[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1178
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1179
lemma fresh_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1180
  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
  1181
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1182
  by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1183
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1184
lemma fresh_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1185
  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
  1186
  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
  1187
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1188
lemma fresh_permute_left:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1189
  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
  1190
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1191
  assume "a \<sharp> p \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1192
  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
  1193
  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
  1194
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1195
  assume "- p \<bullet> a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1196
  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
  1197
  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
  1198
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1199
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1200
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1201
section {* supports *}
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
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1204
  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
  1205
where  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1206
  "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
  1207
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1208
lemma supp_is_subset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1209
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1210
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1211
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1212
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1213
  shows "(supp x) \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1214
proof (rule ccontr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1215
  assume "\<not> (supp x \<subseteq> S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1216
  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
  1217
  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
  1218
  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
  1219
  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
  1220
  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
  1221
  with b1 show False by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1222
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1223
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1224
lemma supports_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1225
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1226
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1227
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1228
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1229
  shows "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1230
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1231
  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
  1232
  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
  1233
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1234
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1235
lemma supp_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1236
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1237
  shows "(supp x) supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1238
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1239
proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1240
  fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1241
  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
  1242
  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
  1243
  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
  1244
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1245
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1246
lemma supports_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1247
  fixes x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1248
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1249
  and     a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1250
  and     a3: "a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1251
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1252
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1253
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1254
  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
  1255
  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
  1256
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1257
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1258
lemma supp_is_least_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1259
  fixes S :: "atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1260
  and   x :: "'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1261
  assumes  a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1262
  and      a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1263
  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
  1264
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1265
proof (rule equalityI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1266
  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
  1267
  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
  1268
  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
  1269
  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
  1270
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1271
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1272
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1273
lemma subsetCI: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1274
  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
  1275
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1276
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1277
lemma finite_supp_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1278
  assumes a1: "S supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1279
  assumes a2: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1280
  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
  1281
  shows "(supp x) = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1282
  using a1 a2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1283
proof (rule supp_is_least_supports)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1284
  fix S'
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1285
  assume "finite S'" and "S' supports x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1286
  show "S \<subseteq> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1287
  proof (rule subsetCI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1288
    fix a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1289
    assume "a \<in> S" and "a \<notin> S'"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1290
    have "finite (S \<union> S')"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1291
      using `finite S` `finite S'` by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1292
    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
  1293
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1294
    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
  1295
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1296
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1297
      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
  1298
    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
  1299
      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
  1300
      by (rule a3)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1301
    ultimately show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1302
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1303
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1304
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1305
section {* Support w.r.t. relations *}
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
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1308
  This definition is used for unquotient types, where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1309
  alpha-equivalence does not coincide with equality.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1310
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1311
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1312
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1313
  "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
  1314
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1315
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1316
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1317
section {* Finitely-supported types *}
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
class fs = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1320
  assumes finite_supp: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1321
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1322
lemma pure_supp: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1323
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1324
  shows "supp x = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1325
  unfolding supp_def by (simp add: permute_pure)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1326
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1327
lemma pure_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1328
  fixes x::"'a::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1329
  shows "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1330
  unfolding fresh_def by (simp add: pure_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1331
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1332
instance pure < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1333
by default (simp add: pure_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1334
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1335
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1336
subsection  {* Type @{typ atom} is finitely-supported. *}
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
lemma supp_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1339
  shows "supp a = {a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1340
  by (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1341
     (auto simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1342
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1343
lemma fresh_atom: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1344
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1345
  unfolding fresh_def supp_atom by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1346
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1347
instance atom :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1348
by default (simp add: supp_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1349
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1350
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1351
section {* Type @{typ perm} is finitely-supported. *}
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
lemma perm_swap_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1354
  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
  1355
unfolding permute_perm_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1356
by (metis add_diff_cancel minus_perm_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1357
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1358
lemma supports_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1359
  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
  1360
  unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1361
  unfolding perm_swap_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1362
  by (simp add: swap_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1363
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1364
lemma finite_perm_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1365
  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
  1366
  unfolding permute_atom_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1367
  using finite_gpermute_neq .
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1368
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1369
lemma supp_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1370
  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
  1371
apply (rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1372
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
  1373
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
  1374
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1375
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1376
lemma fresh_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1377
  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
  1378
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1379
  by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1380
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1381
lemma supp_swap:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1382
  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
  1383
  by (auto simp add: supp_perm swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1384
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1385
lemma fresh_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1386
  shows "a \<sharp> (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1387
  unfolding fresh_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1388
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1389
lemma supp_zero_perm: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1390
  shows "supp (0::perm) = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1391
  unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1392
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1393
lemma fresh_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1394
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1395
  assumes "a \<sharp> p" "a \<sharp> q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1396
  shows "a \<sharp> (p + q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1397
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1398
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1399
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1400
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1401
lemma supp_plus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1402
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1403
  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
  1404
  by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1405
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1406
lemma fresh_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1407
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1408
  shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1409
  unfolding fresh_def supp_perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1410
  by (simp) (metis permute_minus_cancel(1))
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1411
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1412
lemma supp_minus_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1413
  fixes p::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1414
  shows "supp (- p) = supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1415
  unfolding supp_conv_fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1416
  by (simp add: fresh_minus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1417
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1418
lemma plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1419
  fixes p q::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1420
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1421
  shows "p + q = q + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1422
unfolding perm_eq_iff
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1423
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1424
  fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1425
  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
  1426
  proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1427
    { 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
  1428
      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
  1429
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1430
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1431
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1432
    { 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
  1433
      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
  1434
      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
  1435
      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
  1436
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1437
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1438
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1439
    { 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
  1440
      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
  1441
      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
  1442
      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
  1443
	by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1444
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1445
    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
  1446
      using asm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1447
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1448
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1449
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1450
lemma supp_plus_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1451
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1452
  assumes asm: "supp p \<inter> supp q = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1453
  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
  1454
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1455
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1456
    assume "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1457
    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
  1458
    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
  1459
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1460
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1461
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1462
  { fix a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1463
    assume "a \<in> supp q"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1464
    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
  1465
    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
  1466
      by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1467
    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
  1468
      by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1469
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1470
  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
  1471
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1472
  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
  1473
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1474
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1475
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1476
instance perm :: fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1477
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
  1478
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1479
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
section {* Finite Support instances for other types *}
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1484
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
  1485
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1486
lemma supp_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1487
  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
  1488
  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
  1489
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1490
lemma fresh_Pair: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1491
  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
  1492
  by (simp add: fresh_def supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1493
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1494
lemma supp_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1495
  shows "supp () = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1496
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1497
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1498
lemma fresh_Unit:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1499
  shows "a \<sharp> ()"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1500
  by (simp add: fresh_def supp_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1501
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1502
instance prod :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1503
  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
  1504
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1505
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1506
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
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
lemma supp_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1509
  shows "supp (Inl x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1510
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1511
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1512
lemma supp_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1513
  shows "supp (Inr x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1514
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1515
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1516
lemma fresh_Inl: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1517
  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
  1518
  by (simp add: fresh_def supp_Inl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1519
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1520
lemma fresh_Inr: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1521
  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
  1522
  by (simp add: fresh_def supp_Inr)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1523
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1524
instance sum :: (fs, fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1525
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1526
apply (case_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1527
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
  1528
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1529
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1530
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1531
subsection {* Type @{typ "'a option"} is finitely supported *}
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
lemma supp_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1534
  shows "supp None = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1535
by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1536
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1537
lemma supp_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1538
  shows "supp (Some x) = supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1539
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1540
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1541
lemma fresh_None: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1542
  shows "a \<sharp> None"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1543
  by (simp add: fresh_def supp_None)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1544
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1545
lemma fresh_Some: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1546
  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
  1547
  by (simp add: fresh_def supp_Some)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1548
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1549
instance option :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1550
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1551
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1552
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
  1553
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1554
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1555
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1556
subsubsection {* Type @{typ "'a list"} is finitely supported *}
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
lemma supp_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1559
  shows "supp [] = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1560
  by (simp add: supp_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1561
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1562
lemma fresh_Nil: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1563
  shows "a \<sharp> []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1564
  by (simp add: fresh_def supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1565
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1566
lemma supp_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1567
  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
  1568
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
  1569
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1570
lemma fresh_Cons: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1571
  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
  1572
  by (simp add: fresh_def supp_Cons)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1573
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1574
lemma supp_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1575
  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
  1576
  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
  1577
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1578
lemma fresh_append:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1579
  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
  1580
  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
  1581
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1582
lemma supp_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1583
  shows "supp (rev xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1584
  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
  1585
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1586
lemma fresh_rev:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1587
  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
  1588
  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
  1589
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1590
lemma supp_removeAll:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1591
  fixes x::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1592
  shows "supp (removeAll x xs) = supp xs - {x}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1593
  by (induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1594
     (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
  1595
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1596
lemma supp_of_atom_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1597
  fixes as::"atom list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1598
  shows "supp as = set as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1599
by (induct as)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1600
   (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
  1601
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1602
instance list :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1603
apply default
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1604
apply (induct_tac x)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1605
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
  1606
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1607
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1608
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1609
section {* Support and Freshness for Applications *}
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
lemma fresh_conv_MOST: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1612
  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
  1613
  unfolding fresh_def supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1614
  unfolding MOST_iff_cofinite by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1615
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1616
lemma fresh_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1617
  assumes "a \<sharp> f" and "a \<sharp> x" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1618
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1619
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1620
  unfolding fresh_conv_MOST
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1621
  unfolding permute_fun_app_eq
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1622
  by (elim MOST_rev_mp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1623
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1624
lemma supp_fun_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1625
  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
  1626
  using fresh_fun_app
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1627
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1628
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1629
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1630
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1631
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
  1632
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1633
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1634
  "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
  1635
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1636
lemma eqvt_boolI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1637
  fixes f::"bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1638
  shows "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1639
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1640
  by (simp add: permute_bool_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1641
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1642
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1643
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
  1644
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1645
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1646
 "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
  1647
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1648
lemma eqvtI:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1649
  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
  1650
unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1651
by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1652
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1653
lemma eqvt_at_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1654
  assumes "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1655
  shows "eqvt_at f (q \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1656
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1657
  { fix p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1658
    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
  1659
      using assms by (simp add: eqvt_at_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1660
    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
  1661
    also have "\<dots> = f ((p + q) \<bullet> x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1662
      using assms by (simp add: eqvt_at_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1663
    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
  1664
  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
  1665
    by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1666
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1667
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1668
lemma supp_fun_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1669
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1670
  shows "supp f = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1671
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1672
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1673
  unfolding supp_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1674
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1675
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1676
lemma fresh_fun_eqvt_app:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1677
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1678
  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
  1679
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1680
  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
  1681
  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
  1682
    unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1683
    using supp_fun_app by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1684
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1685
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1686
lemma supp_fun_app_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1687
  assumes a: "eqvt f"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1688
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1689
  using fresh_fun_eqvt_app[OF a]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1690
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1691
  by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1692
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1693
lemma supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1694
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1695
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1696
  shows "supp (f x) \<subseteq> supp x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1697
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1698
unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1699
unfolding fresh_def[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1700
using asm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1701
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
  1702
apply(rule fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1703
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1704
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1705
lemma finite_supp_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1706
  assumes asm: "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1707
  and     fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1708
  shows "finite (supp (f x))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1709
apply(rule finite_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1710
apply(rule supp_eqvt_at[OF asm fin])
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 fresh_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
  and     fresh: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1718
  shows "a \<sharp> f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1719
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1720
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1721
using supp_eqvt_at[OF asm fin]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1722
by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1723
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1724
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1725
subsection {* helper functions for nominal_functions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1726
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1727
lemma THE_defaultI2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1728
  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
  1729
  shows "Q (THE_default d P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1730
by (iprover intro: assms THE_defaultI')
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1731
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1732
lemma the_default_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1733
  assumes unique: "\<exists>!x. P x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1734
  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
  1735
  apply(rule THE_default1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1736
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1737
  apply(simp add: ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1738
  apply(rule unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1739
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1740
  apply(rule subst[OF permute_fun_app_eq])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1741
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1742
  apply(rule THE_defaultI'[OF unique])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1743
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1744
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1745
lemma fundef_ex1_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1746
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1747
  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
  1748
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1749
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1750
  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
  1751
  apply(simp only: f_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1752
  apply(subst the_default_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1753
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1754
  apply(rule THE_default1_equality [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1755
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1756
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1757
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1758
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1759
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1760
  apply(rule THE_defaultI2) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1761
  apply(rule_tac p="-p" in permute_boolE)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1762
  apply(perm_simp add: permute_minus_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1763
  apply(rule ex1)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1764
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1765
  using eqvt[simplified eqvt_def]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1766
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1767
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1768
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1769
lemma fundef_ex1_eqvt_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1770
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1771
  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
  1772
  assumes eqvt: "eqvt G"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1773
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1774
  shows "eqvt_at f x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1775
  unfolding eqvt_at_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1776
  using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1777
  by (auto intro: fundef_ex1_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1778
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1779
lemma fundef_ex1_prop:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1780
  fixes x::"'a::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1781
  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
  1782
  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
  1783
  assumes ex1: "\<exists>!y. G x y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1784
  shows "P x (f x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1785
  unfolding f_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1786
  using ex1
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1787
  apply(erule_tac ex1E)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1788
  apply(rule THE_defaultI2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1789
  apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1790
  apply(rule P_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1791
  apply(assumption)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1792
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1793
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1794
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1795
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
  1796
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1797
text {* support and freshness for atom sets *}
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 supp_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1800
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1801
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1802
  shows "supp S = S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1803
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1804
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1805
  apply(simp add: swap_set_not_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1806
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1807
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1808
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1809
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1810
lemma supp_cofinite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1811
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1812
  assumes "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1813
  shows "supp S = (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1814
  apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1815
  apply(simp add: supports_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1816
  apply(simp add: swap_set_both_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1817
  apply(rule assms)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1818
  apply(subst swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1819
  apply(simp add: swap_set_in)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1820
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1821
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1822
lemma fresh_finite_atom_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1823
  fixes S::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1824
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1825
  shows "a \<sharp> S \<longleftrightarrow> a \<notin> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1826
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1827
  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
  1828
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1829
lemma fresh_minus_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 "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
  1833
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1834
  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
  1835
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1836
lemma Union_supports_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1837
  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
  1838
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1839
  { fix a b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1840
    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
  1841
      unfolding permute_set_def by force
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1842
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1843
  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
  1844
    unfolding supports_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1845
    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
  1846
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1847
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1848
lemma Union_of_finite_supp_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1849
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1850
  assumes fin: "finite S"   
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1851
  shows "finite (\<Union>x\<in>S. supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1852
  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
  1853
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1854
lemma Union_included_in_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1855
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1856
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1857
  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
  1858
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1859
  have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1860
    unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1861
    by (perm_simp) (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1862
  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
  1863
    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
  1864
  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
  1865
  also have "\<dots> \<subseteq> supp S" using eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1866
    by (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1867
  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
  1868
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1869
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1870
lemma supp_of_finite_sets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1871
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1872
  assumes fin: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1873
  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
  1874
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1875
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1876
apply(rule Union_supports_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1877
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
  1878
apply(rule Union_included_in_supp[OF fin])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1879
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1880
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1881
lemma finite_sets_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1882
  fixes S::"('a::fs set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1883
  assumes "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1884
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1885
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1886
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
  1887
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1888
lemma supp_of_finite_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1889
  fixes S T::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1890
  assumes fin1: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1891
  and     fin2: "finite T"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1892
  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
  1893
  using fin1 fin2
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1894
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1895
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1896
lemma supp_of_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1897
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1898
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1899
  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
  1900
  using fin
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1901
  by (simp add: supp_of_finite_sets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1902
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1903
lemma fresh_finite_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1904
  fixes S::"('a::fs) set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1905
  assumes fin:  "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1906
  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
  1907
  using fin unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1908
  by (simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1909
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1910
lemma supp_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1911
  shows "supp {} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1912
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1913
  by (simp add: empty_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1914
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1915
lemma fresh_set_empty:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1916
  shows "a \<sharp> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1917
  by (simp add: fresh_def supp_set_empty)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1918
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1919
lemma supp_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1920
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1921
  shows "supp (set xs) = supp xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1922
apply(induct xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1923
apply(simp add: supp_set_empty supp_Nil)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1924
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
  1925
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1926
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1927
lemma fresh_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1928
  fixes xs :: "('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1929
  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
  1930
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1931
by (simp add: supp_set)
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1934
subsection {* Type @{typ "'a multiset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1935
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1936
lemma set_of_eqvt[eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1937
  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
  1938
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
  1939
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1940
lemma supp_set_of:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1941
  shows "supp (set_of M) \<subseteq> supp M"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1942
  apply (rule supp_fun_app_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1943
  unfolding eqvt_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1944
  apply(perm_simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1945
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1946
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1947
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1948
lemma Union_finite_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1949
  fixes M::"'a::fs multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1950
  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
  1951
proof - 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1952
  have "finite (\<Union>(supp ` {x. x \<in># M}))"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1953
    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
  1954
  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
  1955
    by (simp only: image_Collect)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1956
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1957
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1958
lemma Union_supports_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1959
  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
  1960
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1961
  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
  1962
    unfolding permute_multiset_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1963
    apply(induct M)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1964
    apply(simp_all)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1965
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1966
  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
  1967
    unfolding supports_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1968
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1969
    apply(rule sw)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1970
    apply(rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1971
    apply(simp_all only: fresh_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1972
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1973
    apply(metis neq0_conv)+
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1974
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1975
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1976
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1977
lemma Union_included_multiset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1978
  fixes M::"('a::fs multiset)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1979
  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
  1980
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1981
  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
  1982
  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
  1983
  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
  1984
  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
  1985
  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
  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 supp_of_multisets:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1989
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1990
  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
  1991
apply(rule subset_antisym)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1992
apply(rule supp_is_subset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1993
apply(rule Union_supports_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1994
apply(rule Union_finite_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1995
apply(rule Union_included_multiset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1996
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1997
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1998
lemma multisets_supp_finite:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  1999
  fixes M::"('a::fs multiset)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2000
  shows "finite (supp M)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2001
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
  2002
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2003
lemma supp_of_multiset_union:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2004
  fixes M N::"('a::fs) multiset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2005
  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
  2006
  by (auto simp add: supp_of_multisets)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2007
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2008
lemma supp_empty_mset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2009
  shows "supp {#} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2010
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2011
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2012
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2013
instance multiset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2014
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2015
  apply (rule multisets_supp_finite)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2016
  done
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
subsection {* Type @{typ "'a fset"} is finitely supported *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2019
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2020
lemma supp_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2021
  shows "supp (fset S) = supp S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2022
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2023
  by (simp add: fset_eqvt fset_cong)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2024
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2025
lemma supp_empty_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2026
  shows "supp {||} = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2027
  unfolding supp_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2028
  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2029
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2030
lemma fresh_empty_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2031
  shows "a \<sharp> {||}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2032
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2033
by (simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2034
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2035
lemma supp_insert_fset [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2036
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2037
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2038
  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
  2039
  apply(subst supp_fset[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2040
  apply(simp add: supp_of_finite_insert)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2041
  done
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
lemma fresh_insert_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2044
  fixes x::"'a::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2045
  and   S::"'a fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2046
  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
  2047
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2048
  by (simp)
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 fset_finite_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2051
  fixes S::"('a::fs) fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2052
  shows "finite (supp S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2053
  by (induct S) (simp_all add: finite_supp)
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_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2056
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2057
  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
  2058
by (induct S) (auto)
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_union_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2061
  fixes S T::"'a::fs fset"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2062
  shows "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
  2063
unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2064
by (simp add: supp_union_fset)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2065
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2066
instance fset :: (fs) fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2067
  apply (default)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2068
  apply (rule fset_finite_supp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2069
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2070
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2071
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2072
section {* Freshness and Fresh-Star *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2073
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2074
lemma fresh_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2075
  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
  2076
  by (simp add: fresh_Unit)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2077
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2078
lemma fresh_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2079
  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
  2080
  by rule (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2081
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2082
(* 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
  2083
(* added to the simplifier with mksimps                  *) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2084
lemma [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2085
  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
  2086
  by (simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2087
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2088
lemma fresh_PairD:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2089
  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
  2090
  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
  2091
  by (simp_all add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2092
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2093
declaration {* fn _ =>
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2094
let
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2095
  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
  2096
in
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2097
  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
  2098
end
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2099
*}
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
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
  2102
  induction principles. *}
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
definition 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2105
  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
  2106
where 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2107
  "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
  2108
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2109
lemma fresh_star_supp_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2110
  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
  2111
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
  2112
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2113
lemma fresh_star_perm_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2114
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2115
  assumes fresh: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2116
  and     fin: "finite as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2117
  shows "supp p \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2118
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2119
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
  2120
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2121
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2122
lemma fresh_star_atom_set_conv:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2123
  assumes fresh: "as \<sharp>* bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2124
  and     fin: "finite as" "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2125
  shows "bs \<sharp>* as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2126
using fresh
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2127
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2128
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
  2129
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2130
lemma atom_fresh_star_disjoint:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2131
  assumes fin: "finite bs" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2132
  shows "as \<sharp>* bs \<longleftrightarrow> (as \<inter> bs = {})"
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
unfolding fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2135
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
  2136
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2137
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2138
lemma fresh_star_Pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2139
  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
  2140
  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
  2141
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2142
lemma fresh_star_list:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2143
  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
  2144
  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
  2145
  and   "as \<sharp>* []"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2146
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
  2147
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2148
lemma fresh_star_set:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2149
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2150
  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
  2151
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2152
by (simp add: fresh_set)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2153
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2154
lemma fresh_star_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2155
  fixes a::"atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2156
  shows "as \<sharp>* {a} \<longleftrightarrow> as \<sharp>* a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2157
  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
  2158
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2159
lemma fresh_star_fset:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2160
  fixes xs::"('a::fs) list"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2161
  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
  2162
by (simp add: fresh_star_def fresh_def) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2163
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2164
lemma fresh_star_Un:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2165
  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
  2166
  by (auto simp add: fresh_star_def)
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_insert:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2169
  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
  2170
  by (auto simp add: fresh_star_def)
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_Un_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2173
  "((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
  2174
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2175
  apply(rule)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2176
  apply(erule meta_mp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2177
  apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2178
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2179
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2180
lemma fresh_star_insert_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2181
  "(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
  2182
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2183
  by rule (simp_all add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2184
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2185
lemma fresh_star_empty_elim:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2186
  "({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2187
  by (simp add: fresh_star_def)
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_Unit_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2190
  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
  2191
  by (simp add: fresh_star_def fresh_Unit) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2192
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2193
lemma fresh_star_Pair_elim: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2194
  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
  2195
  by (rule, simp_all add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2196
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2197
lemma fresh_star_zero:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2198
  shows "as \<sharp>* (0::perm)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2199
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2200
  by (simp add: fresh_zero_perm)
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_plus:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2203
  fixes p q::perm
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2204
  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
  2205
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2206
  by (simp add: fresh_plus_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2207
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2208
lemma fresh_star_permute_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2209
  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
  2210
  unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2211
  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
  2212
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2213
lemma fresh_star_eqvt [eqvt]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2214
  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
  2215
unfolding fresh_star_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2216
by (perm_simp) (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2217
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2218
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2219
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2220
section {* Induction principle for permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2221
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2222
lemma smaller_supp:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2223
  assumes a: "a \<in> supp p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2224
  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
  2225
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2226
  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
  2227
    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
  2228
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2229
  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
  2230
  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
  2231
  ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2232
  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
  2233
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2234
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2235
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2236
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
  2237
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2238
  and zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2239
  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
  2240
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2241
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2242
  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
  2243
  then show "P p" using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2244
  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
  2245
    case (psubset p)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2246
    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
  2247
    have as: "supp p \<subseteq> S" by fact
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2248
    { assume "supp p = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2249
      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
  2250
      then have "P p" using zero by simp
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
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2253
    { assume "supp p \<noteq> {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2254
      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
  2255
      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
  2256
        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
  2257
      let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2258
      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
  2259
      then have "P ?q" using ih by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2260
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2261
      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
  2262
      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
  2263
      moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2264
      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
  2265
      ultimately have "P p" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2266
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2267
    ultimately show "P p" by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2268
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2269
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2270
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2271
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
  2272
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2273
  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
  2274
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2275
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
  2276
   (auto intro: zero swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2277
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2278
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
  2279
  assumes S: "supp p \<subseteq> S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2280
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2281
  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
  2282
  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
  2283
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2284
using S
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2285
by (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2286
   (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
  2287
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2288
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
  2289
  assumes zero: "P 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2290
  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
  2291
  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
  2292
  shows "P p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2293
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
  2294
   (auto intro: zero swap plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2295
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2296
lemma supp_perm_singleton:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2297
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2298
  shows "supp p \<subseteq> {b} \<longleftrightarrow> p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2299
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2300
  { assume "supp p \<subseteq> {b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2301
    then have "p = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2302
      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
  2303
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2304
  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
  2305
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2306
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2307
lemma supp_perm_pair:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2308
  fixes p::"perm"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2309
  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
  2310
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2311
  { assume "supp p \<subseteq> {a, b}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2312
    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
  2313
      apply (induct p rule: perm_struct_induct) 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2314
      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
  2315
      apply (simp add: swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2316
      done
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
  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
  2319
    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
  2320
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2321
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2322
lemma supp_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2323
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2324
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2325
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2326
  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
  2327
    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
  2328
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2329
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2330
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2331
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2332
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2333
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2334
    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
  2335
    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
  2336
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2337
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2338
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2339
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
  2340
lemma supp_perm_eq_test:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2341
  assumes "(supp x) \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2342
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2343
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2344
  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
  2345
    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
  2346
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2347
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2348
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2349
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2350
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2351
    case (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2352
    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
  2353
    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
  2354
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2355
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2356
    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
  2357
    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
  2358
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2359
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2360
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2361
lemma perm_supp_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2362
  assumes a: "(supp p) \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2363
  shows "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2364
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2365
  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
  2366
    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
  2367
  then show "p \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2368
  proof (induct p rule: perm_struct_induct2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2369
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2370
    show "0 \<bullet> x = x" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2371
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2372
    case (swap a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2373
    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
  2374
    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
  2375
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2376
    case (plus p1 p2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2377
    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
  2378
    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
  2379
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2380
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2381
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2382
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2383
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2384
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2385
lemma supp_perm_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2386
  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
  2387
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2388
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2389
  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
  2390
  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
  2391
    unfolding supp_perm by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2392
  then have "supp x \<sharp>* (-q + p)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2393
    unfolding fresh_star_def fresh_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2394
  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
  2395
  then show "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2396
    by (metis permute_minus_cancel(1) permute_plus)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2397
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2398
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2399
text {* disagreement set *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2400
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2401
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2402
  dset :: "perm \<Rightarrow> perm \<Rightarrow> atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2403
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2404
  "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
  2405
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2406
lemma ds_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2407
  assumes "dset p q \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2408
  shows "p \<bullet> x = q \<bullet> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2409
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2410
unfolding dset_def fresh_star_def fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2411
by (auto intro: supp_perm_perm_eq)
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
lemma atom_set_perm_eq:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2414
  assumes a: "as \<sharp>* p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2415
  shows "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2416
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2417
  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
  2418
    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
  2419
  then show "p \<bullet> as = as"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2420
  proof (induct p rule: perm_struct_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2421
    case zero
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2422
    show "0 \<bullet> as = as" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2423
  next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2424
    case (swap p a b)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2425
    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
  2426
    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
  2427
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2428
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2429
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2430
section {* Avoiding of atom sets *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2431
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2432
text {* 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2433
  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
  2434
  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
  2435
  which 'translates' between both sets.
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2436
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2437
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2438
lemma at_set_avoiding_aux:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2439
  fixes Xs::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2440
  and   As::"atom set"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2441
  assumes b: "Xs \<subseteq> As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2442
  and     c: "finite As"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2443
  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
  2444
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2445
  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
  2446
  then show ?thesis using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2447
  proof (induct rule: finite_subset_induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2448
    case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2449
    have "0 \<bullet> {} \<inter> As = {}" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2450
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2451
    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
  2452
    ultimately show ?case by blast
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 (insert x Xs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2455
    then obtain p where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2456
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2457
      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
  2458
    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
  2459
    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
  2460
    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
  2461
    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
  2462
      using `finite As` `finite Xs`
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2463
      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
  2464
    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
  2465
      by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2466
    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
  2467
      by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2468
    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
  2469
      by (auto simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2470
    let ?q = "(x \<rightleftharpoons> y) + p"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2471
    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
  2472
      unfolding insert_eqvt
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2473
      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
  2474
      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
  2475
      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
  2476
    have "?q \<bullet> insert x Xs \<inter> As = {}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2477
      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
  2478
      unfolding q by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2479
    moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2480
    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
  2481
      unfolding supp_swap by (simp add: supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2482
    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
  2483
      by (simp add: supp_plus_perm_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2484
    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
  2485
      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
  2486
      by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2487
    ultimately show ?case by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2488
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2489
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2490
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2491
lemma at_set_avoiding:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2492
  assumes a: "finite Xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2493
  and     b: "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2494
  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
  2495
  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
  2496
  unfolding fresh_star_def fresh_def by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2497
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2498
lemma at_set_avoiding1:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2499
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2500
  and     "finite (supp c)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2501
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2502
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2503
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
  2504
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2505
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2506
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2507
lemma at_set_avoiding2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2508
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2509
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2510
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2511
  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
  2512
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2513
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
  2514
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2515
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2516
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2517
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2518
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2519
done
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_avoiding3:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2522
  assumes "finite xs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2523
  and     "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2524
  and     "xs \<sharp>* x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2525
  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
  2526
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2527
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
  2528
apply(simp add: supp_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2529
apply(rule_tac x="p" in exI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2530
apply(simp add: fresh_star_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2531
apply(rule fresh_star_supp_conv)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2532
apply(auto simp add: fresh_star_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2533
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2534
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2535
lemma at_set_avoiding2_atom:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2536
  assumes "finite (supp c)" "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2537
  and     b: "a \<sharp> x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2538
  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
  2539
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2540
  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
  2541
  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
  2542
    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
  2543
  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
  2544
    unfolding fresh_star_def Ball_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2545
    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
  2546
  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
  2547
  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
  2548
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2549
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
section {* Renaming permutations *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2552
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2553
lemma set_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2554
  assumes b: "finite bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2555
  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
  2556
using b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2557
proof (induct)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2558
  case empty
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2559
  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
  2560
    by (simp add: permute_set_def supp_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2561
  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
  2562
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2563
  case (insert a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2564
  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
  2565
  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
  2566
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2567
  { assume 1: "q \<bullet> a = p \<bullet> a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2568
    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
  2569
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2570
    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
  2571
      using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2572
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2573
    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
  2574
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2575
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2576
  { 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
  2577
    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
  2578
    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
  2579
      by (auto simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2580
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2581
    { 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
  2582
	using ** 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2583
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2584
	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
  2585
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2586
	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
  2587
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2588
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2589
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2590
      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
  2591
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2592
      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
  2593
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2594
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2595
      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
  2596
        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
  2597
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2598
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2599
    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
  2600
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2601
  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
  2602
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2603
qed
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
lemma set_renaming_perm2:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2606
  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
  2607
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2608
  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
  2609
  then obtain q 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2610
    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
  2611
    using set_renaming_perm by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2612
  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
  2613
  moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2614
  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
  2615
    apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2616
    apply(subgoal_tac "b \<notin> supp q")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2617
    apply(simp add: fresh_def[symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2618
    apply(simp add: fresh_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2619
    apply(clarify)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2620
    apply(rotate_tac 2)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2621
    apply(drule subsetD[OF **])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2622
    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
  2623
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2624
  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
  2625
  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
  2626
qed
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
lemma list_renaming_perm:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2629
  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
  2630
proof (induct bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2631
  case (Cons a bs)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2632
  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
  2633
  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
  2634
    by (blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2635
  { assume 1: "a \<in> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2636
    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
  2637
    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
  2638
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2639
    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
  2640
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2641
    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
  2642
  }
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
  { assume 2: "a \<notin> set bs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2645
    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
  2646
    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
  2647
      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
  2648
    moreover 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2649
    { 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
  2650
	using **
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2651
	apply (auto simp add: supp_perm insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2652
	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
  2653
	apply(auto)[1]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2654
	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
  2655
	apply(blast)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2656
	apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2657
	done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2658
      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
  2659
      moreover
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2660
      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
  2661
	using ** by (auto simp add: insert_eqvt)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2662
      ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2663
      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
  2664
        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
  2665
    }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2666
    ultimately 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2667
    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
  2668
  }
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2669
  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
  2670
    by blast
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2671
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2672
 case Nil
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2673
  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
  2674
    by (simp add: supp_zero_perm)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2675
  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
  2676
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2677
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2678
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2679
section {* Concrete Atoms Types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2680
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2681
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2682
  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
  2683
  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
  2684
*}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2685
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2686
class at_base = pt +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2687
  fixes atom :: "'a \<Rightarrow> atom"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2688
  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
  2689
  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
  2690
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2691
declare atom_eqvt[eqvt]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2692
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2693
class at = at_base +
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2694
  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
  2695
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2696
lemma sort_ineq [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2697
  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
  2698
  shows "atom a \<noteq> atom b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2699
using assms by metis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2700
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2701
lemma supp_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2702
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2703
  shows "supp a = {atom a}"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2704
  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
  2705
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2706
lemma fresh_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2707
  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
  2708
  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
  2709
  unfolding fresh_def 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2710
  apply(simp_all add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2711
  apply(metis)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2712
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2713
  
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2714
lemma fresh_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2715
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2716
  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
  2717
  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
  2718
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2719
lemma fresh_star_atom_at_base: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2720
  fixes b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2721
  shows "as \<sharp>* atom b \<longleftrightarrow> as \<sharp>* b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2722
  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
  2723
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2724
instance at_base < fs
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2725
proof qed (simp add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2726
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2727
lemma at_base_infinite [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2728
  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
  2729
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2730
  obtain a :: 'a where "True" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2731
  assume "finite ?U"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2732
  hence "finite (atom ` ?U)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2733
    by (rule finite_imageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2734
  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
  2735
    by (rule obtain_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2736
  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
  2737
    unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2738
    by (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2739
  hence "b \<in> atom ` ?U" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2740
  with b(1) show "False" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2741
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2742
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2743
lemma swap_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2744
  fixes x y::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2745
  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
  2746
  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
  2747
  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
  2748
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2749
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2750
  by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2751
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2752
lemma obtain_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2753
  assumes X: "finite X"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2754
  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
  2755
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2756
  have "inj (atom :: 'a \<Rightarrow> atom)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2757
    by (simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2758
  with X have "finite (atom -` X :: 'a set)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2759
    by (rule finite_vimageI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2760
  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
  2761
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2762
  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
  2763
    by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2764
  thus ?thesis ..
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2765
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2766
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2767
lemma obtain_fresh':
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2768
  assumes fin: "finite (supp x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2769
  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
  2770
using obtain_at_base[where X="supp x"]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2771
by (auto simp add: fresh_def fin)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2772
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2773
lemma obtain_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2774
  fixes x::"'b::fs"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2775
  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
  2776
  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
  2777
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2778
lemma supp_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2779
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2780
  shows "supp S = atom ` S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2781
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
  2782
apply(simp add: supp_at_base)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2783
apply(auto)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2784
done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2785
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2786
(* FIXME 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2787
lemma supp_cofinite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2788
  assumes a: "finite (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2789
  shows "supp S = atom ` (UNIV - S)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2790
apply(rule finite_supp_unique)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2791
*)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2792
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2793
lemma fresh_finite_set_at_base:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2794
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2795
  assumes a: "finite S"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2796
  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
  2797
  unfolding fresh_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2798
  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
  2799
  apply(subst inj_image_mem_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2800
  apply(simp add: inj_on_def)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2801
  apply(simp)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2802
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2803
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2804
lemma fresh_at_base_permute_iff [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2805
  fixes a::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2806
  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
  2807
  unfolding atom_eqvt[symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2808
  by (simp add: fresh_permute_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2809
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2810
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2811
section {* Infrastructure for concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2812
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2813
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2814
  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
  2815
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2816
  "(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2817
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2818
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2819
  unfolding flip_def by (rule swap_self)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2820
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2821
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
  2822
  unfolding flip_def by (rule swap_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2823
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2824
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
  2825
  unfolding flip_def by (rule minus_swap)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2826
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2827
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
  2828
  unfolding flip_def by (rule swap_cancel)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2829
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2830
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
  2831
  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
  2832
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2833
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
  2834
  by (simp add: flip_commute)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2835
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2836
lemma flip_eqvt [eqvt]: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2837
  fixes a b c::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2838
  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
  2839
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2840
  by (simp add: swap_eqvt atom_eqvt)
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 flip_at_base_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2843
  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
  2844
  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
  2845
  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
  2846
  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
  2847
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2848
  unfolding atom_eq_iff [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2849
  unfolding atom_eqvt [symmetric]
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2850
  by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2851
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2852
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
  2853
  only for single sort atoms from at *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2854
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2855
lemma permute_flip_at:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2856
  fixes a b c::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2857
  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
  2858
  unfolding flip_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2859
  apply (rule atom_eq_iff [THEN iffD1])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2860
  apply (subst atom_eqvt [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2861
  apply (simp add: swap_atom)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2862
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2863
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2864
lemma flip_at_simps [simp]:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2865
  fixes a b::"'a::at"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2866
  shows "(a \<leftrightarrow> b) \<bullet> a = b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2867
  and   "(a \<leftrightarrow> b) \<bullet> b = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2868
  unfolding permute_flip_at by simp_all
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2869
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2870
lemma flip_fresh_fresh:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2871
  fixes a b::"'a::at_base"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2872
  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
  2873
  shows "(a \<leftrightarrow> b) \<bullet> x = x"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2874
using assms
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2875
by (simp add: flip_def swap_fresh_fresh)
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
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2878
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2879
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
  2880
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2881
syntax
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2882
  "_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
  2883
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2884
translations
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2885
  "_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
  2886
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
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
  2889
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2890
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
  2891
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
  2892
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2893
text {*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2894
  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
  2895
*}
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 exists_eq_simple_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2898
  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
  2899
  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
  2900
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2901
lemma exists_eq_sort: 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2902
  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
  2903
  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
  2904
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2905
lemma at_base_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2906
  fixes sort_fun :: "'b \<Rightarrow> atom_sort"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2907
  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
  2908
  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
  2909
  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
  2910
  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
  2911
  shows "OFCLASS('a, at_base_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2912
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2913
  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
  2914
  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
  2915
  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
  2916
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2917
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2918
  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
  2919
    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
  2920
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2921
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2922
  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
  2923
    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
  2924
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2925
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2926
(*
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2927
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2928
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2929
  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
  2930
  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
  2931
  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
  2932
  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
  2933
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2934
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2935
  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
  2936
  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
  2937
  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
  2938
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2939
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2940
  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
  2941
    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
  2942
  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
  2943
    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
  2944
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2945
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2946
  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
  2947
    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
  2948
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2949
*)
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
lemma at_class:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2952
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2953
  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
  2954
  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
  2955
  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
  2956
  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
  2957
  shows "OFCLASS('a, at_class)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2958
proof
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2959
  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
  2960
  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
  2961
  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
  2962
  show "0 \<bullet> a = a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2963
    unfolding permute_def by (simp add: Rep_inverse)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2964
  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
  2965
    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
  2966
  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
  2967
    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
  2968
  show "atom a = atom b \<longleftrightarrow> a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2969
    unfolding atom_def by (simp add: Rep_inject)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2970
  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
  2971
    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
  2972
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2973
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2974
lemma at_class_sort:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2975
  fixes s :: atom_sort
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2976
  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
  2977
  fixes a::"'a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2978
  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
  2979
  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
  2980
  shows "sort_of (atom a) = s"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2981
  using atom_def type
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2982
  unfolding type_definition_def by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2983
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2984
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2985
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2986
  (@{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
  2987
setup {* Sign.add_const_constraint
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2988
  (@{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
  2989
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2990
section {* The freshness lemma according to Andy Pitts *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2991
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2992
lemma freshness_lemma:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2993
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2994
  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
  2995
  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
  2996
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2997
  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
  2998
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  2999
  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
  3000
  proof (intro exI allI impI)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3001
    fix a :: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3002
    assume a3: "atom a \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3003
    show "h a = h b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3004
    proof (cases "a = b")
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3005
      assume "a = b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3006
      thus "h a = h b" by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3007
    next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3008
      assume "a \<noteq> b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3009
      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
  3010
      with a3 have "atom a \<sharp> h b" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3011
        by (rule fresh_fun_app)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3012
      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
  3013
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3014
      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
  3015
        by (rule swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3016
      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
  3017
      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
  3018
        by (rule permute_fun_app_eq)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3019
      also have "\<dots> = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3020
        using d2 by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3021
      finally show "h a = h b"  by simp
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3022
    qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3023
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3024
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3025
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3026
lemma freshness_lemma_unique:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3027
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3028
  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
  3029
  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
  3030
proof (rule ex_ex1I)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3031
  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
  3032
    by (rule freshness_lemma)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3033
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3034
  fix x y
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3035
  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
  3036
  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
  3037
  from a x y show "x = y"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3038
    by (auto simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3039
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3040
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3041
text {* packaging the freshness lemma into a function *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3042
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3043
definition
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3044
  fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3045
where
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3046
  "fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3047
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3048
lemma fresh_fun_apply:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3049
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3050
  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
  3051
  assumes b: "atom a \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3052
  shows "fresh_fun h = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3053
unfolding fresh_fun_def
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3054
proof (rule the_equality)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3055
  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
  3056
  proof (intro strip)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3057
    fix a':: 'a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3058
    assume c: "atom a' \<sharp> h"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3059
    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
  3060
    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
  3061
  qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3062
next
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3063
  fix fr :: 'b
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3064
  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
  3065
  with b show "fr = h a" by auto
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3066
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3067
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3068
lemma fresh_fun_apply':
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3069
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3070
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3071
  shows "fresh_fun h = h a"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3072
  apply (rule fresh_fun_apply)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3073
  apply (auto simp add: fresh_Pair intro: a)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3074
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3075
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3076
lemma fresh_fun_eqvt:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3077
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3078
  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
  3079
  shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3080
  using a
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3081
  apply (clarsimp simp add: fresh_Pair)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3082
  apply (subst fresh_fun_apply', assumption+)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3083
  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
  3084
  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
  3085
  apply (simp only: atom_eqvt permute_fun_app_eq [where f=h])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3086
  apply (erule (1) fresh_fun_apply' [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3087
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3088
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3089
lemma fresh_fun_supports:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3090
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3091
  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
  3092
  shows "(supp h) supports (fresh_fun h)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3093
  apply (simp add: supports_def fresh_def [symmetric])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3094
  apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3095
  done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3096
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3097
notation fresh_fun (binder "FRESH " 10)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3098
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3099
lemma FRESH_f_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3100
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3101
  fixes f :: "'b \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3102
  assumes P: "finite (supp P)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3103
  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
  3104
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3105
  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
  3106
  show "(FRESH x. f (P x)) = f (FRESH x. P x)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3107
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3108
    apply (cut_tac `atom a \<sharp> P`)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3109
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3110
    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
  3111
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3112
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3113
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3114
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3115
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3116
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3117
lemma FRESH_binop_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3118
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3119
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3120
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3121
  assumes P: "finite (supp P)" 
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3122
  and     Q: "finite (supp Q)"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3123
  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
  3124
proof -
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3125
  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
  3126
  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
  3127
  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
  3128
  show ?thesis
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3129
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3130
    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
  3131
    apply (simp add: fresh_conv_MOST)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3132
    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
  3133
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3134
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3135
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3136
    apply (rule refl)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3137
    done
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3138
qed
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3139
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3140
lemma FRESH_conj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3141
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3142
  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
  3143
  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
  3144
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3145
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3146
lemma FRESH_disj_iff:
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3147
  fixes P Q :: "'a::at \<Rightarrow> bool"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3148
  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
  3149
  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
  3150
using P Q by (rule FRESH_binop_iff)
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3151
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3152
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3153
section {* Library functions for the nominal infrastructure *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3154
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3155
use "nominal_library.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3156
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3157
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3158
section {* Automation for creating concrete atom types *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3159
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3160
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
  3161
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3162
use "nominal_atoms.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3163
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3164
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3165
section {* automatic equivariance procedure for inductive definitions *}
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3166
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3167
use "nominal_eqvt.ML"
e05c033d69c1 Alternate version of Nominal_Base: Executable version.
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
  3168
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3169
instantiation atom_sort :: ord begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3170
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3171
fun less_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3172
  "less_atom_sort (Sort s1 l1) (Sort s2 []) \<longleftrightarrow> s1 < s2"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3173
| "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
  3174
| "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
  3175
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3176
definition less_eq_atom_sort where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3177
  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
  3178
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3179
instance ..
3139
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
end
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3182
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3183
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
  3184
  by (induct l1 l2 rule: list_induct2') auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3185
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3186
lemma not_as_le_as: "\<not>((x :: atom_sort) < x)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3187
  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
  3188
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3189
instance atom_sort :: linorder
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3190
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
  3191
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3192
  assume x: "x < y" "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3193
  then show False
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3194
    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
  3195
  with x show "x = y"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3196
    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
  3197
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3198
  fix x y z :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3199
  assume "x < y" "y < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3200
  then show "x < z"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3201
    apply (induct x z arbitrary: y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3202
    apply (case_tac [!] y) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3203
    apply (case_tac [!] list2) apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3204
    apply (case_tac l1) apply auto[2]
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3205
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3206
next
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3207
  fix x y :: atom_sort
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3208
  assume x: "\<not>x < y" "y \<noteq> x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3209
  then show "y < x"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3210
    apply (induct x y rule: less_atom_sort.induct)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3211
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3212
    apply (case_tac [!] l1)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3213
    apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3214
    done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3215
qed
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3216
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3217
instantiation atom :: linorder begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3218
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3219
definition less_eq_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3220
  [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
  3221
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3222
definition less_atom where
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3223
  [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
  3224
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3225
instance apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3226
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3227
  apply (case_tac x, case_tac y)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3228
  apply auto
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3229
  done
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3230
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3231
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3232
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3233
lemma [code]:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3234
  "gpermute p = perm_apply (dest_perm p)"
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3235
  apply transfer
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3236
  unfolding Rel_def
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3237
  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
  3238
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3239
instantiation perm :: equal begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3240
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3241
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
  3242
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3243
instance
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3244
  apply default
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3245
  unfolding equal_perm_def perm_eq_rep ..
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
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3248
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3249
(* Test: export_code swap in SML *)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3250
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3147
diff changeset
  3251
end