Nominal/Nominal2_Base.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 29 Nov 2010 05:10:02 +0000
changeset 2589 9781db0e2196
parent 2588 8f5420681039
child 2591 35c570891a3a
permissions -rw-r--r--
completed proofs in Foo2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     1
(*  Title:      Nominal2_Base
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     2
    Authors:    Brian Huffman, Christian Urban
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     3
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     4
    Basic definitions and lemma infrastructure for 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     5
    Nominal Isabelle. 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     6
*)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     7
theory Nominal2_Base
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     8
imports Main Infinite_Set
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
     9
        "~~/src/HOL/Quotient_Examples/FSet"
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
    10
uses ("nominal_library.ML")
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
    11
     ("nominal_atoms.ML")
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    12
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    13
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    14
section {* Atoms and Sorts *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    15
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    16
text {* A simple implementation for atom_sorts is strings. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    17
(* types atom_sort = string *)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    18
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    19
text {* To deal with Church-like binding we use trees of  
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    20
  strings as sorts. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    21
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    22
datatype atom_sort = Sort "string" "atom_sort list"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    23
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    24
datatype atom = Atom atom_sort nat
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    25
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    26
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    27
text {* Basic projection function. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    28
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    29
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    30
  sort_of :: "atom \<Rightarrow> atom_sort"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    31
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    32
  "sort_of (Atom s i) = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    33
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    34
primrec
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    35
  nat_of :: "atom \<Rightarrow> nat"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    36
where
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    37
  "nat_of (Atom s n) = n"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    38
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    39
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    40
text {* There are infinitely many atoms of each sort. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    41
lemma INFM_sort_of_eq: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    42
  shows "INFM a. sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    43
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    44
  have "INFM i. sort_of (Atom s i) = s" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    45
  moreover have "inj (Atom s)" by (simp add: inj_on_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    46
  ultimately show "INFM a. sort_of a = s" by (rule INFM_inj)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    47
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    48
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    49
lemma infinite_sort_of_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    50
  shows "infinite {a. sort_of a = s}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    51
  using INFM_sort_of_eq unfolding INFM_iff_infinite .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    52
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    53
lemma atom_infinite [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    54
  shows "infinite (UNIV :: atom set)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    55
  using subset_UNIV infinite_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    56
  by (rule infinite_super)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    57
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    58
lemma obtain_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    59
  fixes X :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    60
  assumes X: "finite X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    61
  obtains a where "a \<notin> X" "sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    62
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    63
  from X have "MOST a. a \<notin> X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    64
    unfolding MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    65
  with INFM_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    66
  have "INFM a. sort_of a = s \<and> a \<notin> X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    67
    by (rule INFM_conjI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    68
  then obtain a where "a \<notin> X" "sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    69
    by (auto elim: INFM_E)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    70
  then show ?thesis ..
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    71
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    72
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    73
lemma atom_components_eq_iff:
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    74
  fixes a b :: atom
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    75
  shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    76
  by (induct a, induct b, simp)
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    77
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    78
section {* Sort-Respecting Permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    79
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    80
typedef perm =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    81
  "{f. bij f \<and> finite {a. f a \<noteq> a} \<and> (\<forall>a. sort_of (f a) = sort_of a)}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    82
proof
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    83
  show "id \<in> ?perm" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    84
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    85
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    86
lemma permI:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    87
  assumes "bij f" and "MOST x. f x = x" and "\<And>a. sort_of (f a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    88
  shows "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    89
  using assms unfolding perm_def MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    90
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    91
lemma perm_is_bij: "f \<in> perm \<Longrightarrow> bij f"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    92
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    93
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    94
lemma perm_is_finite: "f \<in> perm \<Longrightarrow> finite {a. f a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    95
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    96
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    97
lemma perm_is_sort_respecting: "f \<in> perm \<Longrightarrow> sort_of (f a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    98
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    99
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   100
lemma perm_MOST: "f \<in> perm \<Longrightarrow> MOST x. f x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   101
  unfolding perm_def MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   102
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   103
lemma perm_id: "id \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   104
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   105
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   106
lemma perm_comp:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   107
  assumes f: "f \<in> perm" and g: "g \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   108
  shows "(f \<circ> g) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   109
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   110
apply (rule bij_comp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   111
apply (rule perm_is_bij [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   112
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   113
apply (rule MOST_rev_mp [OF perm_MOST [OF g]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   114
apply (rule MOST_rev_mp [OF perm_MOST [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   115
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   116
apply (simp add: perm_is_sort_respecting [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   117
apply (simp add: perm_is_sort_respecting [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   118
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   119
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   120
lemma perm_inv:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   121
  assumes f: "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   122
  shows "(inv f) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   123
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   124
apply (rule bij_imp_bij_inv)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   125
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   126
apply (rule MOST_mono [OF perm_MOST [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   127
apply (erule subst, rule inv_f_f)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   128
apply (rule bij_is_inj [OF perm_is_bij [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   129
apply (rule perm_is_sort_respecting [OF f, THEN sym, THEN trans])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   130
apply (simp add: surj_f_inv_f [OF bij_is_surj [OF perm_is_bij [OF f]]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   131
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   132
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   133
lemma bij_Rep_perm: "bij (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   134
  using Rep_perm [of p] unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   135
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   136
lemma finite_Rep_perm: "finite {a. Rep_perm p a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   137
  using Rep_perm [of p] unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   138
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   139
lemma sort_of_Rep_perm: "sort_of (Rep_perm p a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   140
  using Rep_perm [of p] unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   141
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   142
lemma Rep_perm_ext:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   143
  "Rep_perm p1 = Rep_perm p2 \<Longrightarrow> p1 = p2"
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   144
  by (simp add: fun_eq_iff Rep_perm_inject [symmetric])
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   145
2560
82e37a4595c7 automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents: 2507
diff changeset
   146
instance perm :: size ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   147
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   148
subsection {* Permutations form a group *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   149
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   150
instantiation perm :: group_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   151
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   152
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   153
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   154
  "0 = Abs_perm id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   155
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   156
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   157
  "- p = Abs_perm (inv (Rep_perm p))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   158
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   159
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   160
  "p + q = Abs_perm (Rep_perm p \<circ> Rep_perm q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   161
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   162
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   163
  "(p1::perm) - p2 = p1 + - p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   164
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   165
lemma Rep_perm_0: "Rep_perm 0 = id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   166
  unfolding zero_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   167
  by (simp add: Abs_perm_inverse perm_id)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   168
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   169
lemma Rep_perm_add:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   170
  "Rep_perm (p1 + p2) = Rep_perm p1 \<circ> Rep_perm p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   171
  unfolding plus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   172
  by (simp add: Abs_perm_inverse perm_comp Rep_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
lemma Rep_perm_uminus:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   175
  "Rep_perm (- p) = inv (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
  unfolding uminus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
  by (simp add: Abs_perm_inverse perm_inv Rep_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   178
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   179
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   180
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   181
unfolding Rep_perm_inject [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   182
unfolding minus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   183
unfolding Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   184
unfolding Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   185
unfolding Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
by (simp_all add: o_assoc inv_o_cancel [OF bij_is_inj [OF bij_Rep_perm]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   188
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
section {* Implementation of swappings *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   193
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   194
  swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   195
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   196
  "(a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   197
    Abs_perm (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   198
              then (\<lambda>c. if a = c then b else if b = c then a else c) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   199
              else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   200
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   201
lemma Rep_perm_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   202
  "Rep_perm (a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
    (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
     then (\<lambda>c. if a = c then b else if b = c then a else c)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
     else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   206
unfolding swap_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   207
apply (rule Abs_perm_inverse)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   208
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   209
apply (auto simp add: bij_def inj_on_def surj_def)[1]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
apply (rule MOST_rev_mp [OF MOST_neq(1) [of a]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
apply (rule MOST_rev_mp [OF MOST_neq(1) [of b]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   212
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   213
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   214
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   215
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   216
lemmas Rep_perm_simps =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   217
  Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   218
  Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   219
  Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   220
  Rep_perm_swap
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   221
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   222
lemma swap_different_sorts [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
  "sort_of a \<noteq> sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) = 0"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
  by (rule Rep_perm_ext) (simp add: Rep_perm_simps)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   225
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   226
lemma swap_cancel:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
  "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   228
  by (rule Rep_perm_ext) 
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   229
     (simp add: Rep_perm_simps fun_eq_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   231
lemma swap_self [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   232
  "(a \<rightleftharpoons> a) = 0"
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   233
  by (rule Rep_perm_ext, simp add: Rep_perm_simps fun_eq_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   234
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   235
lemma minus_swap [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   236
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   237
  by (rule minus_unique [OF swap_cancel])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   238
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   239
lemma swap_commute:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   240
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   241
  by (rule Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   242
     (simp add: Rep_perm_swap fun_eq_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   244
lemma swap_triple:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   245
  assumes "a \<noteq> b" and "c \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
  assumes "sort_of a = sort_of b" "sort_of b = sort_of c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
  shows "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   248
  using assms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   249
  by (rule_tac Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   250
     (auto simp add: Rep_perm_simps fun_eq_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   251
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   252
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   253
section {* Permutation Types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   255
text {*
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   256
  Infix syntax for @{text permute} has higher precedence than
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
  addition, but lower than unary minus.
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   258
*}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   259
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
class pt =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   261
  fixes permute :: "perm \<Rightarrow> 'a \<Rightarrow> 'a" ("_ \<bullet> _" [76, 75] 75)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   262
  assumes permute_zero [simp]: "0 \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   263
  assumes permute_plus [simp]: "(p + q) \<bullet> x = p \<bullet> (q \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   264
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   265
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
lemma permute_diff [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
  shows "(p - q) \<bullet> x = p \<bullet> - q \<bullet> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   268
  unfolding diff_minus by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   269
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   270
lemma permute_minus_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
  shows "p \<bullet> - p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   272
  and   "- p \<bullet> p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   273
  unfolding permute_plus [symmetric] by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   274
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   275
lemma permute_swap_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   276
  shows "(a \<rightleftharpoons> b) \<bullet> (a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   277
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
  by (simp add: swap_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   279
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
lemma permute_swap_cancel2 [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
  shows "(a \<rightleftharpoons> b) \<bullet> (b \<rightleftharpoons> a) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
  by (simp add: swap_commute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   285
lemma inj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
  shows "inj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
  by (rule inj_on_inverseI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   288
     (rule permute_minus_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   290
lemma surj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   291
  shows "surj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
  by (rule surjI, rule permute_minus_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   293
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   294
lemma bij_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   295
  shows "bij (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
  by (rule bijI [OF inj_permute surj_permute])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   297
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   298
lemma inv_permute: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   299
  shows "inv (permute p) = permute (- p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   300
  by (rule inv_equality) (simp_all)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   301
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   302
lemma permute_minus: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
  shows "permute (- p) = inv (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
  by (simp add: inv_permute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   305
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   306
lemma permute_eq_iff [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
  shows "p \<bullet> x = p \<bullet> y \<longleftrightarrow> x = y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   308
  by (rule inj_permute [THEN inj_eq])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   309
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   310
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   311
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
subsection {* Permutations for atoms *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   313
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   314
instantiation atom :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   315
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   316
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   317
definition
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   318
  "p \<bullet> a = (Rep_perm p) a"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   319
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   320
instance 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
apply(default)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
apply(simp_all add: permute_atom_def Rep_perm_simps)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   323
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   324
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   325
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   326
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   327
lemma sort_of_permute [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   328
  shows "sort_of (p \<bullet> a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   329
  unfolding permute_atom_def by (rule sort_of_Rep_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   331
lemma swap_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   332
  shows "(a \<rightleftharpoons> b) \<bullet> c =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   333
           (if sort_of a = sort_of b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   334
            then (if c = a then b else if c = b then a else c) else c)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   335
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
  by (simp add: Rep_perm_swap)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   337
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   338
lemma swap_atom_simps [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   339
  "sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> a = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
  "sort_of a = sort_of b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> b = a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   341
  "c \<noteq> a \<Longrightarrow> c \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> c = c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
  unfolding swap_atom by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   343
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   344
lemma expand_perm_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
  fixes p q :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   346
  shows "p = q \<longleftrightarrow> (\<forall>a::atom. p \<bullet> a = q \<bullet> a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   348
  by (metis Rep_perm_ext ext)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   349
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   350
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   351
subsection {* Permutations for permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   352
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   353
instantiation perm :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   355
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
  "p \<bullet> q = p + q - p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   358
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   359
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   360
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   361
apply (simp add: permute_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   362
apply (simp add: permute_perm_def diff_minus minus_add add_assoc)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   363
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   364
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   365
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   366
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   367
lemma permute_self: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   368
  shows "p \<bullet> p = p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   369
  unfolding permute_perm_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   370
  by (simp add: diff_minus add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   371
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   372
lemma permute_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
  shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   374
  unfolding permute_perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   375
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   376
lemma zero_perm_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   377
  shows "p \<bullet> (0::perm) = 0"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   378
  unfolding permute_perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   379
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   380
lemma add_perm_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   381
  fixes p p1 p2 :: perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   382
  shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   383
  unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   384
  by (simp add: expand_perm_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   385
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   386
lemma swap_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   387
  shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   388
  unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   389
  by (auto simp add: swap_atom expand_perm_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   390
2310
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   391
lemma uminus_eqvt:
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   392
  fixes p q::"perm"
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   393
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   394
  unfolding permute_perm_def
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   395
  by (simp add: diff_minus minus_add add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   396
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   397
subsection {* Permutations for functions *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   398
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   399
instantiation "fun" :: (pt, pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   400
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   401
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   402
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   403
  "p \<bullet> f = (\<lambda>x. p \<bullet> (f (- p \<bullet> x)))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   404
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   405
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   406
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   407
apply (simp add: permute_fun_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   408
apply (simp add: permute_fun_def minus_add)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   409
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   410
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   411
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   412
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   413
lemma permute_fun_app_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   414
  shows "p \<bullet> (f x) = (p \<bullet> f) (p \<bullet> x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   415
  unfolding permute_fun_def by simp
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   416
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   417
subsection {* Permutations for booleans *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   418
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   419
instantiation bool :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   420
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   421
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   422
definition "p \<bullet> (b::bool) = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   423
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   424
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   425
apply(default) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   426
apply(simp_all add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   427
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   428
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   429
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   430
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   431
lemma Not_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   432
  shows "p \<bullet> (\<not> A) = (\<not> (p \<bullet> A))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   433
by (simp add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   434
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   435
lemma conj_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   436
  shows "p \<bullet> (A \<and> B) = ((p \<bullet> A) \<and> (p \<bullet> B))"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   437
  by (simp add: permute_bool_def)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   438
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   439
lemma imp_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   440
  shows "p \<bullet> (A \<longrightarrow> B) = ((p \<bullet> A) \<longrightarrow> (p \<bullet> B))"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   441
  by (simp add: permute_bool_def)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   442
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   443
lemma ex_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   444
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   445
  unfolding permute_fun_def permute_bool_def
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   446
  by (auto, rule_tac x="p \<bullet> x" in exI, simp)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   447
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   448
lemma all_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   449
  shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. (p \<bullet> P) x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   450
  unfolding permute_fun_def permute_bool_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   451
  by (auto, drule_tac x="p \<bullet> x" in spec, simp)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   452
1557
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   453
lemma permute_boolE:
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   454
  fixes P::"bool"
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   455
  shows "p \<bullet> P \<Longrightarrow> P"
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   456
  by (simp add: permute_bool_def)
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   457
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   458
lemma permute_boolI:
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   459
  fixes P::"bool"
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   460
  shows "P \<Longrightarrow> p \<bullet> P"
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   461
  by(simp add: permute_bool_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   462
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   463
subsection {* Permutations for sets *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   464
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   465
lemma permute_set_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   466
  fixes x::"'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   467
  and   p::"perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   468
  shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   469
  unfolding permute_fun_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   470
  unfolding permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   471
  apply(auto simp add: mem_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   472
  apply(rule_tac x="- p \<bullet> x" in exI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   473
  apply(simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   474
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   475
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   476
lemma permute_set_eq_image:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   477
  shows "p \<bullet> X = permute p ` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   478
  unfolding permute_set_eq by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   479
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   480
lemma permute_set_eq_vimage:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   481
  shows "p \<bullet> X = permute (- p) -` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   482
  unfolding permute_fun_def permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   483
  unfolding vimage_def Collect_def mem_def ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   484
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   485
lemma permute_finite [simp]:
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   486
  shows "finite (p \<bullet> X) = finite X"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   487
apply(simp add: permute_set_eq_image)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   488
apply(rule iffI)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   489
apply(drule finite_imageD)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   490
using inj_permute[where p="p"]
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   491
apply(simp add: inj_on_def)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   492
apply(assumption)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   493
apply(rule finite_imageI)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   494
apply(assumption)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   495
done
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   496
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   497
lemma swap_set_not_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   498
  assumes a: "a \<notin> S" "b \<notin> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   499
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   500
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   501
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   502
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   503
lemma swap_set_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   504
  assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   505
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   506
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   507
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   508
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   509
lemma mem_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   510
  shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   511
  unfolding mem_def permute_fun_def permute_bool_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   512
  by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   513
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   514
lemma mem_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   515
  shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   516
  unfolding mem_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   517
  by (simp add: permute_fun_app_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   518
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   519
lemma empty_eqvt:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   520
  shows "p \<bullet> {} = {}"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   521
  unfolding empty_def Collect_def
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   522
  by (simp add: permute_fun_def permute_bool_def)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   523
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   524
lemma insert_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   525
  shows "p \<bullet> (insert x A) = insert (p \<bullet> x) (p \<bullet> A)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   526
  unfolding permute_set_eq_image image_insert ..
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   527
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   528
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   529
subsection {* Permutations for units *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   530
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   531
instantiation unit :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   532
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   533
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   534
definition "p \<bullet> (u::unit) = u"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   535
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   536
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   537
by (default) (simp_all add: permute_unit_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   538
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   539
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   540
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   541
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   542
subsection {* Permutations for products *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   543
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   544
instantiation prod :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   545
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   546
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   547
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   548
  permute_prod 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   549
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   550
  Pair_eqvt: "p \<bullet> (x, y) = (p \<bullet> x, p \<bullet> y)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   551
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   552
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   553
by default auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   554
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   555
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   556
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   557
subsection {* Permutations for sums *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   558
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   559
instantiation sum :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   560
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   561
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   562
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   563
  permute_sum 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   564
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   565
  "p \<bullet> (Inl x) = Inl (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   566
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   567
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   568
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   569
by (default) (case_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   570
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   571
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   572
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   573
subsection {* Permutations for lists *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   574
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   575
instantiation list :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   576
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   577
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   578
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   579
  permute_list 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   580
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   581
  "p \<bullet> [] = []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   582
| "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   583
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   584
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   585
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   586
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   587
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   588
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   589
lemma set_eqvt:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   590
  shows "p \<bullet> (set xs) = set (p \<bullet> xs)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   591
  by (induct xs) (simp_all add: empty_eqvt insert_eqvt)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   592
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   593
subsection {* Permutations for options *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   594
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   595
instantiation option :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   596
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   597
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   598
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   599
  permute_option 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   600
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   601
  "p \<bullet> None = None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   602
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   603
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   604
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   605
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   606
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   607
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   608
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   609
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   610
subsection {* Permutations for fsets *}
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   611
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   612
lemma permute_fset_rsp[quot_respect]:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   613
  shows "(op = ===> list_eq ===> list_eq) permute permute"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   614
  unfolding fun_rel_def
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   615
  by (simp add: set_eqvt[symmetric])
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   616
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   617
instantiation fset :: (pt) pt
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   618
begin
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   619
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   620
quotient_definition
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   621
  "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   622
is
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   623
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   624
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   625
instance 
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   626
proof
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   627
  fix x :: "'a fset" and p q :: "perm"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   628
  show "0 \<bullet> x = x" by (descending) (simp)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   629
  show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (descending) (simp)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   630
qed
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   631
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   632
end
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   633
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   634
lemma permute_fset [simp]:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   635
  fixes S::"('a::pt) fset"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   636
  shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   637
  and   "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   638
  by (lifting permute_list.simps)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   639
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   640
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   641
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   642
subsection {* Permutations for @{typ char}, @{typ nat}, and @{typ int} *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   643
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   644
instantiation char :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   645
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   646
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   647
definition "p \<bullet> (c::char) = c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   648
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   649
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   650
by (default) (simp_all add: permute_char_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   651
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   652
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   653
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   654
instantiation nat :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   655
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   656
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   657
definition "p \<bullet> (n::nat) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   658
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   659
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   660
by (default) (simp_all add: permute_nat_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   661
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   662
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   663
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   664
instantiation int :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   665
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   666
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   667
definition "p \<bullet> (i::int) = i"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   668
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   669
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   670
by (default) (simp_all add: permute_int_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   671
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   672
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   673
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   674
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   675
section {* Pure types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   676
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   677
text {* Pure types will have always empty support. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   678
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   679
class pure = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   680
  assumes permute_pure: "p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   681
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   682
text {* Types @{typ unit} and @{typ bool} are pure. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   683
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   684
instance unit :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   685
proof qed (rule permute_unit_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   686
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   687
instance bool :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   688
proof qed (rule permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   689
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   690
text {* Other type constructors preserve purity. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   691
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   692
instance "fun" :: (pure, pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   693
by default (simp add: permute_fun_def permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   694
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   695
instance prod :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   696
by default (induct_tac x, simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   697
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   698
instance sum :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   699
by default (induct_tac x, simp_all add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   700
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   701
instance list :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   702
by default (induct_tac x, simp_all add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   703
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   704
instance option :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   705
by default (induct_tac x, simp_all add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   706
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   707
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   708
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   709
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   710
instance char :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   711
proof qed (rule permute_char_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   712
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   713
instance nat :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   714
proof qed (rule permute_nat_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   715
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   716
instance int :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   717
proof qed (rule permute_int_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   718
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   719
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   720
subsection {* Supp, Freshness and Supports *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   721
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   722
context pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   723
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   724
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   725
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   726
  supp :: "'a \<Rightarrow> atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   727
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   728
  "supp x = {a. infinite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   729
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   730
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   731
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   732
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   733
  fresh :: "atom \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   734
where   
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   735
  "a \<sharp> x \<equiv> a \<notin> supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   736
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   737
lemma supp_conv_fresh: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   738
  shows "supp x = {a. \<not> a \<sharp> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   739
  unfolding fresh_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   740
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   741
lemma swap_rel_trans:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   742
  assumes "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   743
  assumes "sort_of b = sort_of c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   744
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   745
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   746
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   747
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   748
  assume "a = b \<or> c = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   749
  with assms show "(a \<rightleftharpoons> b) \<bullet> x = x" by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   750
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   751
  assume *: "\<not> (a = b \<or> c = b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   752
  have "((a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c)) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   753
    using assms by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   754
  also have "(a \<rightleftharpoons> c) + (b \<rightleftharpoons> c) + (a \<rightleftharpoons> c) = (a \<rightleftharpoons> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   755
    using assms * by (simp add: swap_triple)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   756
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   757
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   758
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   759
lemma swap_fresh_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   760
  assumes a: "a \<sharp> x" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   761
  and     b: "b \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   762
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   763
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   764
  assume asm: "sort_of a = sort_of b" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   765
  have "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}" "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   766
    using a b unfolding fresh_def supp_def by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   767
  then have "finite ({c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x} \<union> {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x})" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   768
  then obtain c 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   769
    where "(a \<rightleftharpoons> c) \<bullet> x = x" "(b \<rightleftharpoons> c) \<bullet> x = x" "sort_of c = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   770
    by (rule obtain_atom) (auto)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   771
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" using asm by (rule_tac swap_rel_trans) (simp_all)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   772
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   773
  assume "sort_of a \<noteq> sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   774
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   775
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   776
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   777
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   778
subsection {* supp and fresh are equivariant *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   779
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   780
lemma finite_Collect_bij:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   781
  assumes a: "bij f"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   782
  shows "finite {x. P (f x)} = finite {x. P x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   783
by (metis a finite_vimage_iff vimage_Collect_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   784
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   785
lemma fresh_permute_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   786
  shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   787
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   788
  have "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   789
    unfolding fresh_def supp_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   790
  also have "\<dots> \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> p \<bullet> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   791
    using bij_permute by (rule finite_Collect_bij[symmetric])
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   792
  also have "\<dots> \<longleftrightarrow> finite {b. p \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> p \<bullet> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   793
    by (simp only: permute_eqvt [of p] swap_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   794
  also have "\<dots> \<longleftrightarrow> finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   795
    by (simp only: permute_eq_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   796
  also have "\<dots> \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   797
    unfolding fresh_def supp_def by simp
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   798
  finally show "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x" .
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   799
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   800
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   801
lemma fresh_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   802
  shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   803
  unfolding permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   804
  by (simp add: fresh_permute_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   805
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   806
lemma supp_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   807
  fixes  p  :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   808
  and    x   :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   809
  shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   810
  unfolding supp_conv_fresh
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   811
  unfolding Collect_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   812
  unfolding permute_fun_def
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   813
  by (simp add: Not_eqvt fresh_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   814
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   815
subsection {* supports *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   816
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   817
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   818
  supports :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" (infixl "supports" 80)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   819
where  
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   820
  "S supports x \<equiv> \<forall>a b. (a \<notin> S \<and> b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   821
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   822
lemma supp_is_subset:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   823
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   824
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   825
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   826
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   827
  shows "(supp x) \<subseteq> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   828
proof (rule ccontr)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   829
  assume "\<not> (supp x \<subseteq> S)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   830
  then obtain a where b1: "a \<in> supp x" and b2: "a \<notin> S" by auto
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   831
  from a1 b2 have "\<forall>b. b \<notin> S \<longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x" unfolding supports_def by auto
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   832
  then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   833
  with a2 have "finite {b. (a \<rightleftharpoons> b)\<bullet>x \<noteq> x}" by (simp add: finite_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   834
  then have "a \<notin> (supp x)" unfolding supp_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   835
  with b1 show False by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   836
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   837
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   838
lemma supports_finite:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   839
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   840
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   841
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   842
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   843
  shows "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   844
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   845
  have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   846
  then show "finite (supp x)" using a2 by (simp add: finite_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   847
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   848
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   849
lemma supp_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   850
  fixes x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   851
  shows "(supp x) supports x"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   852
unfolding supports_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   853
proof (intro strip)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   854
  fix a b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   855
  assume "a \<notin> (supp x) \<and> b \<notin> (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   856
  then have "a \<sharp> x" and "b \<sharp> x" by (simp_all add: fresh_def)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   857
  then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   858
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   859
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   860
lemma supp_is_least_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   861
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   862
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   863
  assumes  a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   864
  and      a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   865
  and      a3: "\<And>S'. finite S' \<Longrightarrow> (S' supports x) \<Longrightarrow> S \<subseteq> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   866
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   867
proof (rule equalityI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   868
  show "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   869
  with a2 have fin: "finite (supp x)" by (rule rev_finite_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   870
  have "(supp x) supports x" by (rule supp_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   871
  with fin a3 show "S \<subseteq> supp x" by blast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   872
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   873
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   874
lemma subsetCI: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   875
  shows "(\<And>x. x \<in> A \<Longrightarrow> x \<notin> B \<Longrightarrow> False) \<Longrightarrow> A \<subseteq> B"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   876
  by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   877
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   878
lemma finite_supp_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   879
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   880
  assumes a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   881
  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"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   882
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   883
  using a1 a2
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   884
proof (rule supp_is_least_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   885
  fix S'
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   886
  assume "finite S'" and "S' supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   887
  show "S \<subseteq> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   888
  proof (rule subsetCI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   889
    fix a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   890
    assume "a \<in> S" and "a \<notin> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   891
    have "finite (S \<union> S')"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   892
      using `finite S` `finite S'` by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   893
    then obtain b where "b \<notin> S \<union> S'" and "sort_of b = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   894
      by (rule obtain_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   895
    then have "b \<notin> S" and "b \<notin> S'"  and "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   896
      by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   897
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   898
      using `a \<notin> S'` `S' supports x` by (simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   899
    moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   900
      using `a \<in> S` `b \<notin> S` `sort_of a = sort_of b`
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   901
      by (rule a3)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   902
    ultimately show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   903
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   904
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   905
2475
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   906
section {* Support w.r.t. relations *}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   907
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   908
text {* 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   909
  This definition is used for unquotient types, where
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   910
  alpha-equivalence does not coincide with equality.
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   911
*}
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   912
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   913
definition 
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   914
  "supp_rel R x = {a. infinite {b. \<not>(R ((a \<rightleftharpoons> b) \<bullet> x) x)}}"
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   915
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   916
486d4647bb37 supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents: 2470
diff changeset
   917
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   918
section {* Finitely-supported types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   919
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   920
class fs = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   921
  assumes finite_supp: "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   922
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   923
lemma pure_supp: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   924
  shows "supp (x::'a::pure) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   925
  unfolding supp_def by (simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   926
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   927
lemma pure_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   928
  fixes x::"'a::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   929
  shows "a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   930
  unfolding fresh_def by (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   931
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   932
instance pure < fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   933
by default (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   934
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   935
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   936
subsection  {* Type @{typ atom} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   937
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   938
lemma supp_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   939
  shows "supp a = {a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   940
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   941
apply (clarsimp simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   942
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   943
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   944
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   945
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   946
lemma fresh_atom: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   947
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   948
  unfolding fresh_def supp_atom by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   949
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   950
instance atom :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   951
by default (simp add: supp_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   952
1933
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   953
section {* Support for finite sets of atoms *}
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   954
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   955
1933
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   956
lemma supp_finite_atom_set:
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   957
  fixes S::"atom set"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   958
  assumes "finite S"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   959
  shows "supp S = S"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   960
  apply(rule finite_supp_unique)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   961
  apply(simp add: supports_def)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   962
  apply(simp add: swap_set_not_in)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   963
  apply(rule assms)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   964
  apply(simp add: swap_set_in)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   965
done
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   966
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   967
section {* Type @{typ perm} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   968
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   969
lemma perm_swap_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   970
  shows "(a \<rightleftharpoons> b) \<bullet> p = p \<longleftrightarrow> (p \<bullet> (a \<rightleftharpoons> b)) = (a \<rightleftharpoons> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   971
unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   972
by (metis add_diff_cancel minus_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   973
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   974
lemma supports_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   975
  shows "{a. p \<bullet> a \<noteq> a} supports p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   976
  unfolding supports_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   977
  unfolding perm_swap_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   978
  by (simp add: swap_eqvt)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   979
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   980
lemma finite_perm_lemma: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   981
  shows "finite {a::atom. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   982
  using finite_Rep_perm [of p]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   983
  unfolding permute_atom_def .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   984
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   985
lemma supp_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   986
  shows "supp p = {a. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   987
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   988
apply (rule supports_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   989
apply (rule finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   990
apply (simp add: perm_swap_eq swap_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   991
apply (auto simp add: expand_perm_eq swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   992
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   993
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   994
lemma fresh_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   995
  shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   996
  unfolding fresh_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   997
  by (simp add: supp_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   998
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   999
lemma supp_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1000
  shows "supp (a \<rightleftharpoons> b) = (if a = b \<or> sort_of a \<noteq> sort_of b then {} else {a, b})"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1001
  by (auto simp add: supp_perm swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1002
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1003
lemma fresh_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1004
  shows "a \<sharp> (0::perm)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1005
  unfolding fresh_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1006
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1007
lemma supp_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1008
  shows "supp (0::perm) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1009
  unfolding supp_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1010
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1011
lemma fresh_plus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1012
  fixes p q::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1013
  assumes "a \<sharp> p" "a \<sharp> q"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1014
  shows "a \<sharp> (p + q)"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1015
  using assms
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1016
  unfolding fresh_def
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1017
  by (auto simp add: supp_perm)
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1018
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1019
lemma supp_plus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1020
  fixes p q::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1021
  shows "supp (p + q) \<subseteq> supp p \<union> supp q"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1022
  by (auto simp add: supp_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1023
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1024
lemma fresh_minus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1025
  fixes p::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1026
  shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1027
  unfolding fresh_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1028
  unfolding supp_perm
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1029
  apply(simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1030
  apply(metis permute_minus_cancel)
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1031
  done
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1032
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1033
lemma supp_minus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1034
  fixes p::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1035
  shows "supp (- p) = supp p"
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1036
  unfolding supp_conv_fresh
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1037
  by (simp add: fresh_minus_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1038
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1039
instance perm :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1040
by default (simp add: supp_perm finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1041
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1042
lemma plus_perm_eq:
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1043
  fixes p q::"perm"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1044
  assumes asm: "supp p \<inter> supp q = {}"
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1045
  shows "p + q  = q + p"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1046
unfolding expand_perm_eq
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1047
proof
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1048
  fix a::"atom"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1049
  show "(p + q) \<bullet> a = (q + p) \<bullet> a"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1050
  proof -
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1051
    { assume "a \<notin> supp p" "a \<notin> supp q"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1052
      then have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1053
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1054
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1055
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1056
    { assume a: "a \<in> supp p" "a \<notin> supp q"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1057
      then have "p \<bullet> a \<in> supp p" by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1058
      then have "p \<bullet> a \<notin> supp q" using asm by auto
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1059
      with a have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1060
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1061
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1062
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1063
    { assume a: "a \<notin> supp p" "a \<in> supp q"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1064
      then have "q \<bullet> a \<in> supp q" by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1065
      then have "q \<bullet> a \<notin> supp p" using asm by auto 
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1066
      with a have "(p + q) \<bullet> a = (q + p) \<bullet> a" 
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1067
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1068
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1069
    ultimately show "(p + q) \<bullet> a = (q + p) \<bullet> a" 
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1070
      using asm by blast
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1071
  qed
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1072
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1073
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1074
section {* Finite Support instances for other types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1075
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1076
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1077
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1078
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1079
lemma supp_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1080
  shows "supp (x, y) = supp x \<union> supp y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1081
  by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1082
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1083
lemma fresh_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1084
  shows "a \<sharp> (x, y) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1085
  by (simp add: fresh_def supp_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1086
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1087
lemma supp_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1088
  shows "supp () = {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1089
  by (simp add: supp_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1090
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1091
lemma fresh_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1092
  shows "a \<sharp> ()"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1093
  by (simp add: fresh_def supp_Unit)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1094
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1095
instance prod :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1096
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1097
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1098
apply (simp add: supp_Pair finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1099
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1100
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1101
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1102
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1103
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1104
lemma supp_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1105
  shows "supp (Inl x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1106
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1107
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1108
lemma supp_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1109
  shows "supp (Inr x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1110
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1111
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1112
lemma fresh_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1113
  shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1114
  by (simp add: fresh_def supp_Inl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1115
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1116
lemma fresh_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1117
  shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1118
  by (simp add: fresh_def supp_Inr)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1119
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1120
instance sum :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1121
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1122
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1123
apply (simp_all add: supp_Inl supp_Inr finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1124
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1125
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1126
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1127
subsection {* Type @{typ "'a option"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1128
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1129
lemma supp_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1130
  shows "supp None = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1131
by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1132
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1133
lemma supp_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1134
  shows "supp (Some x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1135
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1136
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1137
lemma fresh_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1138
  shows "a \<sharp> None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1139
  by (simp add: fresh_def supp_None)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1140
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1141
lemma fresh_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1142
  shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1143
  by (simp add: fresh_def supp_Some)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1144
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1145
instance option :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1146
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1147
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1148
apply (simp_all add: supp_None supp_Some finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1149
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1150
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1151
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1152
subsubsection {* Type @{typ "'a list"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1153
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1154
lemma supp_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1155
  shows "supp [] = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1156
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1157
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1158
lemma supp_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1159
  shows "supp (x # xs) = supp x \<union> supp xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1160
by (simp add: supp_def Collect_imp_eq Collect_neg_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1161
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1162
lemma fresh_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1163
  shows "a \<sharp> []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1164
  by (simp add: fresh_def supp_Nil)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1165
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1166
lemma fresh_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1167
  shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1168
  by (simp add: fresh_def supp_Cons)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1169
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1170
instance list :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1171
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1172
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1173
apply (simp_all add: supp_Nil supp_Cons finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1174
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1175
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1176
lemma supp_of_atom_list:
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1177
  fixes as::"atom list"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1178
  shows "supp as = set as"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1179
by (induct as)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1180
   (simp_all add: supp_Nil supp_Cons supp_atom)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1181
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1182
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1183
section {* Support and Freshness for Applications *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1184
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1185
lemma fresh_conv_MOST: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1186
  shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1187
  unfolding fresh_def supp_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1188
  unfolding MOST_iff_cofinite by simp
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1189
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1190
lemma supp_subset_fresh:
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1191
  assumes a: "\<And>a. a \<sharp> x \<Longrightarrow> a \<sharp> y"
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1192
  shows "supp y \<subseteq> supp x"
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1193
  using a
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1194
  unfolding fresh_def
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1195
  by blast
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1196
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1197
lemma fresh_fun_app:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1198
  assumes "a \<sharp> f" and "a \<sharp> x" 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1199
  shows "a \<sharp> f x"
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1200
  using assms
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1201
  unfolding fresh_conv_MOST
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1202
  unfolding permute_fun_app_eq 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1203
  by (elim MOST_rev_mp, simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1204
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1205
lemma supp_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1206
  shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1207
  using fresh_fun_app
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1208
  unfolding fresh_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1209
  by auto
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1210
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1211
text {* Support of Equivariant Functions *}
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1212
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1213
lemma supp_fun_eqvt:
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1214
  assumes a: "\<And>p. p \<bullet> f = f"
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1215
  shows "supp f = {}"
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1216
  unfolding supp_def 
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1217
  using a by simp
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1218
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1219
lemma fresh_fun_eqvt_app:
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1220
  assumes a: "\<And>p. p \<bullet> f = f"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1221
  shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1222
proof -
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1223
  from a have "supp f = {}" by (simp add: supp_fun_eqvt)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1224
  then show "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1225
    unfolding fresh_def
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1226
    using supp_fun_app by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1227
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1228
1962
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1229
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1230
section {* Support of Finite Sets of Finitely Supported Elements *}
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1231
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1232
lemma Union_fresh:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1233
  shows "a \<sharp> S \<Longrightarrow> a \<sharp> (\<Union>x \<in> S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1234
  unfolding Union_image_eq[symmetric]
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1235
  apply(rule_tac f="\<lambda>S. \<Union> supp ` S" in fresh_fun_eqvt_app)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1236
  apply(simp add: permute_fun_def UNION_def Collect_def Bex_def ex_eqvt mem_def conj_eqvt)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1237
  apply(subst permute_fun_app_eq)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1238
  back
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1239
  apply(simp add: supp_eqvt)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1240
  apply(assumption)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1241
  done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1242
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1243
lemma Union_supports_set:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1244
  shows "(\<Union>x \<in> S. supp x) supports S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1245
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1246
  { fix a b
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1247
    have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1248
      unfolding permute_set_eq by force
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1249
  }
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1250
  then show "(\<Union>x \<in> S. supp x) supports S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1251
    unfolding supports_def 
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1252
    by (simp add: fresh_def[symmetric] swap_fresh_fresh)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1253
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1254
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1255
lemma Union_of_finite_supp_sets:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1256
  fixes S::"('a::fs set)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1257
  assumes fin: "finite S"   
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1258
  shows "finite (\<Union>x\<in>S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1259
  using fin by (induct) (auto simp add: finite_supp)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1260
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1261
lemma Union_included_in_supp:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1262
  fixes S::"('a::fs set)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1263
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1264
  shows "(\<Union>x\<in>S. supp x) \<subseteq> supp S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1265
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1266
  have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1267
    by (rule supp_finite_atom_set[symmetric])
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1268
       (rule Union_of_finite_supp_sets[OF fin])
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1269
  also have "\<dots> \<subseteq> supp S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1270
    by (rule supp_subset_fresh)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1271
       (simp add: Union_fresh)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1272
  finally show "(\<Union>x\<in>S. supp x) \<subseteq> supp S" .
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1273
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1274
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1275
lemma supp_of_finite_sets:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1276
  fixes S::"('a::fs set)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1277
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1278
  shows "(supp S) = (\<Union>x\<in>S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1279
apply(rule subset_antisym)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1280
apply(rule supp_is_subset)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1281
apply(rule Union_supports_set)
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1282
apply(rule Union_of_finite_supp_sets[OF fin])
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1283
apply(rule Union_included_in_supp[OF fin])
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1284
done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1285
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1286
lemma finite_sets_supp:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1287
  fixes S::"('a::fs set)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1288
  assumes "finite S"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1289
  shows "finite (supp S)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1290
using assms
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1291
by (simp only: supp_of_finite_sets Union_of_finite_supp_sets)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1292
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1293
lemma supp_of_finite_union:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1294
  fixes S T::"('a::fs) set"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1295
  assumes fin1: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1296
  and     fin2: "finite T"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1297
  shows "supp (S \<union> T) = supp S \<union> supp T"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1298
  using fin1 fin2
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1299
  by (simp add: supp_of_finite_sets)
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1300
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1301
lemma supp_of_finite_insert:
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1302
  fixes S::"('a::fs) set"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1303
  assumes fin:  "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1304
  shows "supp (insert x S) = supp x \<union> supp S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1305
  using fin
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1306
  by (simp add: supp_of_finite_sets)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1307
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1308
lemma fresh_finite_insert:
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1309
  fixes S::"('a::fs) set"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1310
  assumes fin:  "finite S"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1311
  shows "a \<sharp> (insert x S) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1312
  using fin unfolding fresh_def
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1313
  by (simp add: supp_of_finite_insert)
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1314
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1315
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1316
subsection {* Type @{typ "'a fset"} is finitely supported *}
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1317
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1318
lemma fset_eqvt: 
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1319
  shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1320
  by (lifting set_eqvt)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1321
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1322
lemma supp_fset [simp]:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1323
  shows "supp (fset S) = supp S"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1324
  unfolding supp_def
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1325
  by (simp add: fset_eqvt fset_cong)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1326
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1327
lemma supp_empty_fset [simp]:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1328
  shows "supp {||} = {}"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1329
  unfolding supp_def
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1330
  by simp
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1331
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1332
lemma supp_insert_fset [simp]:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1333
  fixes x::"'a::fs"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1334
  and   S::"'a fset"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1335
  shows "supp (insert_fset x S) = supp x \<union> supp S"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1336
  apply(subst supp_fset[symmetric])
2587
78623a0f294b tuned proof to reduce number of warnings
Christian Urban <urbanc@in.tum.de>
parents: 2586
diff changeset
  1337
  apply(simp add: supp_of_finite_insert)
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1338
  done
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1339
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1340
lemma fset_finite_supp:
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1341
  fixes S::"('a::fs) fset"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1342
  shows "finite (supp S)"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1343
  by (induct S) (simp_all add: finite_supp)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1344
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1345
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1346
instance fset :: (fs) fs
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1347
  apply (default)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1348
  apply (rule fset_finite_supp)
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1349
  done
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1350
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1351
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1352
section {* Fresh-Star *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1353
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1354
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1355
text {* The fresh-star generalisation of fresh is used in strong
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1356
  induction principles. *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1357
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1358
definition 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1359
  fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1360
where 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1361
  "as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1362
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1363
lemma fresh_star_supp_conv:
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1364
  shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1365
by (auto simp add: fresh_star_def fresh_def)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1366
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1367
lemma fresh_star_prod:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1368
  fixes as::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1369
  shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)" 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1370
  by (auto simp add: fresh_star_def fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1371
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1372
lemma fresh_star_union:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1373
  shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1374
  by (auto simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1375
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1376
lemma fresh_star_insert:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1377
  shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1378
  by (auto simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1379
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1380
lemma fresh_star_Un_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1381
  "((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1382
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1383
  apply(rule)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1384
  apply(erule meta_mp)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1385
  apply(auto)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1386
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1387
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1388
lemma fresh_star_insert_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1389
  "(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1390
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1391
  by rule (simp_all add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1392
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1393
lemma fresh_star_empty_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1394
  "({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1395
  by (simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1396
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1397
lemma fresh_star_unit_elim: 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1398
  shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1399
  by (simp add: fresh_star_def fresh_Unit) 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1400
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1401
lemma fresh_star_prod_elim: 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1402
  shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1403
  by (rule, simp_all add: fresh_star_prod)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1404
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1405
lemma fresh_star_zero:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1406
  shows "as \<sharp>* (0::perm)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1407
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1408
  by (simp add: fresh_zero_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1409
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1410
lemma fresh_star_plus:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1411
  fixes p q::perm
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1412
  shows "\<lbrakk>a \<sharp>* p;  a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1413
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1414
  by (simp add: fresh_plus_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1415
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1416
lemma fresh_star_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1417
  shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1418
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1419
  by (metis mem_permute_iff permute_minus_cancel(1) fresh_permute_iff)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1420
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1421
lemma fresh_star_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1422
  shows "(p \<bullet> (as \<sharp>* x)) = (p \<bullet> as) \<sharp>* (p \<bullet> x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1423
unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1424
unfolding Ball_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1425
apply(simp add: all_eqvt)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1426
apply(subst permute_fun_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1427
apply(simp add: imp_eqvt fresh_eqvt mem_eqvt)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1428
done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1429
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1430
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1431
section {* Induction principle for permutations *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1432
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1433
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1434
lemma perm_struct_induct[consumes 1, case_names zero swap]:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1435
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1436
  and zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1437
  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)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1438
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1439
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1440
  have "finite (supp p)" by (simp add: finite_supp)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1441
  then show "P p" using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1442
  proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1443
    case (psubset p)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1444
    then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1445
    have as: "supp p \<subseteq> S" by fact
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1446
    { assume "supp p = {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1447
      then have "p = 0" by (simp add: supp_perm expand_perm_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1448
      then have "P p" using zero by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1449
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1450
    moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1451
    { assume "supp p \<noteq> {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1452
      then obtain a where a0: "a \<in> supp p" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1453
      then have a1: "p \<bullet> a \<in> S" "a \<in> S" "sort_of (p \<bullet> a) = sort_of a" "p \<bullet> a \<noteq> a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1454
        using as by (auto simp add: supp_atom supp_perm swap_atom)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1455
      let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1456
      have a2: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1457
      moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1458
      have "a \<notin> supp ?q" by (simp add: supp_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1459
      then have "supp ?q \<noteq> supp p" using a0 by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1460
      ultimately have "supp ?q \<subset> supp p" using a2 by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1461
      then have "P ?q" using ih by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1462
      moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1463
      have "supp ?q \<subseteq> S" using as a2 by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1464
      ultimately  have "P ((p \<bullet> a \<rightleftharpoons> a) + ?q)" using as a1 swap by simp 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1465
      moreover 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1466
      have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: expand_perm_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1467
      ultimately have "P p" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1468
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1469
    ultimately show "P p" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1470
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1471
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1472
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1473
lemma perm_simple_struct_induct[case_names zero swap]:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1474
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1475
  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)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1476
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1477
by (rule_tac S="supp p" in perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1478
   (auto intro: zero swap)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1479
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1480
lemma perm_subset_induct[consumes 1, case_names zero swap plus]:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1481
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1482
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1483
  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)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1484
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1485
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1486
using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1487
by (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1488
   (auto intro: zero plus swap simp add: supp_swap)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1489
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1490
lemma supp_perm_eq:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1491
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1492
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1493
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1494
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1495
    unfolding supp_perm fresh_star_def fresh_def by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1496
  then show "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1497
  proof (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1498
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1499
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1500
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1501
    case (swap p a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1502
    then have "a \<sharp> x" "b \<sharp> x" "p \<bullet> x = x" by simp_all
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1503
    then show "((a \<rightleftharpoons> b) + p) \<bullet> x = x" by (simp add: swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1504
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1505
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1506
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1507
lemma supp_perm_eq_test:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1508
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1509
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1510
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1511
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1512
    unfolding supp_perm fresh_star_def fresh_def by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1513
  then show "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1514
  proof (induct p rule: perm_subset_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1515
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1516
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1517
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1518
    case (swap a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1519
    then have "a \<sharp> x" "b \<sharp> x" by simp_all
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1520
    then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1521
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1522
    case (plus p1 p2)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1523
    have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1524
    then show "(p1 + p2) \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1525
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1526
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1527
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1528
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1529
section {* Avoiding of atom sets *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1530
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1531
text {* 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1532
  For every set of atoms, there is another set of atoms
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1533
  avoiding a finitely supported c and there is a permutation
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1534
  which 'translates' between both sets.
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1535
*}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1536
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1537
lemma at_set_avoiding_aux:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1538
  fixes Xs::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1539
  and   As::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1540
  assumes b: "Xs \<subseteq> As"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1541
  and     c: "finite As"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1542
  shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1543
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1544
  from b c have "finite Xs" by (rule finite_subset)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1545
  then show ?thesis using b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1546
  proof (induct rule: finite_subset_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1547
    case empty
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1548
    have "0 \<bullet> {} \<inter> As = {}" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1549
    moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1550
    have "supp (0::perm) \<subseteq> {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1551
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1552
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1553
    case (insert x Xs)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1554
    then obtain p where
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1555
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1556
      p2: "supp p \<subseteq> (Xs \<union> (p \<bullet> Xs))" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1557
    from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1558
    with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1559
    hence px: "p \<bullet> x = x" unfolding supp_perm by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1560
    have "finite (As \<union> p \<bullet> Xs)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1561
      using `finite As` `finite Xs`
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1562
      by (simp add: permute_set_eq_image)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1563
    then obtain y where "y \<notin> (As \<union> p \<bullet> Xs)" "sort_of y = sort_of x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1564
      by (rule obtain_atom)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1565
    hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "sort_of y = sort_of x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1566
      by simp_all
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1567
    let ?q = "(x \<rightleftharpoons> y) + p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1568
    have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1569
      unfolding insert_eqvt
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1570
      using `p \<bullet> x = x` `sort_of y = sort_of x`
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1571
      using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1572
      by (simp add: swap_atom swap_set_not_in)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1573
    have "?q \<bullet> insert x Xs \<inter> As = {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1574
      using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1575
      unfolding q by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1576
    moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1577
    have "supp ?q \<subseteq> insert x Xs \<union> ?q \<bullet> insert x Xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1578
      using p2 unfolding q
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1579
      by (intro subset_trans [OF supp_plus_perm])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1580
         (auto simp add: supp_swap)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1581
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1582
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1583
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1584
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1585
lemma at_set_avoiding:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1586
  assumes a: "finite Xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1587
  and     b: "finite (supp c)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1588
  obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1589
  using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1590
  unfolding fresh_star_def fresh_def by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1591
2589
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1592
lemma at_set_avoiding1:
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1593
  assumes "finite xs"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1594
  and     "finite (supp c)"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1595
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1596
using assms
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1597
apply(erule_tac c="c" in at_set_avoiding)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1598
apply(auto)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1599
done
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  1600
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1601
lemma at_set_avoiding2:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1602
  assumes "finite xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1603
  and     "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1604
  and     "xs \<sharp>* x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1605
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1606
using assms
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1607
apply(erule_tac c="(c, x)" in at_set_avoiding)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1608
apply(simp add: supp_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1609
apply(rule_tac x="p" in exI)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1610
apply(simp add: fresh_star_prod)
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1611
apply(rule fresh_star_supp_conv)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1612
apply(auto simp add: fresh_star_def)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1613
done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1614
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1615
lemma at_set_avoiding3:
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1616
  assumes "finite xs"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1617
  and     "finite (supp c)" "finite (supp x)"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1618
  and     "xs \<sharp>* x"
2586
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1619
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p \<subseteq> xs \<union> (p \<bullet> xs)"
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1620
using assms
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1621
apply(erule_tac c="(c, x)" in at_set_avoiding)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1622
apply(simp add: supp_Pair)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1623
apply(rule_tac x="p" in exI)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1624
apply(simp add: fresh_star_prod)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1625
apply(rule fresh_star_supp_conv)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1626
apply(auto simp add: fresh_star_def)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  1627
done
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1628
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  1629
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1630
lemma at_set_avoiding2_atom:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1631
  assumes "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1632
  and     b: "a \<sharp> x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1633
  shows "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1634
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1635
  have a: "{a} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1636
  obtain p where p1: "(p \<bullet> {a}) \<sharp>* c" and p2: "supp x \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1637
    using at_set_avoiding2[of "{a}" "c" "x"] assms a by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1638
  have c: "(p \<bullet> a) \<sharp> c" using p1
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1639
    unfolding fresh_star_def Ball_def 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1640
    by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1641
  hence "p \<bullet> a \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1642
  then show "\<exists>p. (p \<bullet> a) \<sharp> c \<and> supp x \<sharp>* p" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1643
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1644
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1645
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1646
section {* Concrete Atoms Types *}
1962
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1647
1972
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1648
text {*
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1649
  Class @{text at_base} allows types containing multiple sorts of atoms.
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1650
  Class @{text at} only allows types with a single sort.
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1651
*}
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1652
1962
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1653
class at_base = pt +
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1654
  fixes atom :: "'a \<Rightarrow> atom"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1655
  assumes atom_eq_iff [simp]: "atom a = atom b \<longleftrightarrow> a = b"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1656
  assumes atom_eqvt: "p \<bullet> (atom a) = atom (p \<bullet> a)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1657
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1658
class at = at_base +
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1659
  assumes sort_of_atom_eq [simp]: "sort_of (atom a) = sort_of (atom b)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1660
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1661
lemma supp_at_base: 
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1662
  fixes a::"'a::at_base"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1663
  shows "supp a = {atom a}"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1664
  by (simp add: supp_atom [symmetric] supp_def atom_eqvt)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1665
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1666
lemma fresh_at_base: 
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1667
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> atom b"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1668
  unfolding fresh_def by (simp add: supp_at_base)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1669
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1670
instance at_base < fs
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1671
proof qed (simp add: supp_at_base)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1672
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1673
lemma at_base_infinite [simp]:
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1674
  shows "infinite (UNIV :: 'a::at_base set)" (is "infinite ?U")
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1675
proof
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1676
  obtain a :: 'a where "True" by auto
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1677
  assume "finite ?U"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1678
  hence "finite (atom ` ?U)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1679
    by (rule finite_imageI)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1680
  then obtain b where b: "b \<notin> atom ` ?U" "sort_of b = sort_of (atom a)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1681
    by (rule obtain_atom)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1682
  from b(2) have "b = atom ((atom a \<rightleftharpoons> b) \<bullet> a)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1683
    unfolding atom_eqvt [symmetric]
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1684
    by (simp add: swap_atom)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1685
  hence "b \<in> atom ` ?U" by simp
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1686
  with b(1) show "False" by simp
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1687
qed
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1688
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1689
lemma swap_at_base_simps [simp]:
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1690
  fixes x y::"'a::at_base"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1691
  shows "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> x = y"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1692
  and   "sort_of (atom x) = sort_of (atom y) \<Longrightarrow> (atom x \<rightleftharpoons> atom y) \<bullet> y = x"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1693
  and   "atom x \<noteq> a \<Longrightarrow> atom x \<noteq> b \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1694
  unfolding atom_eq_iff [symmetric]
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1695
  unfolding atom_eqvt [symmetric]
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1696
  by simp_all
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1697
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1698
lemma obtain_at_base:
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1699
  assumes X: "finite X"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1700
  obtains a::"'a::at_base" where "atom a \<notin> X"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1701
proof -
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1702
  have "inj (atom :: 'a \<Rightarrow> atom)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1703
    by (simp add: inj_on_def)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1704
  with X have "finite (atom -` X :: 'a set)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1705
    by (rule finite_vimageI)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1706
  with at_base_infinite have "atom -` X \<noteq> (UNIV :: 'a set)"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1707
    by auto
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1708
  then obtain a :: 'a where "atom a \<notin> X"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1709
    by auto
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1710
  thus ?thesis ..
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1711
qed
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1712
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1972
diff changeset
  1713
lemma supp_finite_set_at_base:
1971
8daf6ff5e11a simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1962
diff changeset
  1714
  assumes a: "finite S"
8daf6ff5e11a simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1962
diff changeset
  1715
  shows "supp S = atom ` S"
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1716
apply(simp add: supp_of_finite_sets[OF a])
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1717
apply(simp add: supp_at_base)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1718
apply(auto)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1719
done
1971
8daf6ff5e11a simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1962
diff changeset
  1720
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1721
section {* Infrastructure for concrete atom types *}
1971
8daf6ff5e11a simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1962
diff changeset
  1722
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1723
section {* A swapping operation for concrete atoms *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1724
  
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1725
definition
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1726
  flip :: "'a::at_base \<Rightarrow> 'a \<Rightarrow> perm" ("'(_ \<leftrightarrow> _')")
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1727
where
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1728
  "(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1729
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1730
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1731
  unfolding flip_def by (rule swap_self)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1732
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1733
lemma flip_commute: "(a \<leftrightarrow> b) = (b \<leftrightarrow> a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1734
  unfolding flip_def by (rule swap_commute)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1735
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1736
lemma minus_flip [simp]: "- (a \<leftrightarrow> b) = (a \<leftrightarrow> b)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1737
  unfolding flip_def by (rule minus_swap)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1738
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1739
lemma add_flip_cancel: "(a \<leftrightarrow> b) + (a \<leftrightarrow> b) = 0"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1740
  unfolding flip_def by (rule swap_cancel)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1741
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1742
lemma permute_flip_cancel [simp]: "(a \<leftrightarrow> b) \<bullet> (a \<leftrightarrow> b) \<bullet> x = x"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1743
  unfolding permute_plus [symmetric] add_flip_cancel by simp
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1744
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1745
lemma permute_flip_cancel2 [simp]: "(a \<leftrightarrow> b) \<bullet> (b \<leftrightarrow> a) \<bullet> x = x"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1746
  by (simp add: flip_commute)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1747
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1748
lemma flip_eqvt: 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1749
  fixes a b c::"'a::at_base"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1750
  shows "p \<bullet> (a \<leftrightarrow> b) = (p \<bullet> a \<leftrightarrow> p \<bullet> b)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1751
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1752
  by (simp add: swap_eqvt atom_eqvt)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1753
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1754
lemma flip_at_base_simps [simp]:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1755
  shows "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> a = b"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1756
  and   "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> b = a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1757
  and   "\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> c = c"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1758
  and   "sort_of (atom a) \<noteq> sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> x = x"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1759
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1760
  unfolding atom_eq_iff [symmetric]
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1761
  unfolding atom_eqvt [symmetric]
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1762
  by simp_all
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1763
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1764
text {* the following two lemmas do not hold for at_base, 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1765
  only for single sort atoms from at *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1766
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1767
lemma permute_flip_at:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1768
  fixes a b c::"'a::at"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1769
  shows "(a \<leftrightarrow> b) \<bullet> c = (if c = a then b else if c = b then a else c)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1770
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1771
  apply (rule atom_eq_iff [THEN iffD1])
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1772
  apply (subst atom_eqvt [symmetric])
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1773
  apply (simp add: swap_atom)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1774
  done
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1775
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1776
lemma flip_at_simps [simp]:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1777
  fixes a b::"'a::at"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1778
  shows "(a \<leftrightarrow> b) \<bullet> a = b" 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1779
  and   "(a \<leftrightarrow> b) \<bullet> b = a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1780
  unfolding permute_flip_at by simp_all
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1781
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1782
lemma flip_fresh_fresh:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1783
  fixes a b::"'a::at_base"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1784
  assumes "atom a \<sharp> x" "atom b \<sharp> x"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1785
  shows "(a \<leftrightarrow> b) \<bullet> x = x"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1786
using assms
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1787
by (simp add: flip_def swap_fresh_fresh)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1788
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1789
subsection {* Syntax for coercing at-elements to the atom-type *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1790
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1791
syntax
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1792
  "_atom_constrain" :: "logic \<Rightarrow> type \<Rightarrow> logic" ("_:::_" [4, 0] 3)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1793
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1794
translations
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1795
  "_atom_constrain a t" => "CONST atom (_constrain a t)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1796
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1797
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1798
subsection {* A lemma for proving instances of class @{text at}. *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1799
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1800
setup {* Sign.add_const_constraint (@{const_name "permute"}, NONE) *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1801
setup {* Sign.add_const_constraint (@{const_name "atom"}, NONE) *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1802
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1803
text {*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1804
  New atom types are defined as subtypes of @{typ atom}.
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1805
*}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1806
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1807
lemma exists_eq_simple_sort: 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1808
  shows "\<exists>a. a \<in> {a. sort_of a = s}"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1809
  by (rule_tac x="Atom s 0" in exI, simp)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1810
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1811
lemma exists_eq_sort: 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1812
  shows "\<exists>a. a \<in> {a. sort_of a \<in> range sort_fun}"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1813
  by (rule_tac x="Atom (sort_fun x) y" in exI, simp)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1814
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1815
lemma at_base_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1816
  fixes sort_fun :: "'b \<Rightarrow>atom_sort"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1817
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1818
  assumes type: "type_definition Rep Abs {a. sort_of a \<in> range sort_fun}"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1819
  assumes atom_def: "\<And>a. atom a = Rep a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1820
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1821
  shows "OFCLASS('a, at_base_class)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1822
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1823
  interpret type_definition Rep Abs "{a. sort_of a \<in> range sort_fun}" by (rule type)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1824
  have sort_of_Rep: "\<And>a. sort_of (Rep a) \<in> range sort_fun" using Rep by simp
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1825
  fix a b :: 'a and p p1 p2 :: perm
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1826
  show "0 \<bullet> a = a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1827
    unfolding permute_def by (simp add: Rep_inverse)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1828
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1829
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1830
  show "atom a = atom b \<longleftrightarrow> a = b"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1831
    unfolding atom_def by (simp add: Rep_inject)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1832
  show "p \<bullet> atom a = atom (p \<bullet> a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1833
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1834
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1835
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1836
(*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1837
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1838
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1839
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1840
  assumes type: "type_definition Rep Abs {a. sort_of a \<in> range (\<lambda>x::unit. s)}"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1841
  assumes atom_def: "\<And>a. atom a = Rep a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1842
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1843
  shows "OFCLASS('a, at_class)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1844
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1845
  interpret type_definition Rep Abs "{a. sort_of a \<in> range (\<lambda>x::unit. s)}" by (rule type)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1846
  have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1847
  fix a b :: 'a and p p1 p2 :: perm
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1848
  show "0 \<bullet> a = a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1849
    unfolding permute_def by (simp add: Rep_inverse)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1850
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1851
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1852
  show "sort_of (atom a) = sort_of (atom b)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1853
    unfolding atom_def by (simp add: sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1854
  show "atom a = atom b \<longleftrightarrow> a = b"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1855
    unfolding atom_def by (simp add: Rep_inject)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1856
  show "p \<bullet> atom a = atom (p \<bullet> a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1857
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1858
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1859
*)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1860
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1861
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1862
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1863
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1864
  assumes type: "type_definition Rep Abs {a. sort_of a = s}"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1865
  assumes atom_def: "\<And>a. atom a = Rep a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1866
  assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1867
  shows "OFCLASS('a, at_class)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1868
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1869
  interpret type_definition Rep Abs "{a. sort_of a = s}" by (rule type)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1870
  have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1871
  fix a b :: 'a and p p1 p2 :: perm
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1872
  show "0 \<bullet> a = a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1873
    unfolding permute_def by (simp add: Rep_inverse)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1874
  show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1875
    unfolding permute_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1876
  show "sort_of (atom a) = sort_of (atom b)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1877
    unfolding atom_def by (simp add: sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1878
  show "atom a = atom b \<longleftrightarrow> a = b"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1879
    unfolding atom_def by (simp add: Rep_inject)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1880
  show "p \<bullet> atom a = atom (p \<bullet> a)"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1881
    unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1882
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1883
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1884
setup {* Sign.add_const_constraint
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1885
  (@{const_name "permute"}, SOME @{typ "perm \<Rightarrow> 'a::pt \<Rightarrow> 'a"}) *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1886
setup {* Sign.add_const_constraint
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1887
  (@{const_name "atom"}, SOME @{typ "'a::at_base \<Rightarrow> atom"}) *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1888
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  1889
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1890
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1891
section {* The freshness lemma according to Andy Pitts *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1892
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1893
lemma freshness_lemma:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1894
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1895
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1896
  shows  "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1897
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1898
  from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1899
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1900
  show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1901
  proof (intro exI allI impI)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1902
    fix a :: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1903
    assume a3: "atom a \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1904
    show "h a = h b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1905
    proof (cases "a = b")
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1906
      assume "a = b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1907
      thus "h a = h b" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1908
    next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1909
      assume "a \<noteq> b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1910
      hence "atom a \<sharp> b" by (simp add: fresh_at_base)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1911
      with a3 have "atom a \<sharp> h b" 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1912
        by (rule fresh_fun_app)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1913
      with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1914
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1915
      from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1916
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1917
      from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1918
      also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1919
        by (rule permute_fun_app_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1920
      also have "\<dots> = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1921
        using d2 by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1922
      finally show "h a = h b"  by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1923
    qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1924
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1925
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1926
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1927
lemma freshness_lemma_unique:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1928
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1929
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1930
  shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1931
proof (rule ex_ex1I)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1932
  from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1933
    by (rule freshness_lemma)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1934
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1935
  fix x y
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1936
  assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1937
  assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1938
  from a x y show "x = y"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1939
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1940
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1941
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1942
text {* packaging the freshness lemma into a function *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1943
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1944
definition
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1945
  fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1946
where
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1947
  "fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1948
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1949
lemma fresh_fun_apply:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1950
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1951
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1952
  assumes b: "atom a \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1953
  shows "fresh_fun h = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1954
unfolding fresh_fun_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1955
proof (rule the_equality)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1956
  show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1957
  proof (intro strip)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1958
    fix a':: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1959
    assume c: "atom a' \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1960
    from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1961
    with b c show "h a' = h a" by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1962
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1963
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1964
  fix fr :: 'b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1965
  assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1966
  with b show "fr = h a" by auto
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1967
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1968
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1969
lemma fresh_fun_apply':
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1970
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1971
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1972
  shows "fresh_fun h = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1973
  apply (rule fresh_fun_apply)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1974
  apply (auto simp add: fresh_Pair intro: a)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1975
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1976
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1977
lemma fresh_fun_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1978
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1979
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1980
  shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1981
  using a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1982
  apply (clarsimp simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1983
  apply (subst fresh_fun_apply', assumption+)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1984
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1985
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1986
  apply (simp add: atom_eqvt permute_fun_app_eq [where f=h])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1987
  apply (erule (1) fresh_fun_apply' [symmetric])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1988
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1989
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1990
lemma fresh_fun_supports:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1991
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1992
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1993
  shows "(supp h) supports (fresh_fun h)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1994
  apply (simp add: supports_def fresh_def [symmetric])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1995
  apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1996
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1997
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1998
notation fresh_fun (binder "FRESH " 10)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1999
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2000
lemma FRESH_f_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2001
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2002
  fixes f :: "'b \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2003
  assumes P: "finite (supp P)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2004
  shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2005
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2006
  obtain a::'a where "atom a \<notin> supp P"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2007
    using P by (rule obtain_at_base)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2008
  hence "atom a \<sharp> P"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2009
    by (simp add: fresh_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2010
  show "(FRESH x. f (P x)) = f (FRESH x. P x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2011
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2012
    apply (cut_tac `atom a \<sharp> P`)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2013
    apply (simp add: fresh_conv_MOST)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2014
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
  2015
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2016
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2017
    apply (rule refl)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2018
    done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2019
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2020
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2021
lemma FRESH_binop_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2022
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2023
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2024
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2025
  assumes P: "finite (supp P)" 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2026
  and     Q: "finite (supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2027
  shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2028
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2029
  from assms have "finite (supp P \<union> supp Q)" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2030
  then obtain a::'a where "atom a \<notin> (supp P \<union> supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2031
    by (rule obtain_at_base)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2032
  hence "atom a \<sharp> P" and "atom a \<sharp> Q"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2033
    by (simp_all add: fresh_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2034
  show ?thesis
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2035
    apply (subst fresh_fun_apply' [where a=a, OF _ pure_fresh])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2036
    apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2037
    apply (simp add: fresh_conv_MOST)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2038
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
  2039
    apply (simp add: permute_fun_def permute_pure fun_eq_iff)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2040
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> P` pure_fresh])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2041
    apply (subst fresh_fun_apply' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2042
    apply (rule refl)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2043
    done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2044
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2045
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2046
lemma FRESH_conj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2047
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2048
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2049
  shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2050
using P Q by (rule FRESH_binop_iff)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2051
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2052
lemma FRESH_disj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2053
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2054
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2055
  shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2056
using P Q by (rule FRESH_binop_iff)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2057
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2058
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2059
section {* Library functions for the nominal infrastructure *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2060
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
  2061
use "nominal_library.ML"
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
  2062
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2063
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2064
section {* Automation for creating concrete atom types *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2065
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2066
text {* at the moment only single-sort concrete atoms are supported *}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2067
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2068
use "nominal_atoms.ML"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2069
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2070
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2071
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  2072
end