Nominal/Nominal2_Base.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 03 May 2011 13:09:08 +0100
changeset 2777 75a95431cd8b
parent 2771 66ef2a2c64fb
child 2780 2c6851248b3f
permissions -rw-r--r--
proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
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
2635
64b4cb2c2bf8 simple cases for string rule inductions
Christian Urban <urbanc@in.tum.de>
parents: 2632
diff changeset
     8
imports Main 
64b4cb2c2bf8 simple cases for string rule inductions
Christian Urban <urbanc@in.tum.de>
parents: 2632
diff changeset
     9
        "~~/src/HOL/Library/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
    10
        "~~/src/HOL/Quotient_Examples/FSet"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
    11
uses ("nominal_basics.ML")
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
    12
     ("nominal_thmdecls.ML")
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
    13
     ("nominal_permeq.ML")
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
    14
     ("nominal_library.ML")
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
    15
     ("nominal_atoms.ML")
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
    16
     ("nominal_eqvt.ML")
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    17
begin
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
section {* Atoms and Sorts *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    20
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    21
text {* A simple implementation for atom_sorts is strings. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    22
(* types atom_sort = string *)
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
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
    25
  strings as sorts. *}
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
datatype atom_sort = Sort "string" "atom_sort list"
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
datatype atom = Atom atom_sort nat
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    30
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    31
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    32
text {* Basic projection function. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    33
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    34
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    35
  sort_of :: "atom \<Rightarrow> atom_sort"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    36
where
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
    37
  "sort_of (Atom s n) = s"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    38
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    39
primrec
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    40
  nat_of :: "atom \<Rightarrow> nat"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    41
where
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    42
  "nat_of (Atom s n) = n"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    43
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    44
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    45
text {* There are infinitely many atoms of each sort. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    46
lemma INFM_sort_of_eq: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    47
  shows "INFM a. sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    48
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    49
  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
    50
  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
    51
  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
    52
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    53
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    54
lemma infinite_sort_of_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    55
  shows "infinite {a. sort_of a = s}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    56
  using INFM_sort_of_eq unfolding INFM_iff_infinite .
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 atom_infinite [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    59
  shows "infinite (UNIV :: atom set)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    60
  using subset_UNIV infinite_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    61
  by (rule infinite_super)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    62
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    63
lemma obtain_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    64
  fixes X :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    65
  assumes X: "finite X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    66
  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
    67
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    68
  from X have "MOST a. a \<notin> X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    69
    unfolding MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    70
  with INFM_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    71
  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
    72
    by (rule INFM_conjI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    73
  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
    74
    by (auto elim: INFM_E)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    75
  then show ?thesis ..
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    76
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    77
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    78
lemma atom_components_eq_iff:
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    79
  fixes a b :: atom
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    80
  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
    81
  by (induct a, induct b, simp)
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    82
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
    83
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    84
section {* Sort-Respecting Permutations *}
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
typedef perm =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    87
  "{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
    88
proof
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    89
  show "id \<in> ?perm" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    90
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    91
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    92
lemma permI:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    93
  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
    94
  shows "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    95
  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
    96
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    97
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
    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_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
   101
  unfolding perm_def 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_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
   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_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
   107
  unfolding perm_def MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   108
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   109
lemma perm_id: "id \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   110
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   111
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   112
lemma perm_comp:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   113
  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
   114
  shows "(f \<circ> g) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   115
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   116
apply (rule bij_comp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   117
apply (rule perm_is_bij [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   118
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   119
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
   120
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
   121
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   122
apply (simp add: perm_is_sort_respecting [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   123
apply (simp add: perm_is_sort_respecting [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   124
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   125
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   126
lemma perm_inv:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   127
  assumes f: "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   128
  shows "(inv f) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   129
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   130
apply (rule bij_imp_bij_inv)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   131
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   132
apply (rule MOST_mono [OF perm_MOST [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   133
apply (erule subst, rule inv_f_f)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   134
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
   135
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
   136
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
   137
done
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 bij_Rep_perm: "bij (Rep_perm p)"
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 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
   143
  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
   144
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   145
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
   146
  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
   147
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   148
lemma Rep_perm_ext:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   149
  "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
   150
  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
   151
2560
82e37a4595c7 automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents: 2507
diff changeset
   152
instance perm :: size ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   153
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   154
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   155
subsection {* Permutations form a (multiplicative) group *}
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   156
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   157
instantiation perm :: group_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   158
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   159
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   160
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   161
  "0 = Abs_perm id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   162
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   163
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   164
  "- p = Abs_perm (inv (Rep_perm p))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   165
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   166
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   167
  "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
   168
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   169
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   170
  "(p1::perm) - p2 = p1 + - p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   171
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   172
lemma Rep_perm_0: "Rep_perm 0 = id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
  unfolding zero_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
  by (simp add: Abs_perm_inverse perm_id)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   175
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
lemma Rep_perm_add:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
  "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
   178
  unfolding plus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   179
  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
   180
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   181
lemma Rep_perm_uminus:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   182
  "Rep_perm (- p) = inv (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   183
  unfolding uminus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   184
  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
   185
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   188
unfolding Rep_perm_inject [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
unfolding minus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
unfolding Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
unfolding Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
unfolding Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   193
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
   194
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   195
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   196
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   197
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   198
section {* Implementation of swappings *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   199
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   200
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   201
  swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   202
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
  "(a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
    Abs_perm (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
              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
   206
              else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   207
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   208
lemma Rep_perm_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   209
  "Rep_perm (a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
    (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
     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
   212
     else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   213
unfolding swap_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   214
apply (rule Abs_perm_inverse)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   215
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   216
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
   217
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
   218
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
   219
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   220
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   221
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   222
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
lemmas Rep_perm_simps =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
  Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   225
  Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   226
  Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
  Rep_perm_swap
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   228
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   229
lemma swap_different_sorts [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
  "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
   231
  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
   232
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   233
lemma swap_cancel:
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   234
  shows "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   235
  and   "(a \<rightleftharpoons> b) + (b \<rightleftharpoons> a) = 0"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   236
  by (rule_tac [!] Rep_perm_ext) 
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   237
     (simp_all add: Rep_perm_simps fun_eq_iff)
1062
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_self [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   240
  "(a \<rightleftharpoons> a) = 0"
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   241
  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
   242
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
lemma minus_swap [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   244
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   245
  by (rule minus_unique [OF swap_cancel(1)])
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
lemma swap_commute:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   248
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   249
  by (rule Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   250
     (simp add: Rep_perm_swap 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
lemma swap_triple:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   253
  assumes "a \<noteq> b" and "c \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
  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
   255
  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
   256
  using assms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
  by (rule_tac Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   258
     (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
   259
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   261
section {* Permutation Types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   262
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   263
text {*
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   264
  Infix syntax for @{text permute} has higher precedence than
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   265
  addition, but lower than unary minus.
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
*}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   268
class pt =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   269
  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
   270
  assumes permute_zero [simp]: "0 \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
  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
   272
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   273
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   274
lemma permute_diff [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   275
  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
   276
  unfolding diff_minus by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   277
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
lemma permute_minus_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   279
  shows "p \<bullet> - p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
  and   "- p \<bullet> p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
  unfolding permute_plus [symmetric] by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
lemma permute_swap_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
  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
   285
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
  by (simp add: swap_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   288
lemma permute_swap_cancel2 [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
  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
   290
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   291
  by (simp add: swap_commute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   293
lemma inj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   294
  shows "inj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   295
  by (rule inj_on_inverseI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
     (rule permute_minus_cancel)
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 surj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   299
  shows "surj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   300
  by (rule surjI, rule permute_minus_cancel)
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 bij_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
  shows "bij (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
  by (rule bijI [OF inj_permute surj_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 inv_permute: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
  shows "inv (permute p) = permute (- p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   308
  by (rule inv_equality) (simp_all)
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
lemma permute_minus: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   311
  shows "permute (- p) = inv (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
  by (simp add: inv_permute)
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
lemma permute_eq_iff [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   315
  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
   316
  by (rule inj_permute [THEN inj_eq])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   317
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   318
end
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
subsection {* Permutations for atoms *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
instantiation atom :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   323
begin
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
definition
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   326
  "p \<bullet> a = (Rep_perm p) a"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   327
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   328
instance 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   329
apply(default)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
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
   331
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   332
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   333
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   334
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   335
lemma sort_of_permute [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
  shows "sort_of (p \<bullet> a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   337
  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
   338
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   339
lemma swap_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
  shows "(a \<rightleftharpoons> b) \<bullet> c =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   341
           (if sort_of a = sort_of b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
            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
   343
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   344
  by (simp add: Rep_perm_swap)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   346
lemma swap_atom_simps [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
  "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
   348
  "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
   349
  "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
   350
  unfolding swap_atom by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   351
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   352
lemma perm_eq_iff:
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   353
  fixes p q :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
  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
   355
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
  by (metis Rep_perm_ext ext)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
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
subsection {* Permutations for permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   360
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   361
instantiation perm :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   362
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   363
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   364
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   365
  "p \<bullet> q = p + q - p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   366
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   367
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   368
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   369
apply (simp add: permute_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   370
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
   371
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   372
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   374
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   375
lemma permute_self: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   376
  shows "p \<bullet> p = p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   377
  unfolding permute_perm_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   378
  by (simp add: diff_minus add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   379
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   380
lemma pemute_minus_self:
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   381
  shows "- p \<bullet> p = p"
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   382
  unfolding permute_perm_def 
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   383
  by (simp add: diff_minus add_assoc)
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   384
1062
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
subsection {* Permutations for functions *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   387
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   388
instantiation "fun" :: (pt, pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   389
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   390
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   391
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   392
  "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
   393
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   394
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   395
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   396
apply (simp add: permute_fun_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   397
apply (simp add: permute_fun_def minus_add)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   398
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   399
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   400
end
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
lemma permute_fun_app_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   403
  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
   404
  unfolding permute_fun_def by simp
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   405
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
   406
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   407
subsection {* Permutations for booleans *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   408
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   409
instantiation bool :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   410
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   411
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   412
definition "p \<bullet> (b::bool) = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   413
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   414
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   415
apply(default) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   416
apply(simp_all add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   417
done
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
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   420
1557
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   421
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
   422
  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
   423
  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
   424
  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
   425
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   426
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
   427
  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
   428
  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
   429
  by(simp add: permute_bool_def)
1062
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
subsection {* Permutations for sets *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   432
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   433
lemma permute_set_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   434
  fixes x::"'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   435
  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
   436
  unfolding permute_fun_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   437
  unfolding permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   438
  apply(auto simp add: mem_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   439
  apply(rule_tac x="- p \<bullet> x" in exI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   440
  apply(simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   441
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   442
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   443
lemma permute_set_eq_image:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   444
  shows "p \<bullet> X = permute p ` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   445
  unfolding permute_set_eq by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   446
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   447
lemma permute_set_eq_vimage:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   448
  shows "p \<bullet> X = permute (- p) -` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   449
  unfolding permute_fun_def permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   450
  unfolding vimage_def Collect_def mem_def ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   451
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   452
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
   453
  shows "finite (p \<bullet> X) = finite X"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   454
  unfolding permute_set_eq_vimage
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   455
  using bij_permute by (rule finite_vimage_iff)
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   456
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   457
lemma swap_set_not_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   458
  assumes a: "a \<notin> S" "b \<notin> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   459
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   460
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   461
  using a by (auto simp add: swap_atom)
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
lemma swap_set_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   464
  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
   465
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   466
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   467
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   468
2669
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   469
lemma swap_set_in_eq:
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   470
  assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   471
  shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   472
  unfolding permute_set_eq
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   473
  using a by (auto simp add: swap_atom)
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   474
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   475
lemma swap_set_both_in:
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   476
  assumes a: "a \<in> S" "b \<in> S"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   477
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   478
  unfolding permute_set_eq
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   479
  using a by (auto simp add: swap_atom)
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
   480
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   481
lemma mem_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   482
  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
   483
  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
   484
  by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   485
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   486
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
   487
  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
   488
  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
   489
  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
   490
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   491
lemma insert_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   492
  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
   493
  unfolding permute_set_eq_image image_insert ..
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   494
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   495
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   496
subsection {* Permutations for @{typ unit} *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   497
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   498
instantiation unit :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   499
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   500
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   501
definition "p \<bullet> (u::unit) = u"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   502
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   503
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   504
by (default) (simp_all add: permute_unit_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   505
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   506
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   507
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   508
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   509
subsection {* Permutations for products *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   510
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   511
instantiation prod :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   512
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   513
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   514
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   515
  permute_prod 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   516
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   517
  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
   518
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   519
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   520
by default auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   521
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   522
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   523
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   524
subsection {* Permutations for sums *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   525
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   526
instantiation sum :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   527
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   528
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   529
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   530
  permute_sum 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   531
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   532
  "p \<bullet> (Inl x) = Inl (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   533
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   534
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   535
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   536
by (default) (case_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   537
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   538
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   539
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   540
subsection {* Permutations for @{typ "'a list"} *}
1062
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
instantiation list :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   543
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   544
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   545
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   546
  permute_list 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   547
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   548
  "p \<bullet> [] = []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   549
| "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
   550
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   551
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   552
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   553
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   554
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   555
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   556
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
   557
  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
   558
  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
   559
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   560
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   561
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   562
subsection {* Permutations for @{typ "'a option"} *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   563
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   564
instantiation option :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   565
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   566
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   567
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   568
  permute_option 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   569
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   570
  "p \<bullet> None = None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   571
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   572
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   573
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   574
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   575
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   576
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   577
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   578
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   579
subsection {* Permutations for @{typ "'a fset"} *}
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   580
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   581
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
   582
  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
   583
  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
   584
  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
   585
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   586
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
   587
begin
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   588
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   589
quotient_definition
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   590
  "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
   591
is
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   592
  "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
   593
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   594
instance 
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   595
proof
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   596
  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
   597
  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
   598
  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
   599
qed
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   600
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   601
end
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   602
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   603
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
   604
  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
   605
  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
   606
  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
   607
  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
   608
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   609
lemma fset_eqvt: 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   610
  shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   611
  by (lifting set_eqvt)
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   612
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   613
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   614
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
   615
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   616
instantiation char :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   617
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   618
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   619
definition "p \<bullet> (c::char) = c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   620
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   621
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   622
by (default) (simp_all add: permute_char_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   623
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   624
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   625
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   626
instantiation nat :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   627
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   628
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   629
definition "p \<bullet> (n::nat) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   630
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   631
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   632
by (default) (simp_all add: permute_nat_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   633
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   634
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   635
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   636
instantiation int :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   637
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   638
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   639
definition "p \<bullet> (i::int) = i"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   640
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   641
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   642
by (default) (simp_all add: permute_int_def)
1062
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
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   645
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
section {* Pure types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   648
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   649
text {* Pure types will have always empty support. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   650
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   651
class pure = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   652
  assumes permute_pure: "p \<bullet> x = x"
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
text {* Types @{typ unit} and @{typ bool} are pure. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   655
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   656
instance unit :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   657
proof qed (rule permute_unit_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   658
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   659
instance bool :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   660
proof qed (rule permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   661
2635
64b4cb2c2bf8 simple cases for string rule inductions
Christian Urban <urbanc@in.tum.de>
parents: 2632
diff changeset
   662
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   663
text {* Other type constructors preserve purity. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   664
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   665
instance "fun" :: (pure, pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   666
by default (simp add: permute_fun_def permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   667
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   668
instance prod :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   669
by default (induct_tac x, simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   670
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   671
instance sum :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   672
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
   673
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   674
instance list :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   675
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
   676
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   677
instance option :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   678
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
   679
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   680
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   681
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   682
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   683
instance char :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   684
proof qed (rule permute_char_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   685
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   686
instance nat :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   687
proof qed (rule permute_nat_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   688
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   689
instance int :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   690
proof qed (rule permute_int_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   691
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   692
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   693
section {* Infrastructure for Equivariance and Perm_simp *}
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   694
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   695
subsection {* Basic functions about permutations *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   696
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   697
use "nominal_basics.ML"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   698
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   699
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   700
subsection {* Eqvt infrastructure *}
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   701
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   702
text {* Setup of the theorem attributes @{text eqvt} and @{text eqvt_raw} *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   703
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   704
use "nominal_thmdecls.ML"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   705
setup "Nominal_ThmDecls.setup"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   706
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   707
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   708
lemmas [eqvt] =
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   709
  (* pt types *)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   710
  permute_prod.simps 
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   711
  permute_list.simps 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   712
  permute_option.simps 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   713
  permute_sum.simps
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   714
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   715
  (* sets *)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   716
  empty_eqvt insert_eqvt set_eqvt 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   717
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   718
  (* fsets *)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   719
  permute_fset fset_eqvt
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   720
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   721
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   722
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   723
subsection {* perm_simp infrastructure *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   724
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   725
definition
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   726
  "unpermute p = permute (- p)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   727
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   728
lemma eqvt_apply:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   729
  fixes f :: "'a::pt \<Rightarrow> 'b::pt" 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   730
  and x :: "'a::pt"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   731
  shows "p \<bullet> (f x) \<equiv> (p \<bullet> f) (p \<bullet> x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   732
  unfolding permute_fun_def by simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   734
lemma eqvt_lambda:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   735
  fixes f :: "'a::pt \<Rightarrow> 'b::pt"
2753
445518561867 eqvt_lambda without eta-expansion
Christian Urban <urbanc@in.tum.de>
parents: 2743
diff changeset
   736
  shows "p \<bullet> f \<equiv> (\<lambda>x. p \<bullet> (f (unpermute p x)))"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   737
  unfolding permute_fun_def unpermute_def by simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   738
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   739
lemma eqvt_bound:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   740
  shows "p \<bullet> unpermute p x \<equiv> x"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   741
  unfolding unpermute_def by simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   742
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   743
text {* provides perm_simp methods *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   744
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   745
use "nominal_permeq.ML"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   746
setup Nominal_Permeq.setup
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   747
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   748
method_setup perm_simp =
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   749
 {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_simp_meth *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   750
 {* pushes permutations inside. *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   751
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   752
method_setup perm_strict_simp =
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   753
 {* Nominal_Permeq.args_parser >> Nominal_Permeq.perm_strict_simp_meth *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   754
 {* pushes permutations inside, raises an error if it cannot solve all permutations. *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   755
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   756
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   757
subsubsection {* Equivariance for permutations and swapping *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   758
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   759
lemma permute_eqvt:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   760
  shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   761
  unfolding permute_perm_def by simp
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   762
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   763
(* the normal version of this lemma would cause loops *)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   764
lemma permute_eqvt_raw[eqvt_raw]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   765
  shows "p \<bullet> permute \<equiv> permute"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   766
apply(simp add: fun_eq_iff permute_fun_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   767
apply(subst permute_eqvt)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   768
apply(simp)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   769
done
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   770
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   771
lemma zero_perm_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   772
  shows "p \<bullet> (0::perm) = 0"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   773
  unfolding permute_perm_def by simp
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   774
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   775
lemma add_perm_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   776
  fixes p p1 p2 :: perm
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   777
  shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   778
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   779
  by (simp add: perm_eq_iff)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   780
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   781
lemma swap_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   782
  shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   783
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   784
  by (auto simp add: swap_atom perm_eq_iff)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   785
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   786
lemma uminus_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   787
  fixes p q::"perm"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   788
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   789
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   790
  by (simp add: diff_minus minus_add add_assoc)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   791
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   792
subsubsection {* Equivariance of Logical Operators *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   793
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   794
lemma eq_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   795
  shows "p \<bullet> (x = y) \<longleftrightarrow> (p \<bullet> x) = (p \<bullet> y)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   796
  unfolding permute_eq_iff permute_bool_def ..
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   797
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   798
lemma Not_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   799
  shows "p \<bullet> (\<not> A) \<longleftrightarrow> \<not> (p \<bullet> A)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   800
  by (simp add: permute_bool_def)
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   801
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   802
lemma conj_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   803
  shows "p \<bullet> (A \<and> B) \<longleftrightarrow> (p \<bullet> A) \<and> (p \<bullet> B)"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   804
  by (simp add: permute_bool_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   805
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   806
lemma imp_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   807
  shows "p \<bullet> (A \<longrightarrow> B) \<longleftrightarrow> (p \<bullet> A) \<longrightarrow> (p \<bullet> B)"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   808
  by (simp add: permute_bool_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   809
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   810
declare imp_eqvt[folded induct_implies_def, eqvt]
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   811
2743
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   812
lemma all_eqvt [eqvt]:
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   813
  shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. (p \<bullet> P) x)"
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   814
  unfolding All_def
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   815
  by (perm_simp) (rule refl)
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   816
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   817
declare all_eqvt[folded induct_forall_def, eqvt]
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   818
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   819
lemma ex_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   820
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
2743
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   821
  unfolding Ex_def
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   822
  by (perm_simp) (rule refl)
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   823
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   824
lemma ex1_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   825
  shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. (p \<bullet> P) x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   826
  unfolding Ex1_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   827
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   828
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   829
lemma mem_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   830
  shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   831
  unfolding mem_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   832
  by (simp add: permute_fun_app_eq)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   833
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   834
lemma Collect_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   835
  shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   836
  unfolding Collect_def permute_fun_def ..
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   837
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   838
lemma inter_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   839
  shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   840
  unfolding Int_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   841
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   842
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   843
lemma image_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   844
  shows "p \<bullet> (f ` A) = (p \<bullet> f) ` (p \<bullet> A)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   845
  unfolding permute_set_eq_image
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   846
  unfolding permute_fun_def [where f=f]
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   847
  by (simp add: image_image)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   848
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   849
lemma if_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   850
  shows "p \<bullet> (if b then x else y) = (if p \<bullet> b then p \<bullet> x else p \<bullet> y)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   851
  by (simp add: permute_fun_def permute_bool_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   852
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   853
lemma True_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   854
  shows "p \<bullet> True = True"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   855
  unfolding permute_bool_def ..
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   856
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   857
lemma False_eqvt [eqvt]:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   858
  shows "p \<bullet> False = False"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   859
  unfolding permute_bool_def ..
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   860
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   861
lemma disj_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   862
  shows "p \<bullet> (A \<or> B) \<longleftrightarrow> (p \<bullet> A) \<or> (p \<bullet> B)"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   863
  by (simp add: permute_bool_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   864
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   865
lemma all_eqvt2:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   866
  shows "p \<bullet> (\<forall>x. P x) = (\<forall>x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   867
  by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   868
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   869
lemma ex_eqvt2:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   870
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   871
  by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   872
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   873
lemma ex1_eqvt2:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   874
  shows "p \<bullet> (\<exists>!x. P x) = (\<exists>!x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   875
  by (perm_simp add: permute_minus_cancel) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   876
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   877
lemma the_eqvt:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   878
  assumes unique: "\<exists>!x. P x"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   879
  shows "(p \<bullet> (THE x. P x)) = (THE x. (p \<bullet> P) x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   880
  apply(rule the1_equality [symmetric])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   881
  apply(rule_tac p="-p" in permute_boolE)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   882
  apply(perm_simp add: permute_minus_cancel)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   883
  apply(rule unique)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   884
  apply(rule_tac p="-p" in permute_boolE)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   885
  apply(perm_simp add: permute_minus_cancel)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   886
  apply(rule theI'[OF unique])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   887
  done
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   888
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   889
lemma the_eqvt2:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   890
  assumes unique: "\<exists>!x. P x"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   891
  shows "(p \<bullet> (THE x. P x)) = (THE x. p \<bullet> P (- p \<bullet> x))"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   892
  apply(rule the1_equality [symmetric])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   893
  apply(simp add: ex1_eqvt2[symmetric])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   894
  apply(simp add: permute_bool_def unique)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   895
  apply(simp add: permute_bool_def)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   896
  apply(rule theI'[OF unique])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   897
  done
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   898
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   899
subsubsection {* Equivariance set operations *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   900
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   901
lemma Bex_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   902
  shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   903
  unfolding Bex_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   904
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   905
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   906
lemma Ball_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   907
  shows "p \<bullet> (\<forall>x \<in> S. P x) = (\<forall>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   908
  unfolding Ball_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   909
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   910
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   911
lemma UNIV_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   912
  shows "p \<bullet> UNIV = UNIV"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   913
  unfolding UNIV_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   914
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   915
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   916
lemma union_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   917
  shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   918
  unfolding Un_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   919
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   920
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   921
lemma Diff_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   922
  fixes A B :: "'a::pt set"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   923
  shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   924
  unfolding set_diff_eq
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   925
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   926
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   927
lemma Compl_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   928
  fixes A :: "'a::pt set"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   929
  shows "p \<bullet> (- A) = - (p \<bullet> A)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   930
  unfolding Compl_eq_Diff_UNIV
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   931
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   932
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   933
lemma subset_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   934
  shows "p \<bullet> (S \<subseteq> T) \<longleftrightarrow> (p \<bullet> S) \<subseteq> (p \<bullet> T)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   935
  unfolding subset_eq
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   936
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   937
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   938
lemma psubset_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   939
  shows "p \<bullet> (S \<subset> T) \<longleftrightarrow> (p \<bullet> S) \<subset> (p \<bullet> T)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   940
  unfolding psubset_eq
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   941
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   942
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   943
lemma vimage_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   944
  shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   945
  unfolding vimage_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   946
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   947
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   948
lemma Union_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   949
  shows "p \<bullet> (\<Union> S) = \<Union> (p \<bullet> S)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   950
  unfolding Union_eq 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   951
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   952
2777
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   953
lemma Inter_eqvt [eqvt]:
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   954
  shows "p \<bullet> (\<Inter> S) = \<Inter> (p \<bullet> S)"
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   955
  unfolding Inter_eq 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   956
  by (perm_simp) (rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   957
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   958
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   959
(* FIXME: eqvt attribute *)
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   960
lemma Sigma_eqvt:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   961
  shows "(p \<bullet> (X \<times> Y)) = (p \<bullet> X) \<times> (p \<bullet> Y)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   962
unfolding Sigma_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   963
unfolding UNION_eq_Union_image
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   964
by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   965
2777
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   966
text {* 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   967
  In order to prove that lfp is equivariant we need two
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   968
  auxiliary classes which specify that (op <=) and
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   969
  Inf are equivariant. Instances for bool and fun are 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   970
  given.
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   971
*}
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   972
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   973
class le_eqvt =  order + 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   974
  assumes le_eqvt [eqvt]: "p \<bullet> (x \<le> y) = ((p \<bullet> x) \<le> (p \<bullet> (y::('a::{pt, order}))))"
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   975
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   976
class inf_eqvt = complete_lattice +
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   977
  assumes inf_eqvt [eqvt]: "p \<bullet> (Inf X) = Inf (p \<bullet> (X::('a::{pt, Inf}) set))"
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   978
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   979
instantiation bool :: le_eqvt
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   980
begin
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   981
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   982
instance 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   983
apply(default)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   984
unfolding le_bool_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   985
apply(perm_simp)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   986
apply(rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   987
done
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   988
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   989
end
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   990
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   991
instantiation "fun" :: (pt, le_eqvt) le_eqvt
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   992
begin
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   993
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   994
instance 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   995
apply(default)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   996
unfolding le_fun_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   997
apply(perm_simp)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   998
apply(rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   999
done 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1000
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1001
end
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1002
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1003
instantiation bool :: inf_eqvt
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1004
begin
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1005
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1006
instance 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1007
apply(default)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1008
unfolding Inf_bool_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1009
apply(perm_simp)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1010
apply(rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1011
done
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1012
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1013
end
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1014
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1015
instantiation "fun" :: (pt, inf_eqvt) inf_eqvt
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1016
begin
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1017
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1018
instance 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1019
apply(default)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1020
unfolding Inf_fun_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1021
apply(perm_simp)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1022
apply(rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1023
done 
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1024
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1025
end
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1026
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1027
lemma lfp_eqvt [eqvt]:
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1028
  fixes F::"('a \<Rightarrow> 'b) \<Rightarrow> ('a::pt \<Rightarrow> 'b::{inf_eqvt, le_eqvt})"
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1029
  shows "p \<bullet> (lfp F) = lfp (p \<bullet> F)"
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1030
unfolding lfp_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1031
by (perm_simp) (rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1032
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1033
lemma finite_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1034
  shows "p \<bullet> finite A = finite (p \<bullet> A)"
2777
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1035
unfolding finite_def
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1036
by (perm_simp) (rule refl)
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1037
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1038
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1039
subsubsection {* Equivariance for product operations *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1040
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1041
lemma fst_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1042
  "p \<bullet> (fst x) = fst (p \<bullet> x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1043
 by (cases x) simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1044
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1045
lemma snd_eqvt [eqvt]:
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1046
  "p \<bullet> (snd x) = snd (p \<bullet> x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1047
 by (cases x) simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1048
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1049
lemma split_eqvt [eqvt]: 
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1050
  shows "p \<bullet> (split P x) = split (p \<bullet> P) (p \<bullet> x)"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1051
  unfolding split_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1052
  by (perm_simp) (rule refl)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1053
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1054
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1055
subsubsection {* Equivariance for list operations *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1056
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1057
lemma append_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1058
  shows "p \<bullet> (xs @ ys) = (p \<bullet> xs) @ (p \<bullet> ys)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1059
  by (induct xs) auto
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1060
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1061
lemma rev_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1062
  shows "p \<bullet> (rev xs) = rev (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1063
  by (induct xs) (simp_all add: append_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1064
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1065
lemma map_eqvt [eqvt]: 
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1066
  shows "p \<bullet> (map f xs) = map (p \<bullet> f) (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1067
  by (induct xs) (simp_all, simp only: permute_fun_app_eq)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1068
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1069
lemma removeAll_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1070
  shows "p \<bullet> (removeAll x xs) = removeAll (p \<bullet> x) (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1071
  by (induct xs) (auto)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1072
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1073
lemma filter_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1074
  shows "p \<bullet> (filter f xs) = filter (p \<bullet> f) (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1075
apply(induct xs)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1076
apply(simp)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1077
apply(simp only: filter.simps permute_list.simps if_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1078
apply(simp only: permute_fun_app_eq)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1079
done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1080
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1081
lemma distinct_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1082
  shows "p \<bullet> (distinct xs) = distinct (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1083
apply(induct xs)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1084
apply(simp add: permute_bool_def)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1085
apply(simp add: conj_eqvt Not_eqvt mem_eqvt set_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1086
done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1087
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1088
lemma length_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1089
  shows "p \<bullet> (length xs) = length (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1090
by (induct xs) (simp_all add: permute_pure)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1091
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1092
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1093
subsubsection {* Equivariance for @{typ "'a fset"} *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1094
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1095
lemma in_fset_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1096
  shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1097
unfolding in_fset
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1098
by (perm_simp) (simp)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1099
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1100
lemma union_fset_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1101
  shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1102
by (induct S) (simp_all)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1103
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1104
lemma map_fset_eqvt [eqvt]: 
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1105
  shows "p \<bullet> (map_fset f S) = map_fset (p \<bullet> f) (p \<bullet> S)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1106
  by (lifting map_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1107
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1108
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1109
section {* Supp, Freshness and Supports *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1110
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1111
context pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1112
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1113
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1114
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1115
  supp :: "'a \<Rightarrow> atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1116
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1117
  "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
  1118
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1119
definition
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1120
  fresh :: "atom \<Rightarrow> 'a \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1121
where   
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1122
  "a \<sharp> x \<equiv> a \<notin> supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1123
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1124
end
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1125
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1126
lemma supp_conv_fresh: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1127
  shows "supp x = {a. \<not> a \<sharp> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1128
  unfolding fresh_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1129
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1130
lemma swap_rel_trans:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1131
  assumes "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1132
  assumes "sort_of b = sort_of c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1133
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1134
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1135
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1136
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1137
  assume "a = b \<or> c = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1138
  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
  1139
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1140
  assume *: "\<not> (a = b \<or> c = b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1141
  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
  1142
    using assms by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1143
  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
  1144
    using assms * by (simp add: swap_triple)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1145
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1146
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1147
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1148
lemma swap_fresh_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1149
  assumes a: "a \<sharp> x" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1150
  and     b: "b \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1151
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1152
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1153
  assume asm: "sort_of a = sort_of b" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1154
  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
  1155
    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
  1156
  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
  1157
  then obtain c 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1158
    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
  1159
    by (rule obtain_atom) (auto)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1160
  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
  1161
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1162
  assume "sort_of a \<noteq> sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1163
  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
  1164
qed
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1167
subsection {* supp and fresh are equivariant *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1168
2760
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1169
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1170
lemma supp_eqvt [eqvt]:
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1171
  shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1172
  unfolding supp_def
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1173
  by (perm_simp)
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1174
     (simp only: permute_eqvt[symmetric])
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1175
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1176
lemma fresh_eqvt [eqvt]:
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1177
  shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1178
  unfolding fresh_def
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1179
  by (perm_simp) (rule refl)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1180
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1181
lemma fresh_permute_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1182
  shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
2760
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1183
  by (simp only: fresh_eqvt[symmetric] permute_bool_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1184
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1185
lemma fresh_permute_left:
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1186
  shows "a \<sharp> p \<bullet> x \<longleftrightarrow> - p \<bullet> a \<sharp> x"
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1187
proof
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1188
  assume "a \<sharp> p \<bullet> x"
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1189
  then have "- p \<bullet> a \<sharp> - p \<bullet> p \<bullet> x" by (simp only: fresh_permute_iff)
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1190
  then show "- p \<bullet> a \<sharp> x" by simp
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1191
next
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1192
  assume "- p \<bullet> a \<sharp> x"
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1193
  then have "p \<bullet> - p \<bullet> a \<sharp> p \<bullet> x" by (simp only: fresh_permute_iff)
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1194
  then show "a \<sharp> p \<bullet> x" by simp
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1195
qed
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1196
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1197
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1198
section {* supports *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1199
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1200
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1201
  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
  1202
where  
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1203
  "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
  1204
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1205
lemma supp_is_subset:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1206
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1207
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1208
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1209
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1210
  shows "(supp x) \<subseteq> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1211
proof (rule ccontr)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1212
  assume "\<not> (supp x \<subseteq> S)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1213
  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
  1214
  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
  1215
  then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1216
  with a2 have "finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}" by (simp add: finite_subset)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1217
  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
  1218
  with b1 show False by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1219
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1220
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1221
lemma supports_finite:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1222
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1223
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1224
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1225
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1226
  shows "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1227
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1228
  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
  1229
  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
  1230
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1231
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1232
lemma supp_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1233
  fixes x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1234
  shows "(supp x) supports x"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1235
unfolding supports_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1236
proof (intro strip)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1237
  fix a b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1238
  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
  1239
  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
  1240
  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
  1241
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1242
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1243
lemma supp_is_least_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1244
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1245
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1246
  assumes  a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1247
  and      a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1248
  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
  1249
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1250
proof (rule equalityI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1251
  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
  1252
  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
  1253
  have "(supp x) supports x" by (rule supp_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1254
  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
  1255
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1256
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1257
lemma subsetCI: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1258
  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
  1259
  by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1260
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1261
lemma finite_supp_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1262
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1263
  assumes a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1264
  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
  1265
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1266
  using a1 a2
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1267
proof (rule supp_is_least_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1268
  fix S'
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1269
  assume "finite S'" and "S' supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1270
  show "S \<subseteq> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1271
  proof (rule subsetCI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1272
    fix a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1273
    assume "a \<in> S" and "a \<notin> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1274
    have "finite (S \<union> S')"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1275
      using `finite S` `finite S'` by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1276
    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
  1277
      by (rule obtain_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1278
    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
  1279
      by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1280
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1281
      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
  1282
    moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1283
      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
  1284
      by (rule a3)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1285
    ultimately show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1286
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1287
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1288
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
  1289
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
  1290
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
  1291
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
  1292
  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
  1293
  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
  1294
*}
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
  1295
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
  1296
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
  1297
  "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
  1298
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
  1299
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1300
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1301
section {* Finitely-supported types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1302
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1303
class fs = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1304
  assumes finite_supp: "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1305
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1306
lemma pure_supp: 
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1307
  fixes x::"'a::pure"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1308
  shows "supp x = {}"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1309
  unfolding supp_def by (simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1310
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1311
lemma pure_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1312
  fixes x::"'a::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1313
  shows "a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1314
  unfolding fresh_def by (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1315
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1316
instance pure < fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1317
by default (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1318
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1319
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1320
subsection  {* Type @{typ atom} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1321
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1322
lemma supp_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1323
  shows "supp a = {a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1324
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1325
apply (clarsimp simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1326
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1327
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1328
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1329
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1330
lemma fresh_atom: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1331
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1332
  unfolding fresh_def supp_atom by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1333
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1334
instance atom :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1335
by default (simp add: supp_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1336
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
  1337
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1338
section {* Type @{typ perm} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1339
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1340
lemma perm_swap_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1341
  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
  1342
unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1343
by (metis add_diff_cancel minus_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1344
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1345
lemma supports_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1346
  shows "{a. p \<bullet> a \<noteq> a} supports p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1347
  unfolding supports_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1348
  unfolding perm_swap_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1349
  by (simp add: swap_eqvt)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1350
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1351
lemma finite_perm_lemma: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1352
  shows "finite {a::atom. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1353
  using finite_Rep_perm [of p]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1354
  unfolding permute_atom_def .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1355
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1356
lemma supp_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1357
  shows "supp p = {a. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1358
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1359
apply (rule supports_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1360
apply (rule finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1361
apply (simp add: perm_swap_eq swap_eqvt)
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1362
apply (auto simp add: perm_eq_iff swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1363
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1364
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1365
lemma fresh_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1366
  shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1367
  unfolding fresh_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1368
  by (simp add: supp_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1369
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1370
lemma supp_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1371
  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
  1372
  by (auto simp add: supp_perm swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1373
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1374
lemma fresh_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1375
  shows "a \<sharp> (0::perm)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1376
  unfolding fresh_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1377
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1378
lemma supp_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1379
  shows "supp (0::perm) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1380
  unfolding supp_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1381
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1382
lemma fresh_plus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1383
  fixes p q::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1384
  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
  1385
  shows "a \<sharp> (p + q)"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1386
  using assms
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1387
  unfolding fresh_def
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1388
  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
  1389
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1390
lemma supp_plus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1391
  fixes p q::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1392
  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
  1393
  by (auto simp add: supp_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1394
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1395
lemma fresh_minus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1396
  fixes p::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1397
  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
  1398
  unfolding fresh_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1399
  unfolding supp_perm
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1400
  apply(simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1401
  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
  1402
  done
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1403
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1404
lemma supp_minus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1405
  fixes p::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1406
  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
  1407
  unfolding supp_conv_fresh
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1408
  by (simp add: fresh_minus_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1409
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1410
lemma plus_perm_eq:
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1411
  fixes p q::"perm"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1412
  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
  1413
  shows "p + q  = q + p"
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1414
unfolding perm_eq_iff
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1415
proof
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1416
  fix a::"atom"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1417
  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
  1418
  proof -
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1419
    { 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
  1420
      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
  1421
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1422
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1423
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1424
    { 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
  1425
      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
  1426
      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
  1427
      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
  1428
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1429
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1430
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1431
    { 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
  1432
      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
  1433
      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
  1434
      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
  1435
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1436
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1437
    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
  1438
      using asm by blast
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1439
  qed
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1440
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1441
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1442
lemma supp_plus_perm_eq:
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1443
  fixes p q::perm
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1444
  assumes asm: "supp p \<inter> supp q = {}"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1445
  shows "supp (p + q) = supp p \<union> supp q"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1446
proof -
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1447
  { fix a::"atom"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1448
    assume "a \<in> supp p"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1449
    then have "a \<notin> supp q" using asm by auto
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1450
    then have "a \<in> supp (p + q)" using `a \<in> supp p` 
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1451
      by (simp add: supp_perm)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1452
  }
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1453
  moreover
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1454
  { fix a::"atom"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1455
    assume "a \<in> supp q"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1456
    then have "a \<notin> supp p" using asm by auto
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1457
    then have "a \<in> supp (q + p)" using `a \<in> supp q` 
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1458
      by (simp add: supp_perm)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1459
    then have "a \<in> supp (p + q)" using asm plus_perm_eq
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1460
      by metis
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1461
  }
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1462
  ultimately have "supp p \<union> supp q \<subseteq> supp (p + q)"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1463
    by blast
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1464
  then show "supp (p + q) = supp p \<union> supp q" using supp_plus_perm
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1465
    by blast
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1466
qed
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1467
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1468
instance perm :: fs
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1469
by default (simp add: supp_perm finite_perm_lemma)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1470
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1471
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1472
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1473
section {* Finite Support instances for other types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1474
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1475
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1476
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1477
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1478
lemma supp_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1479
  shows "supp (x, y) = supp x \<union> supp y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1480
  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
  1481
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1482
lemma fresh_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1483
  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
  1484
  by (simp add: fresh_def supp_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1485
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1486
lemma supp_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1487
  shows "supp () = {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1488
  by (simp add: supp_def)
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 fresh_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1491
  shows "a \<sharp> ()"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1492
  by (simp add: fresh_def supp_Unit)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1493
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1494
instance prod :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1495
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1496
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1497
apply (simp add: supp_Pair finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1498
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1499
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1500
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1501
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1502
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1503
lemma supp_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1504
  shows "supp (Inl x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1505
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1506
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1507
lemma supp_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1508
  shows "supp (Inr x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1509
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1510
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1511
lemma fresh_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1512
  shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1513
  by (simp add: fresh_def supp_Inl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1514
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1515
lemma fresh_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1516
  shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1517
  by (simp add: fresh_def supp_Inr)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1518
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1519
instance sum :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1520
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1521
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1522
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
  1523
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1524
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1525
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1526
subsection {* Type @{typ "'a option"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1527
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1528
lemma supp_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1529
  shows "supp None = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1530
by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1531
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1532
lemma supp_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1533
  shows "supp (Some x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1534
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1535
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1536
lemma fresh_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1537
  shows "a \<sharp> None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1538
  by (simp add: fresh_def supp_None)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1539
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1540
lemma fresh_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1541
  shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1542
  by (simp add: fresh_def supp_Some)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1543
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1544
instance option :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1545
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1546
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1547
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
  1548
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1549
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1550
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1551
subsubsection {* Type @{typ "'a list"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1552
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1553
lemma supp_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1554
  shows "supp [] = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1555
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1556
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1557
lemma supp_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1558
  shows "supp (x # xs) = supp x \<union> supp xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1559
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
  1560
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1561
lemma supp_append:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1562
  shows "supp (xs @ ys) = supp xs \<union> supp ys"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1563
  by (induct xs) (auto simp add: supp_Nil supp_Cons)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1564
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1565
lemma fresh_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1566
  shows "a \<sharp> []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1567
  by (simp add: fresh_def supp_Nil)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1568
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1569
lemma fresh_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1570
  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
  1571
  by (simp add: fresh_def supp_Cons)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1572
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1573
lemma fresh_append:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1574
  shows "a \<sharp> (xs @ ys) \<longleftrightarrow> a \<sharp> xs \<and> a \<sharp> ys"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1575
  by (induct xs) (simp_all add: fresh_Nil fresh_Cons)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1576
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1577
lemma supp_rev:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1578
  shows "supp (rev xs) = supp xs"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1579
  by (induct xs) (auto simp add: supp_append supp_Cons supp_Nil)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1580
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1581
lemma fresh_rev:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1582
  shows "a \<sharp> rev xs \<longleftrightarrow> a \<sharp> xs"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1583
  by (induct xs) (auto simp add: fresh_append fresh_Cons fresh_Nil)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1584
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1585
lemma supp_removeAll:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1586
  fixes x::"atom"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1587
  shows "supp (removeAll x xs) = supp xs - {x}"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1588
  by (induct xs)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1589
     (auto simp add: supp_Nil supp_Cons supp_atom)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1590
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1591
lemma supp_of_atom_list:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1592
  fixes as::"atom list"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1593
  shows "supp as = set as"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1594
by (induct as)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1595
   (simp_all add: supp_Nil supp_Cons supp_atom)
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1596
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1597
instance list :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1598
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1599
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1600
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
  1601
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1602
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1603
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1604
section {* Support and Freshness for Applications *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1605
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1606
lemma fresh_conv_MOST: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1607
  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
  1608
  unfolding fresh_def supp_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1609
  unfolding MOST_iff_cofinite by simp
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1610
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1611
lemma fresh_fun_app:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1612
  assumes "a \<sharp> f" and "a \<sharp> x" 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1613
  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
  1614
  using assms
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1615
  unfolding fresh_conv_MOST
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1616
  unfolding permute_fun_app_eq
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1617
  by (elim MOST_rev_mp, simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1618
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1619
lemma supp_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1620
  shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1621
  using fresh_fun_app
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1622
  unfolding fresh_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1623
  by auto
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1624
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1625
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1626
subsection {* Equivariance Predicate @{text eqvt} and @{text eqvt_at}*}
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1627
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1628
definition
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1629
  "eqvt f \<equiv> \<forall>p. p \<bullet> f = f"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1630
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1631
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1632
text {* equivariance of a function at a given argument *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1633
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1634
definition
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1635
 "eqvt_at f x \<equiv> \<forall>p. p \<bullet> (f x) = f (p \<bullet> x)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1636
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1637
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1638
lemma eqvtI:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1639
  shows "(\<And>p. p \<bullet> f \<equiv> f) \<Longrightarrow> eqvt f"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1640
unfolding eqvt_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1641
by simp
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1642
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1643
lemma supp_fun_eqvt:
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1644
  assumes a: "eqvt f"
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1645
  shows "supp f = {}"
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1646
  using a
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1647
  unfolding eqvt_def
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1648
  unfolding supp_def 
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1649
  by simp
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1650
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1651
lemma fresh_fun_eqvt_app:
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1652
  assumes a: "eqvt f"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1653
  shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1654
proof -
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1655
  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
  1656
  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
  1657
    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
  1658
    using supp_fun_app by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1659
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1660
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1661
lemma supp_fun_app_eqvt:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1662
  assumes a: "eqvt f"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1663
  shows "supp (f x) \<subseteq> supp x"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1664
  using fresh_fun_eqvt_app[OF a]
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1665
  unfolding fresh_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1666
  by auto
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1667
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1668
lemma supp_eqvt_at:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1669
  assumes asm: "eqvt_at f x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1670
  and     fin: "finite (supp x)"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1671
  shows "supp (f x) \<subseteq> supp x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1672
apply(rule supp_is_subset)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1673
unfolding supports_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1674
unfolding fresh_def[symmetric]
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1675
using asm
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1676
apply(simp add: eqvt_at_def)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1677
apply(simp add: swap_fresh_fresh)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1678
apply(rule fin)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1679
done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1680
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1681
lemma finite_supp_eqvt_at:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1682
  assumes asm: "eqvt_at f x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1683
  and     fin: "finite (supp x)"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1684
  shows "finite (supp (f x))"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1685
apply(rule finite_subset)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1686
apply(rule supp_eqvt_at[OF asm fin])
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1687
apply(rule fin)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1688
done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1689
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1690
lemma fresh_eqvt_at:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1691
  assumes asm: "eqvt_at f x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1692
  and     fin: "finite (supp x)"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1693
  and     fresh: "a \<sharp> x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1694
  shows "a \<sharp> f x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1695
using fresh
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1696
unfolding fresh_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1697
using supp_eqvt_at[OF asm fin]
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1698
by auto
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1699
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1700
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1701
subsection {* helper functions for nominal_functions *}
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1702
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1703
lemma the_default_eqvt:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1704
  assumes unique: "\<exists>!x. P x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1705
  shows "(p \<bullet> (THE_default d P)) = (THE_default d (p \<bullet> P))"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1706
  apply(rule THE_default1_equality [symmetric])
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1707
  apply(rule_tac p="-p" in permute_boolE)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1708
  apply(simp add: ex1_eqvt)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1709
  apply(rule unique)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1710
  apply(rule_tac p="-p" in permute_boolE)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1711
  apply(rule subst[OF permute_fun_app_eq])
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1712
  apply(simp)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1713
  apply(rule THE_defaultI'[OF unique])
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1714
  done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1715
2708
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1716
lemma fundef_ex1_eqvt2:
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1717
  fixes x::"'a::pt"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1718
  assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1719
  assumes eqvt: "eqvt_at G x"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1720
  assumes ex1: "\<exists>!y. G x y"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1721
  shows "(p \<bullet> (f x)) = f (p \<bullet> x)"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1722
  apply(simp only: f_def)
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1723
  apply(subst the_default_eqvt)
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1724
  apply(rule ex1)
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1725
  using eqvt
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1726
  unfolding eqvt_at_def
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1727
  apply(simp)
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1728
  done
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1729
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1730
lemma fundef_ex1_eqvt:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1731
  fixes x::"'a::pt"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1732
  assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1733
  assumes eqvt: "eqvt G"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1734
  assumes ex1: "\<exists>!y. G x y"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1735
  shows "(p \<bullet> (f x)) = f (p \<bullet> x)"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1736
  apply(simp only: f_def)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1737
  apply(subst the_default_eqvt)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1738
  apply(rule ex1)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1739
  using eqvt
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1740
  unfolding eqvt_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1741
  apply(simp add: permute_fun_app_eq)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1742
  done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1743
2708
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1744
lemma fundef_ex1_eqvt_at2:
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1745
  fixes x::"'a::pt"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1746
  assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1747
  assumes eqvt: "eqvt_at G x"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1748
  assumes ex1: "\<exists>!y. G x y"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1749
  shows "eqvt_at f x"
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1750
  unfolding eqvt_at_def
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1751
  using assms
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1752
  by (auto intro: fundef_ex1_eqvt2)
5964c84ece5d the proofs with eqvt_at
Christian Urban <urbanc@in.tum.de>
parents: 2685
diff changeset
  1753
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1754
lemma fundef_ex1_eqvt_at:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1755
  fixes x::"'a::pt"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1756
  assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1757
  assumes eqvt: "eqvt G"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1758
  assumes ex1: "\<exists>!y. G x y"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1759
  shows "eqvt_at f x"
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1760
  unfolding eqvt_at_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1761
  using assms
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1762
  by (auto intro: fundef_ex1_eqvt)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1763
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1764
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1765
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
  1766
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1767
text {* support and freshness for atom sets *}
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1768
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1769
lemma supp_finite_atom_set:
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1770
  fixes S::"atom set"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1771
  assumes "finite S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1772
  shows "supp S = S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1773
  apply(rule finite_supp_unique)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1774
  apply(simp add: supports_def)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1775
  apply(simp add: swap_set_not_in)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1776
  apply(rule assms)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1777
  apply(simp add: swap_set_in)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1778
done
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1779
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1780
lemma supp_cofinite_atom_set:
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1781
  fixes S::"atom set"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1782
  assumes "finite (UNIV - S)"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1783
  shows "supp S = (UNIV - S)"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1784
  apply(rule finite_supp_unique)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1785
  apply(simp add: supports_def)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1786
  apply(simp add: swap_set_both_in)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1787
  apply(rule assms)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1788
  apply(subst swap_commute)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1789
  apply(simp add: swap_set_in)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1790
done
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1791
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1792
lemma fresh_finite_atom_set:
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1793
  fixes S::"atom set"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1794
  assumes "finite S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1795
  shows "a \<sharp> S \<longleftrightarrow> a \<notin> S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1796
  unfolding fresh_def
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1797
  by (simp add: supp_finite_atom_set[OF assms])
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1798
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1799
lemma fresh_minus_atom_set:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1800
  fixes S::"atom set"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1801
  assumes "finite S"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1802
  shows "a \<sharp> S - T \<longleftrightarrow> (a \<notin> T \<longrightarrow> a \<sharp> S)"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1803
  unfolding fresh_def
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1804
  by (auto simp add: supp_finite_atom_set assms)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1805
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1806
lemma Union_supports_set:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1807
  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
  1808
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1809
  { fix a b
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1810
    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
  1811
      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
  1812
  }
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1813
  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
  1814
    unfolding supports_def 
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1815
    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
  1816
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1817
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1818
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
  1819
  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
  1820
  assumes fin: "finite S"   
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1821
  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
  1822
  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
  1823
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1824
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
  1825
  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
  1826
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1827
  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
  1828
proof -
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1829
  have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)" 
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1830
    unfolding eqvt_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1831
    by (perm_simp) (simp)
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1832
  have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1833
    by (rule supp_finite_atom_set[symmetric]) (rule Union_of_finite_supp_sets[OF fin])
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1834
  also have "\<dots> = supp ((\<lambda>S. \<Union> supp ` S) S)" by simp
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1835
  also have "\<dots> \<subseteq> supp S" using eqvt
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1836
    by (rule supp_fun_app_eqvt)
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1837
  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
  1838
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1839
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1840
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
  1841
  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
  1842
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1843
  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
  1844
apply(rule subset_antisym)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1845
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
  1846
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
  1847
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
  1848
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
  1849
done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1850
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1851
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
  1852
  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
  1853
  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
  1854
  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
  1855
using assms
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1856
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
  1857
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1858
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
  1859
  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
  1860
  assumes fin1: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1861
  and     fin2: "finite T"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1862
  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
  1863
  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
  1864
  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
  1865
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1866
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
  1867
  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
  1868
  assumes fin:  "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1869
  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
  1870
  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
  1871
  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
  1872
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  1873
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
  1874
  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
  1875
  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
  1876
  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
  1877
  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
  1878
  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
  1879
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1880
lemma supp_set_empty:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1881
  shows "supp {} = {}"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1882
  unfolding supp_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1883
  by (simp add: empty_eqvt)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1884
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1885
lemma fresh_set_empty:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1886
  shows "a \<sharp> {}"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1887
  by (simp add: fresh_def supp_set_empty)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1888
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1889
lemma supp_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1890
  fixes xs :: "('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1891
  shows "supp (set xs) = supp xs"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1892
apply(induct xs)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1893
apply(simp add: supp_set_empty supp_Nil)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1894
apply(simp add: supp_Cons supp_of_finite_insert)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1895
done
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1896
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1897
lemma fresh_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1898
  fixes xs :: "('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1899
  shows "a \<sharp> (set xs) \<longleftrightarrow> a \<sharp> xs"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1900
unfolding fresh_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1901
by (simp add: supp_set)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1902
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1903
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1904
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
  1905
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1906
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
  1907
  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
  1908
  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
  1909
  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
  1910
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1911
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
  1912
  shows "supp {||} = {}"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1913
  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
  1914
  by simp
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1915
2641
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1916
lemma fresh_empty_fset:
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1917
  shows "a \<sharp> {||}"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1918
unfolding fresh_def
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1919
by (simp)
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1920
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1921
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
  1922
  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
  1923
  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
  1924
  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
  1925
  apply(subst supp_fset[symmetric])
2587
78623a0f294b tuned proof to reduce number of warnings
Christian Urban <urbanc@in.tum.de>
parents: 2586
diff changeset
  1926
  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
  1927
  done
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1928
2641
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1929
lemma fresh_insert_fset:
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1930
  fixes x::"'a::fs"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1931
  and   S::"'a fset"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1932
  shows "a \<sharp> insert_fset x S \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> S"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1933
  unfolding fresh_def
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1934
  by (simp)
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  1935
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1936
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
  1937
  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
  1938
  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
  1939
  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
  1940
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1941
lemma supp_union_fset:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1942
  fixes S T::"'a::fs fset"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1943
  shows "supp (S |\<union>| T) = supp S \<union> supp T"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1944
by (induct S) (auto)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1945
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1946
lemma fresh_union_fset:
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1947
  fixes S T::"'a::fs fset"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1948
  shows "a \<sharp> S |\<union>| T \<longleftrightarrow> a \<sharp> S \<and> a \<sharp> T"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1949
unfolding fresh_def
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1950
by (simp add: supp_union_fset)
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1951
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1952
instance fset :: (fs) fs
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1953
  apply (default)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1954
  apply (rule fset_finite_supp)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1955
  done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1956
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1957
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1958
section {* Freshness and Fresh-Star *}
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1959
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1960
lemma fresh_Unit_elim: 
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1961
  shows "(a \<sharp> () \<Longrightarrow> PROP C) \<equiv> PROP C"
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1962
  by (simp add: fresh_Unit)
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1963
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1964
lemma fresh_Pair_elim: 
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1965
  shows "(a \<sharp> (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> a \<sharp> y \<Longrightarrow> PROP C)"
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1966
  by rule (simp_all add: fresh_Pair)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1967
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1968
(* this rule needs to be added before the fresh_prodD is *)
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1969
(* added to the simplifier with mksimps                  *) 
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1970
lemma [simp]:
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1971
  shows "a \<sharp> x1 \<Longrightarrow> a \<sharp> x2 \<Longrightarrow> a \<sharp> (x1, x2)"
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1972
  by (simp add: fresh_Pair)
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1973
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1974
lemma fresh_PairD:
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1975
  shows "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> x"
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1976
  and   "a \<sharp> (x, y) \<Longrightarrow> a \<sharp> y"
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1977
  by (simp_all add: fresh_Pair)
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1978
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1979
ML {*
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1980
  val mksimps_pairs = (@{const_name Nominal2_Base.fresh}, @{thms fresh_PairD}) :: mksimps_pairs;
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1981
*}
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1982
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1983
declaration {* fn _ =>
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1984
  Simplifier.map_ss (fn ss => ss setmksimps (mksimps mksimps_pairs))
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  1985
*}
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1986
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1987
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
  1988
  induction principles. *}
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
definition 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1991
  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
  1992
where 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1993
  "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
  1994
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1995
lemma fresh_star_supp_conv:
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1996
  shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1997
by (auto simp add: fresh_star_def fresh_def)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  1998
2675
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  1999
lemma fresh_star_perm_set_conv:
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2000
  fixes p::"perm"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2001
  assumes fresh: "as \<sharp>* p"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2002
  and     fin: "finite as"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2003
  shows "supp p \<sharp>* as"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2004
apply(rule fresh_star_supp_conv)
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2005
apply(simp add: supp_finite_atom_set fin fresh)
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2006
done
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2007
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2008
lemma fresh_star_atom_set_conv:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2009
  assumes fresh: "as \<sharp>* bs"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2010
  and     fin: "finite as" "finite bs"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2011
  shows "bs \<sharp>* as"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2012
using fresh
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2013
unfolding fresh_star_def fresh_def
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2014
by (auto simp add: supp_finite_atom_set fin)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2015
2730
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2016
lemma atom_fresh_star_disjoint:
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2017
  assumes fin: "finite bs" 
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2018
  shows "as \<sharp>* bs \<longleftrightarrow> (as \<inter> bs = {})"
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2019
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2020
unfolding fresh_star_def fresh_def
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2021
by (auto simp add: supp_finite_atom_set fin)
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2022
2675
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2023
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2024
lemma fresh_star_Pair:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2025
  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
  2026
  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
  2027
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2028
lemma fresh_star_list:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2029
  shows "as \<sharp>* (xs @ ys) \<longleftrightarrow> as \<sharp>* xs \<and> as \<sharp>* ys"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2030
  and   "as \<sharp>* (x # xs) \<longleftrightarrow> as \<sharp>* x \<and> as \<sharp>* xs"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2031
  and   "as \<sharp>* []"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2032
by (auto simp add: fresh_star_def fresh_Nil fresh_Cons fresh_append)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2033
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2034
lemma fresh_star_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2035
  fixes xs::"('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2036
  shows "as \<sharp>* set xs \<longleftrightarrow> as \<sharp>* xs"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2037
unfolding fresh_star_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2038
by (simp add: fresh_set)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2039
2611
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2040
lemma fresh_star_singleton:
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2041
  fixes a::"atom"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2042
  shows "as \<sharp>* {a} \<longleftrightarrow> as \<sharp>* a"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2043
  by (simp add: fresh_star_def fresh_finite_insert fresh_set_empty)
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2044
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2045
lemma fresh_star_fset:
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2046
  fixes xs::"('a::fs) list"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2047
  shows "as \<sharp>* fset S \<longleftrightarrow> as \<sharp>* S"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2048
by (simp add: fresh_star_def fresh_def) 
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2049
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2050
lemma fresh_star_Un:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2051
  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
  2052
  by (auto simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2053
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2054
lemma fresh_star_insert:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2055
  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
  2056
  by (auto simp add: fresh_star_def)
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
lemma fresh_star_Un_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2059
  "((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
  2060
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2061
  apply(rule)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2062
  apply(erule meta_mp)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2063
  apply(auto)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2064
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2065
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2066
lemma fresh_star_insert_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2067
  "(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
  2068
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2069
  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
  2070
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2071
lemma fresh_star_empty_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2072
  "({} \<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
  2073
  by (simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2074
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2075
lemma fresh_star_Unit_elim: 
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2076
  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
  2077
  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
  2078
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2079
lemma fresh_star_Pair_elim: 
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2080
  shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2081
  by (rule, simp_all add: fresh_star_Pair)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2082
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2083
lemma fresh_star_zero:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2084
  shows "as \<sharp>* (0::perm)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2085
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2086
  by (simp add: fresh_zero_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2087
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2088
lemma fresh_star_plus:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2089
  fixes p q::perm
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2090
  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
  2091
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2092
  by (simp add: fresh_plus_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2093
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2094
lemma fresh_star_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2095
  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
  2096
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2097
  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
  2098
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2099
lemma fresh_star_eqvt [eqvt]:
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  2100
  shows "p \<bullet> (as \<sharp>* x) \<longleftrightarrow> (p \<bullet> as) \<sharp>* (p \<bullet> x)"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2101
unfolding fresh_star_def
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2102
by (perm_simp) (rule refl)
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2103
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2104
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2105
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2106
section {* Induction principle for permutations *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2107
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2108
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2109
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
  2110
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2111
  and zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2112
  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
  2113
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2114
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2115
  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
  2116
  then show "P p" using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2117
  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
  2118
    case (psubset p)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2119
    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
  2120
    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
  2121
    { assume "supp p = {}"
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  2122
      then have "p = 0" by (simp add: supp_perm perm_eq_iff)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2123
      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
  2124
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2125
    moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2126
    { assume "supp p \<noteq> {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2127
      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
  2128
      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
  2129
        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
  2130
      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
  2131
      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
  2132
      moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2133
      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
  2134
      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
  2135
      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
  2136
      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
  2137
      moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2138
      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
  2139
      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
  2140
      moreover 
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  2141
      have "p = (p \<bullet> a \<rightleftharpoons> a) + ?q" by (simp add: perm_eq_iff)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2142
      ultimately have "P p" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2143
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2144
    ultimately show "P p" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2145
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2146
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2147
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2148
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
  2149
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2150
  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
  2151
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2152
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
  2153
   (auto intro: zero swap)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2154
2669
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2155
lemma perm_struct_induct2[consumes 1, case_names zero swap plus]:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2156
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2157
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2158
  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
  2159
  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
  2160
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2161
using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2162
by (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2163
   (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
  2164
2669
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2165
lemma perm_simple_struct_induct2[case_names zero swap plus]:
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2166
  assumes zero: "P 0"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2167
  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2168
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2169
  shows "P p"
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2170
by (rule_tac S="supp p" in perm_struct_induct2)
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2171
   (auto intro: zero swap plus)
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2172
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2173
lemma supp_perm_singleton:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2174
  fixes p::"perm"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2175
  shows "supp p \<subseteq> {b} \<longleftrightarrow> p = 0"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2176
proof -
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2177
  { assume "supp p \<subseteq> {b}"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2178
    then have "p = 0"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2179
      by (induct p rule: perm_struct_induct) (simp_all)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2180
  }
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2181
  then show "supp p \<subseteq> {b} \<longleftrightarrow> p = 0" by (auto simp add: supp_zero_perm)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2182
qed
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2183
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2184
lemma supp_perm_pair:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2185
  fixes p::"perm"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2186
  shows "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2187
proof -
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2188
  { assume "supp p \<subseteq> {a, b}"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2189
    then have "p = 0 \<or> p = (b \<rightleftharpoons> a)"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2190
      apply (induct p rule: perm_struct_induct) 
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2191
      apply (auto simp add: swap_cancel supp_zero_perm supp_swap)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2192
      apply (simp add: swap_commute)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2193
      done
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2194
  }
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2195
  then show "supp p \<subseteq> {a, b} \<longleftrightarrow> p = 0 \<or> p = (b \<rightleftharpoons> a)" 
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2196
    by (auto simp add: supp_zero_perm supp_swap split: if_splits)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2197
qed
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2198
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2199
lemma supp_perm_eq:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2200
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2201
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2202
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2203
  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
  2204
    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
  2205
  then show "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2206
  proof (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2207
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2208
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2209
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2210
    case (swap p a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2211
    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
  2212
    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
  2213
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2214
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2215
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2216
lemma supp_perm_eq_test:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2217
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2218
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2219
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2220
  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
  2221
    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
  2222
  then show "p \<bullet> x = x"
2669
1d1772a89026 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
parents: 2668
diff changeset
  2223
  proof (induct p rule: perm_struct_induct2)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2224
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2225
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2226
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2227
    case (swap a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2228
    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
  2229
    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
  2230
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2231
    case (plus p1 p2)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2232
    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
  2233
    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
  2234
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2235
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2236
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2237
lemma perm_supp_eq:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2238
  assumes a: "(supp p) \<sharp>* x"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2239
  shows "p \<bullet> x = x"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2240
by (rule supp_perm_eq)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2241
   (simp add: fresh_star_supp_conv a)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2242
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2243
lemma supp_perm_perm_eq:
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2244
  assumes a: "\<forall>a \<in> supp x. p \<bullet> a = q \<bullet> a"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2245
  shows "p \<bullet> x = q \<bullet> x"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2246
proof -
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2247
  from a have "\<forall>a \<in> supp x. (-q + p) \<bullet> a = a" by simp
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2248
  then have "\<forall>a \<in> supp x. a \<notin> supp (-q + p)" 
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2249
    unfolding supp_perm by simp
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2250
  then have "supp x \<sharp>* (-q + p)"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2251
    unfolding fresh_star_def fresh_def by simp
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2252
  then have "(-q + p) \<bullet> x = x" by (simp only: supp_perm_eq)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2253
  then show "p \<bullet> x = q \<bullet> x"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2254
    by (metis permute_minus_cancel permute_plus)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2255
qed
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2256
    
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2257
lemma atom_set_perm_eq:
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2258
  assumes a: "as \<sharp>* p"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2259
  shows "p \<bullet> as = as"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2260
proof -
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2261
  from a have "supp p \<subseteq> {a. a \<notin> as}"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2262
    unfolding supp_perm fresh_star_def fresh_def by auto
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2263
  then show "p \<bullet> as = as"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2264
  proof (induct p rule: perm_struct_induct)
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2265
    case zero
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2266
    show "0 \<bullet> as = as" by simp
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2267
  next
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2268
    case (swap p a b)
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2269
    then have "a \<notin> as" "b \<notin> as" "p \<bullet> as = as" by simp_all
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2270
    then show "((a \<rightleftharpoons> b) + p) \<bullet> as = as" by (simp add: swap_set_not_in)
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2271
  qed
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2272
qed
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2273
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2274
section {* Avoiding of atom sets *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2275
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2276
text {* 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2277
  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
  2278
  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
  2279
  which 'translates' between both sets.
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2280
*}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2281
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2282
lemma at_set_avoiding_aux:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2283
  fixes Xs::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2284
  and   As::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2285
  assumes b: "Xs \<subseteq> As"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2286
  and     c: "finite As"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2287
  shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) = (Xs \<union> (p \<bullet> Xs))"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2288
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2289
  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
  2290
  then show ?thesis using b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2291
  proof (induct rule: finite_subset_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2292
    case empty
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2293
    have "0 \<bullet> {} \<inter> As = {}" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2294
    moreover
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2295
    have "supp (0::perm) = {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2296
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2297
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2298
    case (insert x Xs)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2299
    then obtain p where
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2300
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2301
      p2: "supp p = (Xs \<union> (p \<bullet> Xs))" by blast
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2302
    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
  2303
    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
  2304
    hence px: "p \<bullet> x = x" unfolding supp_perm by simp
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2305
    have "finite (As \<union> p \<bullet> Xs \<union> supp p)"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2306
      using `finite As` `finite Xs`
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2307
      by (simp add: permute_set_eq_image finite_supp)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2308
    then obtain y where "y \<notin> (As \<union> p \<bullet> Xs \<union> supp p)" "sort_of y = sort_of x"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2309
      by (rule obtain_atom)
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2310
    hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "y \<notin> supp p" "sort_of y = sort_of x"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2311
      by simp_all
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2312
    hence py: "p \<bullet> y = y" "x \<noteq> y" using `x \<in> As`
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2313
      by (auto simp add: supp_perm)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2314
    let ?q = "(x \<rightleftharpoons> y) + p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2315
    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
  2316
      unfolding insert_eqvt
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2317
      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
  2318
      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
  2319
      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
  2320
    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
  2321
      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
  2322
      unfolding q by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2323
    moreover
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2324
    have "supp (x \<rightleftharpoons> y) \<inter> supp p = {}" using px py `sort_of y = sort_of x`
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2325
      unfolding supp_swap by (simp add: supp_perm)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2326
    then have "supp ?q = (supp (x \<rightleftharpoons> y) \<union> supp p)" 
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2327
      by (simp add: supp_plus_perm_eq)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2328
    then have "supp ?q = insert x Xs \<union> ?q \<bullet> insert x Xs"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2329
      using p2 `sort_of y = sort_of x` `x \<noteq> y` unfolding q supp_swap
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2330
      by auto
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2331
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2332
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2333
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2334
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2335
lemma at_set_avoiding:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2336
  assumes a: "finite Xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2337
  and     b: "finite (supp c)"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2338
  obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) = (Xs \<union> (p \<bullet> Xs))"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2339
  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
  2340
  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
  2341
2589
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2342
lemma at_set_avoiding1:
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2343
  assumes "finite xs"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2344
  and     "finite (supp c)"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2345
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2346
using assms
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2347
apply(erule_tac c="c" in at_set_avoiding)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2348
apply(auto)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2349
done
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2350
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2351
lemma at_set_avoiding2:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2352
  assumes "finite xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2353
  and     "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2354
  and     "xs \<sharp>* x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2355
  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
  2356
using assms
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2357
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
  2358
apply(simp add: supp_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2359
apply(rule_tac x="p" in exI)
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2360
apply(simp add: fresh_star_Pair)
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2361
apply(rule fresh_star_supp_conv)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2362
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
  2363
done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2364
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2365
lemma at_set_avoiding3:
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2366
  assumes "finite xs"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2367
  and     "finite (supp c)" "finite (supp x)"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2368
  and     "xs \<sharp>* x"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2369
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p \<and> supp p = xs \<union> (p \<bullet> xs)"
2586
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2370
using assms
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2371
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
  2372
apply(simp add: supp_Pair)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2373
apply(rule_tac x="p" in exI)
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2374
apply(simp add: fresh_star_Pair)
2586
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2375
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
  2376
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
  2377
done
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2378
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2379
lemma at_set_avoiding2_atom:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2380
  assumes "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2381
  and     b: "a \<sharp> x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2382
  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
  2383
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2384
  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
  2385
  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
  2386
    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
  2387
  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
  2388
    unfolding fresh_star_def Ball_def 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2389
    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
  2390
  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
  2391
  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
  2392
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2393
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2394
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2395
section {* Renaming permutations *}
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2396
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2397
lemma set_renaming_perm:
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2398
  assumes b: "finite bs"
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2399
  shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2400
using b
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2401
proof (induct)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2402
  case empty
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2403
  have "(\<forall>b \<in> {}. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> {} \<union> p \<bullet> {}"
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2404
    by (simp add: permute_set_eq supp_perm)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2405
  then show "\<exists>q. (\<forall>b \<in> {}. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> {} \<union> p \<bullet> {}" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2406
next
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2407
  case (insert a bs)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2408
  then have " \<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> p \<bullet> bs" by simp 
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2409
  then obtain q where *: "\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> bs \<union> p \<bullet> bs"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2410
    by (metis empty_subsetI insert(3) supp_swap) 
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2411
  { assume 1: "q \<bullet> a = p \<bullet> a"
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2412
    have "\<forall>b \<in> (insert a bs). q \<bullet> b = p \<bullet> b" using 1 * by simp
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2413
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2414
    have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2415
      using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2416
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2417
    have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2418
  }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2419
  moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2420
  { assume 2: "q \<bullet> a \<noteq> p \<bullet> a"
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2421
    def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2422
    have "\<forall>b \<in> insert a bs. q' \<bullet> b = p \<bullet> b" using 2 * `a \<notin> bs` unfolding q'_def
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2423
      by (auto simp add: swap_atom)
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2424
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2425
    { have "{q \<bullet> a, p \<bullet> a} \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2426
	using ** 
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2427
	apply (auto simp add: supp_perm insert_eqvt)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2428
	apply (subgoal_tac "q \<bullet> a \<in> bs \<union> p \<bullet> bs")
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2429
	apply(auto)[1]
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2430
	apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2431
	apply(blast)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2432
	apply(simp)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2433
	done
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2434
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by (simp add: supp_swap)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2435
      moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2436
      have "supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2437
	using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2438
      ultimately 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2439
      have "supp q' \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2440
        unfolding q'_def using supp_plus_perm by blast
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2441
    }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2442
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2443
    have "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2444
  }
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2445
  ultimately show "\<exists>q. (\<forall>b \<in> insert a bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> insert a bs \<union> p \<bullet> insert a bs"
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2446
    by blast
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2447
qed
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2448
2672
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2449
lemma set_renaming_perm2:
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2450
  shows "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)"
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2451
proof -
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2452
  have "finite (bs \<inter> supp p)" by (simp add: finite_supp)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2453
  then obtain q 
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2454
    where *: "\<forall>b \<in> bs \<inter> supp p. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> (bs \<inter> supp p) \<union> (p \<bullet> (bs \<inter> supp p))"
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2455
    using set_renaming_perm by blast
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2456
  from ** have "supp q \<subseteq> bs \<union> (p \<bullet> bs)" by (auto simp add: inter_eqvt)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2457
  moreover
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2458
  have "\<forall>b \<in> bs - supp p. q \<bullet> b = p \<bullet> b" 
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2459
    apply(auto)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2460
    apply(subgoal_tac "b \<notin> supp q")
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2461
    apply(simp add: fresh_def[symmetric])
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2462
    apply(simp add: fresh_perm)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2463
    apply(clarify)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2464
    apply(rotate_tac 2)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2465
    apply(drule subsetD[OF **])
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2466
    apply(simp add: inter_eqvt supp_eqvt permute_self)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2467
    done
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2468
  ultimately have "(\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" using * by auto
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2469
  then show "\<exists>q. (\<forall>b \<in> bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> bs \<union> (p \<bullet> bs)" by blast
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2470
qed
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2471
    
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2472
lemma list_renaming_perm:
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2473
  shows "\<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> (p \<bullet> set bs)"
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2474
proof (induct bs)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2475
  case (Cons a bs)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2476
  then have " \<exists>q. (\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set bs \<union> p \<bullet> (set bs)"  by simp
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2477
  then obtain q where *: "\<forall>b \<in> set bs. q \<bullet> b = p \<bullet> b" and **: "supp q \<subseteq> set bs \<union> p \<bullet> (set bs)"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2478
    by (blast)
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2479
  { assume 1: "a \<in> set bs"
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2480
    have "q \<bullet> a = p \<bullet> a" using * 1 by (induct bs) (auto)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2481
    then have "\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b" using * by simp 
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2482
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2483
    have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2484
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2485
    have "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2486
  }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2487
  moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2488
  { assume 2: "a \<notin> set bs"
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2489
    def q' \<equiv> "((q \<bullet> a) \<rightleftharpoons> (p \<bullet> a)) + q"
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2490
    have "\<forall>b \<in> set (a # bs). q' \<bullet> b = p \<bullet> b" 
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2491
      unfolding q'_def using 2 * `a \<notin> set bs` by (auto simp add: swap_atom)
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2492
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2493
    { have "{q \<bullet> a, p \<bullet> a} \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2494
	using **
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2495
	apply (auto simp add: supp_perm insert_eqvt)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2496
	apply (subgoal_tac "q \<bullet> a \<in> set bs \<union> p \<bullet> set bs")
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2497
	apply(auto)[1]
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2498
	apply(subgoal_tac "q \<bullet> a \<in> {a. q \<bullet> a \<noteq> a}")
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2499
	apply(blast)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2500
	apply(simp)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2501
	done
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2502
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> set (a # bs) \<union> p \<bullet> set (a # bs)" by (simp add: supp_swap)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2503
      moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2504
      have "supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2505
	using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2506
      ultimately 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2507
      have "supp q' \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2508
        unfolding q'_def using supp_plus_perm by blast
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2509
    }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2510
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2511
    have "\<exists>q. (\<forall>b \<in> set (a # bs).  q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2512
  }
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2513
  ultimately show "\<exists>q. (\<forall>b \<in> set (a # bs). q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set (a # bs) \<union> p \<bullet> (set (a # bs))"
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2514
    by blast
2771
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2515
next
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2516
 case Nil
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2517
  have "(\<forall>b \<in> set []. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> set [] \<union> p \<bullet> set []" 
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2518
    by (simp add: supp_zero_perm)
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2519
  then show "\<exists>q. (\<forall>b \<in> set []. q \<bullet> b = p \<bullet> b) \<and> supp q \<subseteq> set [] \<union> p \<bullet> (set [])" by blast
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2520
qed
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2521
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2522
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2523
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
  2524
1972
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2525
text {*
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2526
  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
  2527
  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
  2528
*}
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2529
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
  2530
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
  2531
  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
  2532
  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
  2533
  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
  2534
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2535
declare atom_eqvt[eqvt]
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2536
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
  2537
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
  2538
  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
  2539
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
  2540
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
  2541
  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
  2542
  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
  2543
  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
  2544
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
  2545
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
  2546
  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
  2547
  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
  2548
2609
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2549
lemma fresh_atom_at_base: 
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2550
  fixes b::"'a::at_base"
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2551
  shows "a \<sharp> atom b \<longleftrightarrow> a \<sharp> b"
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2552
  by (simp add: fresh_def supp_at_base supp_atom)
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2553
2611
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2554
lemma fresh_star_atom_at_base: 
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2555
  fixes b::"'a::at_base"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2556
  shows "as \<sharp>* atom b \<longleftrightarrow> as \<sharp>* b"
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2557
  by (simp add: fresh_star_def fresh_atom_at_base)
2609
666ffc8a92a9 freshness theorem in strong exhausts; (temporarily includes a cheat_tac to make all tests go through)
Christian Urban <urbanc@in.tum.de>
parents: 2599
diff changeset
  2558
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
  2559
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
  2560
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
  2561
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
  2562
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
  2563
  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
  2564
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
  2565
  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
  2566
  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
  2567
  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
  2568
    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
  2569
  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
  2570
    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
  2571
  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
  2572
    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
  2573
    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
  2574
  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
  2575
  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
  2576
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
  2577
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
  2578
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
  2579
  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
  2580
  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
  2581
  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
  2582
  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
  2583
  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
  2584
  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
  2585
  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
  2586
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
  2587
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
  2588
  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
  2589
  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
  2590
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
  2591
  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
  2592
    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
  2593
  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
  2594
    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
  2595
  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
  2596
    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
  2597
  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
  2598
    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
  2599
  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
  2600
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
  2601
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2602
lemma obtain_fresh':
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2603
  assumes fin: "finite (supp x)"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2604
  obtains a::"'a::at_base" where "atom a \<sharp> x"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2605
using obtain_at_base[where X="supp x"]
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2606
by (auto simp add: fresh_def fin)
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2607
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2608
lemma obtain_fresh:
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2609
  fixes x::"'b::fs"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2610
  obtains a::"'a::at_base" where "atom a \<sharp> x"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2611
  by (rule obtain_fresh') (auto simp add: finite_supp)
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2612
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1972
diff changeset
  2613
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
  2614
  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
  2615
  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
  2616
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
  2617
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
  2618
apply(auto)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2619
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
  2620
2743
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2621
(* FIXME 
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2622
lemma supp_cofinite_set_at_base:
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2623
  assumes a: "finite (UNIV - S)"
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2624
  shows "supp S = atom ` (UNIV - S)"
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2625
apply(rule finite_supp_unique)
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2626
*)
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  2627
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2628
lemma fresh_finite_set_at_base:
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2629
  fixes a::"'a::at_base"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2630
  assumes a: "finite S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2631
  shows "atom a \<sharp> S \<longleftrightarrow> a \<notin> S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2632
  unfolding fresh_def
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2633
  apply(simp add: supp_finite_set_at_base[OF a])
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2634
  apply(subst inj_image_mem_iff)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2635
  apply(simp add: inj_on_def)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2636
  apply(simp)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2637
  done
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2638
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2639
lemma fresh_at_base_permute_iff[simp]:
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2640
  fixes a::"'a::at_base"
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2641
  shows "atom (p \<bullet> a) \<sharp> p \<bullet> x \<longleftrightarrow> atom a \<sharp> x"
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2642
  unfolding atom_eqvt[symmetric]
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2643
  by (simp add: fresh_permute_iff)
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2644
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  2645
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2646
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
  2647
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2648
definition
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2649
  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
  2650
where
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2651
  "(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
  2652
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2653
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2654
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
  2655
  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
  2656
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2657
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
  2658
  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
  2659
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2660
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
  2661
  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
  2662
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2663
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
  2664
  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
  2665
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2666
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
  2667
  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
  2668
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2669
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
  2670
  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
  2671
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2672
lemma flip_eqvt [eqvt]: 
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2673
  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
  2674
  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
  2675
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2676
  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
  2677
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2678
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
  2679
  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
  2680
  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
  2681
  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
  2682
  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
  2683
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2684
  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
  2685
  unfolding atom_eqvt [symmetric]
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2686
  by simp_all
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2687
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2688
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
  2689
  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
  2690
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2691
lemma permute_flip_at:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2692
  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
  2693
  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
  2694
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2695
  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
  2696
  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
  2697
  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
  2698
  done
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2699
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2700
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
  2701
  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
  2702
  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
  2703
  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
  2704
  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
  2705
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2706
lemma flip_fresh_fresh:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2707
  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
  2708
  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
  2709
  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
  2710
using assms
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2711
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
  2712
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2713
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2714
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2715
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
  2716
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2717
syntax
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2718
  "_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
  2719
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2720
translations
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2721
  "_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
  2722
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2723
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2724
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
  2725
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2726
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
  2727
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
  2728
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2729
text {*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2730
  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
  2731
*}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2732
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2733
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
  2734
  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
  2735
  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
  2736
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2737
lemma exists_eq_sort: 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2738
  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
  2739
  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
  2740
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2741
lemma at_base_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2742
  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
  2743
  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
  2744
  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
  2745
  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
  2746
  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
  2747
  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
  2748
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2749
  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
  2750
  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
  2751
  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
  2752
  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
  2753
    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
  2754
  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
  2755
    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
  2756
  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
  2757
    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
  2758
  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
  2759
    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
  2760
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2761
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2762
(*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2763
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2764
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2765
  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
  2766
  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
  2767
  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
  2768
  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
  2769
  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
  2770
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2771
  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
  2772
  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
  2773
  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
  2774
  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
  2775
    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
  2776
  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
  2777
    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
  2778
  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
  2779
    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
  2780
  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
  2781
    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
  2782
  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
  2783
    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
  2784
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2785
*)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2786
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2787
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2788
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2789
  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
  2790
  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
  2791
  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
  2792
  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
  2793
  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
  2794
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2795
  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
  2796
  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
  2797
  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
  2798
  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
  2799
    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
  2800
  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
  2801
    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
  2802
  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
  2803
    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
  2804
  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
  2805
    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
  2806
  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
  2807
    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
  2808
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2809
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2810
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
  2811
  (@{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
  2812
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
  2813
  (@{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
  2814
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2815
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2816
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2817
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
  2818
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2819
lemma freshness_lemma:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2820
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2821
  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
  2822
  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
  2823
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2824
  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
  2825
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2826
  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
  2827
  proof (intro exI allI impI)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2828
    fix a :: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2829
    assume a3: "atom a \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2830
    show "h a = h b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2831
    proof (cases "a = b")
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2832
      assume "a = b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2833
      thus "h a = h b" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2834
    next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2835
      assume "a \<noteq> b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2836
      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
  2837
      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
  2838
        by (rule fresh_fun_app)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2839
      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
  2840
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2841
      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
  2842
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2843
      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
  2844
      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
  2845
        by (rule permute_fun_app_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2846
      also have "\<dots> = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2847
        using d2 by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2848
      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
  2849
    qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2850
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2851
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2852
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2853
lemma freshness_lemma_unique:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2854
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2855
  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
  2856
  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
  2857
proof (rule ex_ex1I)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2858
  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
  2859
    by (rule freshness_lemma)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2860
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2861
  fix x y
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2862
  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
  2863
  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
  2864
  from a x y show "x = y"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2865
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2866
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2867
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2868
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
  2869
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2870
definition
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2871
  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
  2872
where
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2873
  "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
  2874
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2875
lemma fresh_fun_apply:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2876
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2877
  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
  2878
  assumes b: "atom a \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2879
  shows "fresh_fun h = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2880
unfolding fresh_fun_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2881
proof (rule the_equality)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2882
  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
  2883
  proof (intro strip)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2884
    fix a':: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2885
    assume c: "atom a' \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2886
    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
  2887
    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
  2888
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2889
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2890
  fix fr :: 'b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2891
  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
  2892
  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
  2893
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2894
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2895
lemma fresh_fun_apply':
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2896
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2897
  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
  2898
  shows "fresh_fun h = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2899
  apply (rule fresh_fun_apply)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2900
  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
  2901
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2902
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2903
lemma fresh_fun_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2904
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2905
  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
  2906
  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
  2907
  using a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2908
  apply (clarsimp simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2909
  apply (subst fresh_fun_apply', assumption+)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2910
  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
  2911
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  2912
  apply (simp only: atom_eqvt permute_fun_app_eq [where f=h])
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2913
  apply (erule (1) fresh_fun_apply' [symmetric])
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2914
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2915
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2916
lemma fresh_fun_supports:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2917
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2918
  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
  2919
  shows "(supp h) supports (fresh_fun h)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2920
  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
  2921
  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
  2922
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2923
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2924
notation fresh_fun (binder "FRESH " 10)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2925
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2926
lemma FRESH_f_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2927
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2928
  fixes f :: "'b \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2929
  assumes P: "finite (supp P)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2930
  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
  2931
proof -
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2932
  obtain a::'a where "atom a \<sharp> P" using P by (rule obtain_fresh')
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2933
  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
  2934
    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
  2935
    apply (cut_tac `atom a \<sharp> P`)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2936
    apply (simp add: fresh_conv_MOST)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2937
    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
  2938
    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
  2939
    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
  2940
    apply (rule refl)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2941
    done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2942
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2943
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2944
lemma FRESH_binop_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2945
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2946
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2947
  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
  2948
  assumes P: "finite (supp P)" 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2949
  and     Q: "finite (supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2950
  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
  2951
proof -
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2952
  from assms have "finite (supp (P, Q))" by (simp add: supp_Pair)
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2953
  then obtain a::'a where "atom a \<sharp> (P, Q)" by (rule obtain_fresh') 
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  2954
  then have "atom a \<sharp> P" and "atom a \<sharp> Q" by (simp_all add: fresh_Pair)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2955
  show ?thesis
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2956
    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
  2957
    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
  2958
    apply (simp add: fresh_conv_MOST)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2959
    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
  2960
    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
  2961
    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
  2962
    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
  2963
    apply (rule refl)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2964
    done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2965
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2966
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2967
lemma FRESH_conj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2968
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2969
  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
  2970
  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
  2971
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
  2972
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2973
lemma FRESH_disj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2974
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2975
  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
  2976
  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
  2977
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
  2978
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2979
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2980
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
  2981
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
  2982
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
  2983
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2984
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2985
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
  2986
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2987
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
  2988
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2989
use "nominal_atoms.ML"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2990
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  2991
2733
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2992
section {* automatic equivariance procedure for inductive definitions *}
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2993
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2994
use "nominal_eqvt.ML"
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2995
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2996
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2997
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  2998
end