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