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