Nominal/Nominal2_Base.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 04 Oct 2012 11:10:23 +0100
changeset 3200 995d47b09ab4
parent 3197 25d11b449e92
child 3201 3e6f4320669f
permissions -rw-r--r--
removed fork_mono flag
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
3101
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
     2
    Authors:    Christian Urban, Brian Huffman, Cezary Kaliszyk
1062
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"
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
    11
        "~~/src/HOL/Library/FinFun"
3134
301b74fcd614 updated to new Isabelle (declared keywords)
Christian Urban <urbanc@in.tum.de>
parents: 3121
diff changeset
    12
keywords
301b74fcd614 updated to new Isabelle (declared keywords)
Christian Urban <urbanc@in.tum.de>
parents: 3121
diff changeset
    13
  "atom_decl" "equivariance" :: thy_decl 
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
    14
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
    15
     ("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
    16
     ("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
    17
     ("nominal_library.ML")
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
    18
     ("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
    19
     ("nominal_eqvt.ML")
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    20
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    21
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    22
section {* Atoms and Sorts *}
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 {* A simple implementation for atom_sorts is strings. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    25
(* types atom_sort = string *)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    26
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    27
text {* 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
    28
  strings as sorts. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    29
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    30
datatype atom_sort = Sort "string" "atom_sort list"
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
datatype atom = Atom atom_sort nat
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    35
text {* Basic projection function. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    36
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    37
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    38
  sort_of :: "atom \<Rightarrow> atom_sort"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    39
where
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
    40
  "sort_of (Atom s n) = s"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    41
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    42
primrec
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    43
  nat_of :: "atom \<Rightarrow> nat"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    44
where
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    45
  "nat_of (Atom s n) = n"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    46
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    47
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    48
text {* There are infinitely many atoms of each sort. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    49
lemma INFM_sort_of_eq: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    50
  shows "INFM a. sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    51
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    52
  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
    53
  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
    54
  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
    55
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    56
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    57
lemma infinite_sort_of_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    58
  shows "infinite {a. sort_of a = s}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    59
  using INFM_sort_of_eq unfolding INFM_iff_infinite .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    60
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    61
lemma atom_infinite [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    62
  shows "infinite (UNIV :: atom set)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    63
  using subset_UNIV infinite_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    64
  by (rule infinite_super)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    65
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    66
lemma obtain_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    67
  fixes X :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    68
  assumes X: "finite X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    69
  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
    70
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    71
  from X have "MOST a. a \<notin> X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    72
    unfolding MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    73
  with INFM_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    74
  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
    75
    by (rule INFM_conjI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    76
  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
    77
    by (auto elim: INFM_E)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    78
  then show ?thesis ..
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    79
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    80
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    81
lemma atom_components_eq_iff:
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    82
  fixes a b :: atom
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    83
  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
    84
  by (induct a, induct b, simp)
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    85
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
    86
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    87
section {* Sort-Respecting Permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    88
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    89
typedef perm =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    90
  "{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
    91
proof
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    92
  show "id \<in> ?perm" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    93
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    94
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    95
lemma permI:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    96
  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
    97
  shows "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    98
  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
    99
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   100
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
   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_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
   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_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
   107
  unfolding perm_def 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_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
   110
  unfolding perm_def MOST_iff_cofinite 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_id: "id \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   113
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   114
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   115
lemma perm_comp:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   116
  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
   117
  shows "(f \<circ> g) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   118
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   119
apply (rule bij_comp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   120
apply (rule perm_is_bij [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   121
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   122
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
   123
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
   124
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   125
apply (simp add: perm_is_sort_respecting [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   126
apply (simp add: perm_is_sort_respecting [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   127
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   128
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   129
lemma perm_inv:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   130
  assumes f: "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   131
  shows "(inv f) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   132
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   133
apply (rule bij_imp_bij_inv)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   134
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   135
apply (rule MOST_mono [OF perm_MOST [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   136
apply (erule subst, rule inv_f_f)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   137
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
   138
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
   139
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
   140
done
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 bij_Rep_perm: "bij (Rep_perm p)"
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 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
   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 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
   149
  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
   150
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   151
lemma Rep_perm_ext:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   152
  "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
   153
  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
   154
2560
82e37a4595c7 automated permute_bn functions (raw ones first)
Christian Urban <urbanc@in.tum.de>
parents: 2507
diff changeset
   155
instance perm :: size ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   156
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   157
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   158
subsection {* Permutations form a (multiplicative) group *}
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   159
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   160
instantiation perm :: group_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   161
begin
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
  "0 = Abs_perm id"
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 = Abs_perm (inv (Rep_perm p))"
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
  "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
   171
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   172
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
  "(p1::perm) - p2 = p1 + - p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   175
lemma Rep_perm_0: "Rep_perm 0 = id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
  unfolding zero_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
  by (simp add: Abs_perm_inverse perm_id)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   178
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   179
lemma Rep_perm_add:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   180
  "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
   181
  unfolding plus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   182
  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
   183
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   184
lemma Rep_perm_uminus:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   185
  "Rep_perm (- p) = inv (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
  unfolding uminus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
  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
   188
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
unfolding Rep_perm_inject [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
unfolding minus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   193
unfolding Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   194
unfolding Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   195
unfolding Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   196
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
   197
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   198
end
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   201
section {* Implementation of swappings *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   202
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
  swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   206
  "(a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   207
    Abs_perm (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   208
              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
   209
              else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
lemma Rep_perm_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   212
  "Rep_perm (a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   213
    (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   214
     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
   215
     else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   216
unfolding swap_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   217
apply (rule Abs_perm_inverse)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   218
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   219
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
   220
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
   221
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
   222
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   225
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   226
lemmas Rep_perm_simps =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
  Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   228
  Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   229
  Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
  Rep_perm_swap
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   231
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   232
lemma swap_different_sorts [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   233
  "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
   234
  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
   235
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   236
lemma swap_cancel:
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   237
  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
   238
  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
   239
  by (rule_tac [!] Rep_perm_ext) 
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   240
     (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
   241
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   242
lemma swap_self [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
  "(a \<rightleftharpoons> a) = 0"
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   244
  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
   245
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
lemma minus_swap [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
   248
  by (rule minus_unique [OF swap_cancel(1)])
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   249
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   250
lemma swap_commute:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   251
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   252
  by (rule Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   253
     (simp add: Rep_perm_swap fun_eq_iff)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   255
lemma swap_triple:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   256
  assumes "a \<noteq> b" and "c \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
  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
   258
  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
   259
  using assms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
  by (rule_tac Rep_perm_ext)
2479
a9b6a00b1ba0 updated to Isabelle Sept 16
Christian Urban <urbanc@in.tum.de>
parents: 2475
diff changeset
   261
     (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
   262
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   263
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   264
section {* Permutation Types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   265
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
text {*
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
  Infix syntax for @{text permute} has higher precedence than
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   268
  addition, but lower than unary minus.
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   269
*}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   270
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
class pt =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   272
  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
   273
  assumes permute_zero [simp]: "0 \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   274
  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
   275
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   276
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   277
lemma permute_diff [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
  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
   279
  unfolding diff_minus by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
lemma permute_minus_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
  shows "p \<bullet> - p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
  and   "- p \<bullet> p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
  unfolding permute_plus [symmetric] by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   285
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
lemma permute_swap_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
  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
   288
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
  by (simp add: swap_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   290
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   291
lemma permute_swap_cancel2 [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
  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
   293
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   294
  by (simp add: swap_commute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   295
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
lemma inj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   297
  shows "inj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   298
  by (rule inj_on_inverseI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   299
     (rule permute_minus_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   300
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   301
lemma surj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   302
  shows "surj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
  by (rule surjI, rule permute_minus_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   305
lemma bij_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   306
  shows "bij (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
  by (rule bijI [OF inj_permute surj_permute])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   308
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   309
lemma inv_permute: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   310
  shows "inv (permute p) = permute (- p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   311
  by (rule inv_equality) (simp_all)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   313
lemma permute_minus: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   314
  shows "permute (- p) = inv (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   315
  by (simp add: inv_permute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   316
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   317
lemma permute_eq_iff [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   318
  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
   319
  by (rule inj_permute [THEN inj_eq])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   320
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   323
subsection {* Permutations for atoms *}
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
instantiation atom :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   326
begin
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
definition
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   329
  "p \<bullet> a = (Rep_perm p) a"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   331
instance 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   332
apply(default)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   333
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
   334
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   335
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   337
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   338
lemma sort_of_permute [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   339
  shows "sort_of (p \<bullet> a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
  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
   341
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
lemma swap_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   343
  shows "(a \<rightleftharpoons> b) \<bullet> c =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   344
           (if sort_of a = sort_of b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
            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
   346
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
  by (simp add: Rep_perm_swap)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   348
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   349
lemma swap_atom_simps [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   350
  "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
   351
  "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
   352
  "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
   353
  unfolding swap_atom by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   355
lemma perm_eq_iff:
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
  fixes p q :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
  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
   358
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   359
  by (metis Rep_perm_ext ext)
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   362
subsection {* Permutations for permutations *}
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
instantiation perm :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   365
begin
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
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   368
  "p \<bullet> q = p + q - p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   369
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   370
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   371
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   372
apply (simp add: permute_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
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
   374
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   375
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   376
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   377
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   378
lemma permute_self: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   379
  shows "p \<bullet> p = p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   380
  unfolding permute_perm_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   381
  by (simp add: diff_minus add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   382
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   383
lemma pemute_minus_self:
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   384
  shows "- p \<bullet> p = p"
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   385
  unfolding permute_perm_def 
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   386
  by (simp add: diff_minus add_assoc)
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
   387
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   388
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   389
subsection {* Permutations for functions *}
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
instantiation "fun" :: (pt, pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   392
begin
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
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   395
  "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
   396
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   397
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   398
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   399
apply (simp add: permute_fun_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   400
apply (simp add: permute_fun_def minus_add)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   401
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   402
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   403
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   404
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   405
lemma permute_fun_app_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   406
  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
   407
  unfolding permute_fun_def by simp
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   408
3167
c25386402f6a added a lemma about composition and permutations
Christian Urban <urbanc@in.tum.de>
parents: 3152
diff changeset
   409
lemma permute_fun_comp:
c25386402f6a added a lemma about composition and permutations
Christian Urban <urbanc@in.tum.de>
parents: 3152
diff changeset
   410
  shows "p \<bullet> f  = (permute p) o f o (permute (-p))"
c25386402f6a added a lemma about composition and permutations
Christian Urban <urbanc@in.tum.de>
parents: 3152
diff changeset
   411
by (simp add: comp_def permute_fun_def)
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
   412
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   413
subsection {* Permutations for booleans *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   414
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   415
instantiation bool :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   416
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   417
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   418
definition "p \<bullet> (b::bool) = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   419
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   420
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   421
apply(default) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   422
apply(simp_all add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   423
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   424
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   425
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   426
1557
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   427
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
   428
  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
   429
  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
   430
  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
   431
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   432
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
   433
  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
   434
  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
   435
  by(simp add: permute_bool_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   436
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   437
subsection {* Permutations for sets *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   438
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   439
instantiation "set" :: (pt) pt
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   440
begin
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   441
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   442
definition
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   443
  "p \<bullet> X = {p \<bullet> x | x. x \<in> X}" 
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   444
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   445
instance
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   446
apply default
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   447
apply (auto simp add: permute_set_def)
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   448
done
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   449
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   450
end
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   451
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   452
lemma permute_set_eq:
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   453
  shows "p \<bullet> X = {x. - p \<bullet> x \<in> X}"
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   454
unfolding permute_set_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   455
by (auto) (metis permute_minus_cancel(1))
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   456
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   457
lemma permute_set_eq_image:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   458
  shows "p \<bullet> X = permute p ` X"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   459
  unfolding permute_set_def by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   460
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   461
lemma permute_set_eq_vimage:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   462
  shows "p \<bullet> X = permute (- p) -` X"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   463
  unfolding permute_set_eq vimage_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   464
  by simp
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   465
  
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
   466
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
   467
  shows "finite (p \<bullet> X) = finite X"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   468
  unfolding permute_set_eq_vimage
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   469
  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
   470
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   471
lemma swap_set_not_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   472
  assumes a: "a \<notin> S" "b \<notin> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   473
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   474
  unfolding permute_set_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   475
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   476
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   477
lemma swap_set_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   478
  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
   479
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   480
  unfolding permute_set_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   481
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   482
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
   483
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
   484
  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
   485
  shows "(a \<rightleftharpoons> b) \<bullet> S = (S - {a}) \<union> {b}"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   486
  unfolding permute_set_def
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
   487
  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
   488
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
   489
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
   490
  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
   491
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   492
  unfolding permute_set_def
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
   493
  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
   494
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   495
lemma mem_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   496
  shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   497
  unfolding permute_set_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   498
  by auto
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   499
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   500
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
   501
  shows "p \<bullet> {} = {}"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   502
  unfolding permute_set_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   503
  by (simp)
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   504
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   505
lemma insert_eqvt:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   506
  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
   507
  unfolding permute_set_eq_image image_insert ..
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
   508
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   509
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   510
subsection {* Permutations for @{typ unit} *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   511
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   512
instantiation unit :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   513
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   514
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   515
definition "p \<bullet> (u::unit) = u"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   516
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   517
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   518
by (default) (simp_all add: permute_unit_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   519
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   520
end
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   523
subsection {* Permutations for products *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   524
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   525
instantiation prod :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   526
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   527
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   528
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   529
  permute_prod 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   530
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   531
  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
   532
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   533
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   534
by default auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   535
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   536
end
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
subsection {* Permutations for sums *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   539
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   540
instantiation sum :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   541
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   542
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   543
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   544
  permute_sum 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   545
where
2982
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   546
  Inl_eqvt: "p \<bullet> (Inl x) = Inl (p \<bullet> x)"
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   547
| Inr_eqvt: "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   548
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   549
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   550
by (default) (case_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   551
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   552
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   553
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   554
subsection {* Permutations for @{typ "'a list"} *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   555
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   556
instantiation list :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   557
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   558
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   559
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   560
  permute_list 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   561
where
2982
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   562
  Nil_eqvt:  "p \<bullet> [] = []"
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   563
| Cons_eqvt: "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   564
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   565
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   566
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   567
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   568
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   569
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   570
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
   571
  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
   572
  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
   573
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
   574
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   575
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   576
subsection {* Permutations for @{typ "'a option"} *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   577
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   578
instantiation option :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   579
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   580
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   581
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   582
  permute_option 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   583
where
2982
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   584
  None_eqvt: "p \<bullet> None = None"
4a00077c008f completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents: 2972
diff changeset
   585
| Some_eqvt: "p \<bullet> (Some x) = Some (p \<bullet> x)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   586
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   587
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   588
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   589
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   590
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   591
3121
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   592
subsection {* Permutations for @{typ "'a multiset"} *}
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   593
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   594
instantiation multiset :: (pt) pt
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   595
begin
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   596
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   597
definition
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   598
  "p \<bullet> M = {# p \<bullet> x. x :# M #}"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   599
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   600
instance 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   601
proof
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   602
  fix M :: "'a multiset" and p q :: "perm"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   603
  show "0 \<bullet> M = M" 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   604
    unfolding permute_multiset_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   605
    by (induct_tac M) (simp_all)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   606
  show "(p + q) \<bullet> M = p \<bullet> q \<bullet> M" 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   607
    unfolding permute_multiset_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   608
    by (induct_tac M) (simp_all)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   609
qed
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   610
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   611
end
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   612
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   613
lemma permute_multiset [simp]:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   614
  fixes M N::"('a::pt) multiset"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   615
  shows "(p \<bullet> {#}) = ({#} ::('a::pt) multiset)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   616
  and   "(p \<bullet> {# x #}) = {# p \<bullet> x #}"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   617
  and   "(p \<bullet> (M + N)) = (p \<bullet> M) + (p \<bullet> N)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   618
  unfolding permute_multiset_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   619
  by (simp_all)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   620
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   621
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   622
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
   623
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   624
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
   625
  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
   626
  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
   627
  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
   628
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   629
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
   630
begin
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   631
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   632
quotient_definition
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   633
  "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
   634
is
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   635
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
3152
da59c94bed7e updated to Isabelle version April 1
Christian Urban <urbanc@in.tum.de>
parents: 3147
diff changeset
   636
  by (simp add: set_eqvt[symmetric])
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   637
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   638
instance 
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   639
proof
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   640
  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
   641
  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
   642
  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
   643
qed
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   644
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   645
end
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   646
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
   647
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
   648
  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
   649
  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
   650
  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
   651
  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
   652
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
   653
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
   654
  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
   655
  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
   656
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   657
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   658
subsection {* Permutations for @{typ "('a, 'b) finfun"} *}
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   659
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   660
instantiation finfun :: (pt, pt) pt
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   661
begin
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   662
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   663
lift_definition
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   664
  permute_finfun :: "perm \<Rightarrow> ('a, 'b) finfun \<Rightarrow> ('a, 'b) finfun"
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   665
is
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   666
  "permute :: perm \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b)"
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   667
  apply(simp add: permute_fun_comp)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   668
  apply(rule finfun_right_compose)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   669
  apply(rule finfun_left_compose)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   670
  apply(assumption)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   671
  apply(simp)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   672
  done
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   673
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   674
instance
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   675
apply(default)
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   676
apply(transfer)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   677
apply(simp)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   678
apply(transfer)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
   679
apply(simp)
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   680
done
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   681
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   682
end
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   683
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
   684
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   685
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
   686
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   687
instantiation char :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   688
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   689
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   690
definition "p \<bullet> (c::char) = c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   691
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   692
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   693
by (default) (simp_all add: permute_char_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   694
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   695
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   696
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   697
instantiation nat :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   698
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   699
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   700
definition "p \<bullet> (n::nat) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   701
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   702
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   703
by (default) (simp_all add: permute_nat_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   704
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   705
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   706
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   707
instantiation int :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   708
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   709
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   710
definition "p \<bullet> (i::int) = i"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   711
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   712
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   713
by (default) (simp_all add: permute_int_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   714
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   715
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   716
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   717
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   718
section {* Pure types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   719
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   720
text {* Pure types will have always empty support. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   721
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   722
class pure = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   723
  assumes permute_pure: "p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   724
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   725
text {* Types @{typ unit} and @{typ bool} are pure. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   726
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   727
instance unit :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   728
proof qed (rule permute_unit_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   729
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   730
instance bool :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   731
proof qed (rule permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   732
2635
64b4cb2c2bf8 simple cases for string rule inductions
Christian Urban <urbanc@in.tum.de>
parents: 2632
diff changeset
   733
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   734
text {* Other type constructors preserve purity. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   735
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   736
instance "fun" :: (pure, pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   737
by default (simp add: permute_fun_def permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   738
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   739
instance set :: (pure) pure
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   740
by default (simp add: permute_set_def permute_pure)
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   741
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   742
instance prod :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   743
by default (induct_tac x, simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   744
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   745
instance sum :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   746
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
   747
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   748
instance list :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   749
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
   750
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   751
instance option :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   752
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
   753
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   754
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   755
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   756
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   757
instance char :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   758
proof qed (rule permute_char_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   759
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   760
instance nat :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   761
proof qed (rule permute_nat_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   762
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   763
instance int :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   764
proof qed (rule permute_int_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   765
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
   766
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   767
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
   768
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
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
   770
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   771
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
   772
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   773
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   774
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
   775
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   776
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
   777
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   778
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
   779
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
   780
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   781
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   782
lemmas [eqvt] =
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   783
  (* pt types *)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   784
  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
   785
  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
   786
  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
   787
  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
   788
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   789
  (* 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
   790
  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
   791
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
  (* 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
   793
  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
   794
3121
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   795
  (* multisets *)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
   796
  permute_multiset
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
   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
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
   799
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   800
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
   801
  "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
   802
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   803
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
   804
  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
   805
  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
   806
  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
   807
  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
   808
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
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
   810
  fixes f :: "'a::pt \<Rightarrow> 'b::pt"
2753
445518561867 eqvt_lambda without eta-expansion
Christian Urban <urbanc@in.tum.de>
parents: 2743
diff changeset
   811
  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
   812
  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
   813
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   814
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
   815
  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
   816
  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
   817
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   818
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
   819
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
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
   821
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   822
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
   823
 {* 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
   824
 {* 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
   825
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
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
   827
 {* 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
   828
 {* 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
   829
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   830
simproc_setup perm_simproc ("p \<bullet> t") = {* fn _ => fn ss => fn ctrm =>
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   831
  case term_of (Thm.dest_arg ctrm) of 
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   832
    Free _ => NONE
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   833
  | Var _ => NONE
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   834
  | Const (@{const_name permute}, _) $ _ $ _ => NONE
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   835
  | _ =>
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   836
      let
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   837
        val ctxt = Simplifier.the_context ss
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   838
        val thm = Nominal_Permeq.eqvt_conv ctxt Nominal_Permeq.eqvt_strict_config ctrm
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   839
          handle ERROR _ => Thm.reflexive ctrm
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   840
      in
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   841
        if Thm.is_reflexive thm then NONE else SOME(thm)
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   842
      end
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   843
*}
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   844
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   845
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   846
subsubsection {* Equivariance for permutations and swapping *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   847
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   848
lemma permute_eqvt:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   849
  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
   850
  unfolding permute_perm_def by simp
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   851
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
   852
(* the normal version of this lemma would cause loops *)
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   853
lemma permute_eqvt_raw [eqvt_raw]:
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
   854
  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
   855
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
   856
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
   857
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
   858
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
   859
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   860
lemma zero_perm_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   861
  shows "p \<bullet> (0::perm) = 0"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   862
  unfolding permute_perm_def by simp
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   863
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   864
lemma add_perm_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   865
  fixes p p1 p2 :: perm
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   866
  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
   867
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   868
  by (simp add: perm_eq_iff)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   869
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   870
lemma swap_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   871
  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
   872
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   873
  by (auto simp add: swap_atom perm_eq_iff)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   874
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   875
lemma uminus_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   876
  fixes p q::"perm"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   877
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   878
  unfolding permute_perm_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   879
  by (simp add: diff_minus minus_add add_assoc)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   880
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
   881
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
   882
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
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
   884
  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
   885
  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
   886
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
lemma Not_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   888
  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
   889
  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
   890
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
lemma conj_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   892
  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
   893
  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
   894
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
lemma imp_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   896
  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
   897
  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
   898
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   899
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
   900
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
   901
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
   902
  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
   903
  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
   904
  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
   905
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
   906
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
   907
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
   908
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
   909
  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
   910
  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
   911
  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
   912
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
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
   914
  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
   915
  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
   916
  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
   917
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
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
   919
  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
   920
  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
   921
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
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
   923
  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
   924
  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
   925
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
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
   927
  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
   928
  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
   929
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
lemma disj_eqvt [eqvt]:
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   931
  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
   932
  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
   933
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
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
   935
  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
   936
  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
   937
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   938
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
   939
  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
   940
  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
   941
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
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
   943
  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
   944
  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
   945
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
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
   947
  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
   948
  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
   949
  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
   950
  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
   951
  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
   952
  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
   953
  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
   954
  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
   955
  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
   956
  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
   957
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
   958
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
   959
  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
   960
  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
   961
  apply(rule the1_equality [symmetric])
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   962
  apply(simp only: ex1_eqvt2[symmetric])
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
   963
  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
   964
  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
   965
  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
   966
  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
   967
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   968
subsubsection {* Equivariance of Set operators *}
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   969
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   970
lemma mem_eqvt [eqvt]:
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   971
  shows "p \<bullet> (x \<in> A) \<longleftrightarrow> (p \<bullet> x) \<in> (p \<bullet> A)"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   972
  unfolding permute_bool_def permute_set_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   973
  by (auto)
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   974
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   975
lemma Collect_eqvt [eqvt]:
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   976
  shows "p \<bullet> {x. P x} = {x. (p \<bullet> P) x}"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   977
  unfolding permute_set_eq permute_fun_def
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
   978
  by (auto simp add: permute_bool_def)
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   979
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   980
lemma inter_eqvt [eqvt]:
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   981
  shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   982
  unfolding Int_def by simp
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   983
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   984
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
   985
  shows "p \<bullet> (\<exists>x \<in> S. P x) = (\<exists>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   986
  unfolding Bex_def by 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
   987
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
   988
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
   989
  shows "p \<bullet> (\<forall>x \<in> S. P x) = (\<forall>x \<in> (p \<bullet> S). (p \<bullet> P) x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   990
  unfolding Ball_def by 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
   991
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   992
lemma image_eqvt [eqvt]:
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   993
  shows "p \<bullet> (f ` A) = (p \<bullet> f) ` (p \<bullet> A)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   994
  unfolding image_def by simp
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
   995
3050
7519ebb41145 added eqvt-lemma for Image
Christian Urban <urbanc@in.tum.de>
parents: 3026
diff changeset
   996
lemma Image_eqvt [eqvt]:
7519ebb41145 added eqvt-lemma for Image
Christian Urban <urbanc@in.tum.de>
parents: 3026
diff changeset
   997
  shows "p \<bullet> (R `` A) = (p \<bullet> R) `` (p \<bullet> A)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
   998
  unfolding Image_def by simp
3050
7519ebb41145 added eqvt-lemma for Image
Christian Urban <urbanc@in.tum.de>
parents: 3026
diff changeset
   999
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1000
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
  1001
  shows "p \<bullet> UNIV = UNIV"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1002
  unfolding UNIV_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
  1003
  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
  1004
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1005
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
  1006
  shows "p \<bullet> (A \<union> B) = (p \<bullet> A) \<union> (p \<bullet> B)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1007
  unfolding Un_def by 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
  1008
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1009
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
  1010
  fixes A B :: "'a::pt set"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1011
  shows "p \<bullet> (A - B) = (p \<bullet> A) - (p \<bullet> B)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1012
  unfolding set_diff_eq by 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
  1013
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1014
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
  1015
  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
  1016
  shows "p \<bullet> (- A) = - (p \<bullet> A)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1017
  unfolding Compl_eq_Diff_UNIV by 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
  1018
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1019
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
  1020
  shows "p \<bullet> (S \<subseteq> T) \<longleftrightarrow> (p \<bullet> S) \<subseteq> (p \<bullet> T)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1021
  unfolding subset_eq by 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
  1022
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1023
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
  1024
  shows "p \<bullet> (S \<subset> T) \<longleftrightarrow> (p \<bullet> S) \<subset> (p \<bullet> T)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1025
  unfolding psubset_eq by 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
  1026
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1027
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
  1028
  shows "p \<bullet> (f -` A) = (p \<bullet> f) -` (p \<bullet> A)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1029
  unfolding vimage_def by 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
  1030
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1031
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
  1032
  shows "p \<bullet> (\<Union> S) = \<Union> (p \<bullet> S)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1033
  unfolding Union_eq by 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
  1034
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
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
  1036
  shows "p \<bullet> (\<Inter> S) = \<Inter> (p \<bullet> S)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1037
  unfolding Inter_eq by simp
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1038
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1039
thm foldr.simps
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
  1040
3147
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3134
diff changeset
  1041
lemma foldr_eqvt[eqvt]:
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1042
  "p \<bullet> foldr f xs = foldr (p \<bullet> f) (p \<bullet> xs)"
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1043
  apply(induct xs)
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1044
  apply(simp_all)
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1045
  apply(perm_simp exclude: foldr)
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1046
  apply(simp)
3147
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3134
diff changeset
  1047
  done
d24e70483051 Clean the proof of Aux
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents: 3134
diff changeset
  1048
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1049
(* 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
  1050
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
  1051
  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
  1052
unfolding Sigma_def
3026
b037ae269f50 updated to Isabelle 19 Sept
Christian Urban <urbanc@in.tum.de>
parents: 2987
diff changeset
  1053
unfolding SUP_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
  1054
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
  1055
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
  1056
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
  1057
  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
  1058
  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
  1059
  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
  1060
  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
  1061
*}
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1062
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1063
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
  1064
  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
  1065
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1066
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
  1067
  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
  1068
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1069
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
  1070
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
  1071
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1072
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
  1073
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
  1074
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
  1075
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
  1076
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
  1077
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
  1078
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1079
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
  1080
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1081
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
  1082
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
  1083
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1084
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
  1085
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
  1086
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
  1087
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
  1088
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
  1089
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
  1090
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1091
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
  1092
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1093
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
  1094
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
  1095
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1096
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
  1097
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
  1098
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
  1099
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
  1100
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
  1101
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
  1102
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1103
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
  1104
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1105
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
  1106
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
  1107
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1108
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
  1109
apply(default)
2987
27aab7a105eb updated for new Isabelle (11. Aug.)
Christian Urban <urbanc@in.tum.de>
parents: 2982
diff changeset
  1110
unfolding Inf_fun_def INF_def
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
  1111
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
  1112
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
  1113
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
  1114
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1115
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
  1116
75a95431cd8b proved that lfp is equivariant (that simplifies equivariance proofs of inductively defined predicates)
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1117
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
  1118
  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
  1119
  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
  1120
unfolding lfp_def
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1121
by simp
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
  1122
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1123
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
  1124
  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
  1125
unfolding finite_def
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1126
by simp
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
  1127
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1128
lemma fun_upd_eqvt[eqvt]:
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1129
  shows "p \<bullet> (f(x := y)) = (p \<bullet> f)((p \<bullet> x) := (p \<bullet> y))"
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1130
unfolding fun_upd_def
3195
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1131
by simp
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1132
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1133
lemma comp_eqvt [eqvt]:
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1134
  shows "p \<bullet> (f \<circ> g) = (p \<bullet> f) \<circ> (p \<bullet> g)"
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1135
unfolding comp_def
deef21dc972f added eqvt-lemma for function composition
Christian Urban <urbanc@in.tum.de>
parents: 3191
diff changeset
  1136
by simp
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1137
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1138
subsubsection {* Equivariance for product operations *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1139
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1140
lemma fst_eqvt [eqvt]:
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1141
  shows "p \<bullet> (fst x) = fst (p \<bullet> x)"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1142
  by (cases x) 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
  1143
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1144
lemma snd_eqvt [eqvt]:
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1145
  shows "p \<bullet> (snd x) = snd (p \<bullet> x)"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1146
  by (cases x) 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
  1147
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1148
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
  1149
  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
  1150
  unfolding split_def
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1151
  by 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
  1152
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1153
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1154
subsubsection {* Equivariance for list operations *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1155
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1156
lemma append_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1157
  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
  1158
  by (induct xs) auto
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1159
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1160
lemma rev_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1161
  shows "p \<bullet> (rev xs) = rev (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1162
  by (induct xs) (simp_all add: append_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1163
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1164
lemma map_eqvt [eqvt]: 
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1165
  shows "p \<bullet> (map f xs) = map (p \<bullet> f) (p \<bullet> xs)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1166
  by (induct xs) (simp_all)
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1167
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1168
lemma removeAll_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1169
  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
  1170
  by (induct xs) (auto)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1171
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1172
lemma filter_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1173
  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
  1174
apply(induct xs)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1175
apply(simp)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1176
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
  1177
apply(simp only: permute_fun_app_eq)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1178
done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1179
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1180
lemma distinct_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1181
  shows "p \<bullet> (distinct xs) = distinct (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1182
apply(induct xs)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1183
apply(simp add: permute_bool_def)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1184
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
  1185
done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1186
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1187
lemma length_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1188
  shows "p \<bullet> (length xs) = length (p \<bullet> xs)"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1189
by (induct xs) (simp_all add: permute_pure)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1190
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1191
2972
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1192
subsubsection {* Equivariance for @{typ "'a option"} *}
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1193
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1194
lemma option_map_eqvt[eqvt]:
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1195
  shows "p \<bullet> (Option.map f x) = Option.map (p \<bullet> f) (p \<bullet> x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1196
  by (cases x) (simp_all)
2972
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1197
84afb941df53 moved eqvt for Option.map
Christian Urban <urbanc@in.tum.de>
parents: 2955
diff changeset
  1198
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1199
subsubsection {* Equivariance for @{typ "'a fset"} *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1200
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1201
lemma in_fset_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1202
  shows "(p \<bullet> (x |\<in>| S)) = ((p \<bullet> x) |\<in>| (p \<bullet> S))"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1203
unfolding in_fset by simp
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1204
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1205
lemma union_fset_eqvt [eqvt]:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1206
  shows "(p \<bullet> (S |\<union>| T)) = ((p \<bullet> S) |\<union>| (p \<bullet> T))"
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1207
  by (induct S) (simp_all)
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1208
3101
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1209
lemma inter_fset_eqvt [eqvt]:
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1210
  shows "(p \<bullet> (S |\<inter>| T)) = ((p \<bullet> S) |\<inter>| (p \<bullet> T))"
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1211
  apply(descending)
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1212
  unfolding list_eq_def inter_list_def
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1213
  apply(simp)
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1214
  done
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1215
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1216
lemma subset_fset_eqvt [eqvt]:
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1217
  shows "(p \<bullet> (S |\<subseteq>| T)) = ((p \<bullet> S) |\<subseteq>| (p \<bullet> T))"
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1218
  apply(descending)
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1219
  unfolding sub_list_def
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1220
  apply(simp)
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1221
  done
09acd7e116e8 added two eqvt lemmas for fset-operators
Christian Urban <urbanc@in.tum.de>
parents: 3065
diff changeset
  1222
  
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1223
lemma map_fset_eqvt [eqvt]: 
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1224
  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
  1225
  by (lifting map_eqvt)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1226
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1227
subsubsection {* Equivariance for @{typ "('a, 'b) finfun"} *}
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1228
3189
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1229
lemma finfun_update_eqvt [eqvt]:
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1230
  shows "(p \<bullet> (finfun_update f a b)) = finfun_update (p \<bullet> f) (p \<bullet> a) (p \<bullet> b)"
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1231
by (transfer) (simp)
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1232
3189
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1233
lemma finfun_const_eqvt [eqvt]:
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1234
  shows "(p \<bullet> (finfun_const b)) = finfun_const (p \<bullet> b)"
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1235
by (transfer) (simp)
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1236
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1237
lemma finfun_apply_eqvt [eqvt]:
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  1238
  shows "(p \<bullet> (finfun_apply f b)) = finfun_apply (p \<bullet> f) (p \<bullet> b)"
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  1239
by (transfer) (simp)
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  1240
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1241
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1242
section {* Supp, Freshness and Supports *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1243
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1244
context pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1245
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1246
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1247
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1248
  supp :: "'a \<Rightarrow> atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1249
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1250
  "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
  1251
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1252
definition
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1253
  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
  1254
where   
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1255
  "a \<sharp> x \<equiv> a \<notin> supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1256
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1257
end
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1258
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1259
lemma supp_conv_fresh: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1260
  shows "supp x = {a. \<not> a \<sharp> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1261
  unfolding fresh_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1262
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1263
lemma swap_rel_trans:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1264
  assumes "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1265
  assumes "sort_of b = sort_of c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1266
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1267
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1268
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1269
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1270
  assume "a = b \<or> c = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1271
  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
  1272
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1273
  assume *: "\<not> (a = b \<or> c = b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1274
  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
  1275
    using assms by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1276
  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
  1277
    using assms * by (simp add: swap_triple)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1278
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1279
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1280
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1281
lemma swap_fresh_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1282
  assumes a: "a \<sharp> x" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1283
  and     b: "b \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1284
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1285
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1286
  assume asm: "sort_of a = sort_of b" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1287
  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
  1288
    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
  1289
  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
  1290
  then obtain c 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1291
    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
  1292
    by (rule obtain_atom) (auto)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1293
  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
  1294
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1295
  assume "sort_of a \<noteq> sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1296
  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
  1297
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1298
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1299
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1300
subsection {* supp and fresh are equivariant *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1301
2760
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1302
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1303
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
  1304
  shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1305
  unfolding supp_def by simp
2760
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1306
8f833ebc4b58 eqvt of supp and fresh is proved using equivariance infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 2753
diff changeset
  1307
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
  1308
  shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1309
  unfolding fresh_def by simp
1062
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 fresh_permute_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1312
  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
  1313
  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
  1314
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1315
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
  1316
  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
  1317
proof
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1318
  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
  1319
  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
  1320
  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
  1321
next
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1322
  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
  1323
  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
  1324
  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
  1325
qed
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1326
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  1327
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1328
section {* supports *}
1062
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
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1331
  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
  1332
where  
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1333
  "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
  1334
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1335
lemma supp_is_subset:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1336
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1337
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1338
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1339
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1340
  shows "(supp x) \<subseteq> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1341
proof (rule ccontr)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1342
  assume "\<not> (supp x \<subseteq> S)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1343
  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
  1344
  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
  1345
  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
  1346
  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
  1347
  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
  1348
  with b1 show False by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1349
qed
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 supports_finite:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1352
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1353
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1354
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1355
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1356
  shows "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1357
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1358
  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
  1359
  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
  1360
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1361
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1362
lemma supp_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1363
  fixes x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1364
  shows "(supp x) supports x"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1365
unfolding supports_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1366
proof (intro strip)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1367
  fix a b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1368
  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
  1369
  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
  1370
  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
  1371
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1372
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1373
lemma supports_fresh:
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1374
  fixes x :: "'a::pt"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1375
  assumes a1: "S supports x"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1376
  and     a2: "finite S"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1377
  and     a3: "a \<notin> S"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1378
  shows "a \<sharp> x"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1379
unfolding fresh_def
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1380
proof -
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1381
  have "(supp x) \<subseteq> S" using a1 a2 by (rule supp_is_subset)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1382
  then show "a \<notin> (supp x)" using a3 by auto
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1383
qed
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1384
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1385
lemma supp_is_least_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1386
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1387
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1388
  assumes  a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1389
  and      a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1390
  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
  1391
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1392
proof (rule equalityI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1393
  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
  1394
  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
  1395
  have "(supp x) supports x" by (rule supp_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1396
  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
  1397
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1398
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1399
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1400
lemma subsetCI: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1401
  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
  1402
  by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1403
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1404
lemma finite_supp_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1405
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1406
  assumes a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1407
  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
  1408
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1409
  using a1 a2
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1410
proof (rule supp_is_least_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1411
  fix S'
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1412
  assume "finite S'" and "S' supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1413
  show "S \<subseteq> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1414
  proof (rule subsetCI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1415
    fix a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1416
    assume "a \<in> S" and "a \<notin> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1417
    have "finite (S \<union> S')"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1418
      using `finite S` `finite S'` by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1419
    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
  1420
      by (rule obtain_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1421
    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
  1422
      by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1423
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1424
      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
  1425
    moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1426
      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
  1427
      by (rule a3)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1428
    ultimately show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1429
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1430
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1431
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
  1432
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
  1433
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
  1434
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
  1435
  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
  1436
  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
  1437
*}
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
  1438
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
  1439
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
  1440
  "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
  1441
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
  1442
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1443
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1444
section {* Finitely-supported types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1445
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1446
class fs = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1447
  assumes finite_supp: "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1448
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1449
lemma pure_supp: 
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1450
  fixes x::"'a::pure"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1451
  shows "supp x = {}"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1452
  unfolding supp_def by (simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1453
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1454
lemma pure_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1455
  fixes x::"'a::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1456
  shows "a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1457
  unfolding fresh_def by (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1458
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1459
instance pure < fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1460
by default (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1461
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1462
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1463
subsection  {* Type @{typ atom} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1464
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1465
lemma supp_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1466
  shows "supp a = {a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1467
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1468
apply (clarsimp simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1469
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1470
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1471
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1472
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1473
lemma fresh_atom: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1474
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1475
  unfolding fresh_def supp_atom by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1476
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1477
instance atom :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1478
by default (simp add: supp_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1479
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
  1480
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1481
section {* Type @{typ perm} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1482
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1483
lemma perm_swap_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1484
  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
  1485
unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1486
by (metis add_diff_cancel minus_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1487
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1488
lemma supports_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1489
  shows "{a. p \<bullet> a \<noteq> a} supports p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1490
  unfolding supports_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1491
  unfolding perm_swap_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1492
  by (simp add: swap_eqvt)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1493
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1494
lemma finite_perm_lemma: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1495
  shows "finite {a::atom. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1496
  using finite_Rep_perm [of p]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1497
  unfolding permute_atom_def .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1498
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1499
lemma supp_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1500
  shows "supp p = {a. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1501
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1502
apply (rule supports_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1503
apply (rule finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1504
apply (simp add: perm_swap_eq swap_eqvt)
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1505
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
  1506
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1507
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1508
lemma fresh_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1509
  shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1510
  unfolding fresh_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1511
  by (simp add: supp_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1512
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1513
lemma supp_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1514
  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
  1515
  by (auto simp add: supp_perm swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1516
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1517
lemma fresh_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1518
  shows "a \<sharp> (0::perm)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1519
  unfolding fresh_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1520
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1521
lemma supp_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1522
  shows "supp (0::perm) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1523
  unfolding supp_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1524
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1525
lemma fresh_plus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1526
  fixes p q::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1527
  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
  1528
  shows "a \<sharp> (p + q)"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1529
  using assms
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1530
  unfolding fresh_def
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1531
  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
  1532
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1533
lemma supp_plus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1534
  fixes p q::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1535
  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
  1536
  by (auto simp add: supp_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1537
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1538
lemma fresh_minus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1539
  fixes p::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1540
  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
  1541
  unfolding fresh_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1542
  unfolding supp_perm
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1543
  apply(simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1544
  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
  1545
  done
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1546
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1547
lemma supp_minus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1548
  fixes p::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1549
  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
  1550
  unfolding supp_conv_fresh
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
  1551
  by (simp add: fresh_minus_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1552
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1553
lemma plus_perm_eq:
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1554
  fixes p q::"perm"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1555
  assumes asm: "supp p \<inter> supp q = {}"
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1556
  shows "p + q = q + p"
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1557
unfolding perm_eq_iff
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1558
proof
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1559
  fix a::"atom"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1560
  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
  1561
  proof -
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1562
    { 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
  1563
      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
  1564
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1565
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1566
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1567
    { 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
  1568
      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
  1569
      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
  1570
      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
  1571
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1572
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1573
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1574
    { 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
  1575
      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
  1576
      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
  1577
      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
  1578
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1579
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1580
    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
  1581
      using asm by blast
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1582
  qed
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
  1583
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1584
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1585
lemma supp_plus_perm_eq:
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1586
  fixes p q::perm
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1587
  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
  1588
  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
  1589
proof -
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1590
  { fix a::"atom"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1591
    assume "a \<in> supp p"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1592
    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
  1593
    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
  1594
      by (simp add: supp_perm)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1595
  }
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1596
  moreover
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1597
  { fix a::"atom"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1598
    assume "a \<in> supp q"
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1599
    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
  1600
    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
  1601
      by (simp add: supp_perm)
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1602
    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
  1603
      by metis
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1604
  }
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1605
  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
  1606
    by blast
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1607
  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
  1608
    by blast
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1609
qed
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1610
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1611
instance perm :: fs
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1612
by default (simp add: supp_perm finite_perm_lemma)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1613
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1614
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  1615
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1616
section {* Finite Support instances for other types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1617
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1618
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1619
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1620
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1621
lemma supp_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1622
  shows "supp (x, y) = supp x \<union> supp y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1623
  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
  1624
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1625
lemma fresh_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1626
  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
  1627
  by (simp add: fresh_def supp_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1628
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1629
lemma supp_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1630
  shows "supp () = {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1631
  by (simp add: supp_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1632
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1633
lemma fresh_Unit:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1634
  shows "a \<sharp> ()"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1635
  by (simp add: fresh_def supp_Unit)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1636
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1637
instance prod :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1638
apply default
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1639
apply (case_tac x)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1640
apply (simp add: supp_Pair finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1641
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1642
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1643
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1644
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1645
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1646
lemma supp_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1647
  shows "supp (Inl x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1648
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1649
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1650
lemma supp_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1651
  shows "supp (Inr x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1652
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1653
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1654
lemma fresh_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1655
  shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1656
  by (simp add: fresh_def supp_Inl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1657
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1658
lemma fresh_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1659
  shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1660
  by (simp add: fresh_def supp_Inr)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1661
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1662
instance sum :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1663
apply default
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1664
apply (case_tac x)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1665
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
  1666
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1667
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1668
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1669
subsection {* Type @{typ "'a option"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1670
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1671
lemma supp_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1672
  shows "supp None = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1673
by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1674
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1675
lemma supp_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1676
  shows "supp (Some x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1677
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1678
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1679
lemma fresh_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1680
  shows "a \<sharp> None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1681
  by (simp add: fresh_def supp_None)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1682
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1683
lemma fresh_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1684
  shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1685
  by (simp add: fresh_def supp_Some)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1686
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1687
instance option :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1688
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1689
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1690
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
  1691
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1692
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  1693
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1694
subsubsection {* Type @{typ "'a list"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1695
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1696
lemma supp_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1697
  shows "supp [] = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1698
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1699
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1700
lemma fresh_Nil: 
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1701
  shows "a \<sharp> []"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1702
  by (simp add: fresh_def supp_Nil)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1703
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1704
lemma supp_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1705
  shows "supp (x # xs) = supp x \<union> supp xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1706
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
  1707
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1708
lemma fresh_Cons: 
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1709
  shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1710
  by (simp add: fresh_def supp_Cons)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1711
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1712
lemma supp_append:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1713
  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
  1714
  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
  1715
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1716
lemma fresh_append:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  1717
  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
  1718
  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
  1719
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
  1720
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
  1721
  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
  1722
  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
  1723
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1724
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
  1725
  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
  1726
  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
  1727
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1728
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
  1729
  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
  1730
  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
  1731
  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
  1732
     (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
  1733
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1734
lemma supp_of_atom_list:
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1735
  fixes as::"atom list"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1736
  shows "supp as = set as"
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1737
by (induct as)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1738
   (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
  1739
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1740
instance list :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1741
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1742
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1743
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
  1744
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1745
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1746
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  1747
section {* Support and Freshness for Applications *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1748
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1749
lemma fresh_conv_MOST: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1750
  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
  1751
  unfolding fresh_def supp_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1752
  unfolding MOST_iff_cofinite by simp
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1753
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1754
lemma fresh_fun_app:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1755
  assumes "a \<sharp> f" and "a \<sharp> x" 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1756
  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
  1757
  using assms
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1758
  unfolding fresh_conv_MOST
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1759
  unfolding permute_fun_app_eq
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  1760
  by (elim MOST_rev_mp) (simp)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1761
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1762
lemma supp_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1763
  shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1764
  using fresh_fun_app
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1765
  unfolding fresh_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1766
  by auto
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1767
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  1768
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1769
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
  1770
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1771
definition
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1772
  "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
  1773
2868
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1774
lemma eqvt_boolI:
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1775
  fixes f::"bool"
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1776
  shows "eqvt f"
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1777
unfolding eqvt_def by (simp add: permute_bool_def)
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1778
2b8e387d2dfc got rid of the boolean flag in the raw_equivariance function
Christian Urban <urbanc@in.tum.de>
parents: 2849
diff changeset
  1779
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1780
text {* equivariance of a function at a given argument *}
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1781
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1782
definition
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1783
 "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
  1784
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1785
lemma eqvtI:
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1786
  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
  1787
unfolding eqvt_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1788
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
  1789
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1790
lemma eqvt_at_perm:
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1791
  assumes "eqvt_at f x"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1792
  shows "eqvt_at f (q \<bullet> x)"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1793
proof -
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1794
  { fix p::"perm"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1795
    have "p \<bullet> (f (q \<bullet> x)) = p \<bullet> q \<bullet> (f x)"
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1796
      using assms by (simp add: eqvt_at_def)
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1797
    also have "\<dots> = (p + q) \<bullet> (f x)" by simp
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1798
    also have "\<dots> = f ((p + q) \<bullet> x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  1799
      using assms by (simp only: eqvt_at_def)
2955
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1800
    finally have "p \<bullet> (f (q \<bullet> x)) = f (p \<bullet> q \<bullet> x)" by simp } 
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1801
  then show "eqvt_at f (q \<bullet> x)" unfolding eqvt_at_def
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1802
    by simp
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1803
qed
4049a2651dd9 more on the NBE function
Christian Urban <urbanc@in.tum.de>
parents: 2948
diff changeset
  1804
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1805
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
  1806
  assumes a: "eqvt f"
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1807
  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
  1808
  using a
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1809
  unfolding eqvt_def
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1810
  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
  1811
  by simp
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1812
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1813
lemma fresh_fun_eqvt:
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1814
  assumes a: "eqvt f"
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1815
  shows "a \<sharp> f"
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1816
  using a
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1817
  unfolding fresh_def
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1818
  by (simp add: supp_fun_eqvt)
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1819
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1820
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
  1821
  assumes a: "eqvt f"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1822
  shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1823
proof -
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1824
  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
  1825
  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
  1826
    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
  1827
    using supp_fun_app by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1828
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1829
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
  1830
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
  1831
  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
  1832
  shows "supp (f x) \<subseteq> supp x"
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1833
  using fresh_fun_eqvt_app[OF a]
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1834
  unfolding fresh_def
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1835
  by auto
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1836
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1837
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
  1838
  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
  1839
  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
  1840
  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
  1841
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
  1842
unfolding supports_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1843
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
  1844
using asm
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1845
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
  1846
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
  1847
apply(rule fin)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1848
done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1849
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1850
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
  1851
  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
  1852
  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
  1853
  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
  1854
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
  1855
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
  1856
apply(rule fin)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1857
done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1858
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1859
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
  1860
  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
  1861
  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
  1862
  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
  1863
  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
  1864
using fresh
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1865
unfolding fresh_def
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1866
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
  1867
by auto
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1868
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1869
text {* for handling of freshness of functions *}
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1870
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1871
simproc_setup fresh_fun_simproc ("a \<sharp> (f::'a::pt \<Rightarrow>'b::pt)") = {* fn _ => fn ss => fn ctrm =>
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1872
  let 
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  1873
    val _ $ _ $ f = term_of ctrm
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1874
  in
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1875
    case (Term.add_frees f [], Term.add_vars f []) of
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1876
      ([], []) => SOME(@{thm fresh_fun_eqvt[simplified eqvt_def, THEN Eq_TrueI]})
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1877
    | (x::_, []) => let
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1878
         val thy = Proof_Context.theory_of (Simplifier.the_context ss)        
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1879
         val argx = Free x
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1880
         val absf = absfree x f
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1881
         val cty_inst = [SOME (ctyp_of thy (fastype_of argx)), SOME (ctyp_of thy (fastype_of f))]
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1882
         val ctrm_inst = [NONE, SOME (cterm_of thy absf), SOME (cterm_of thy argx)] 
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1883
         val thm = Drule.instantiate' cty_inst ctrm_inst @{thm fresh_fun_app}
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1884
      in
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1885
        SOME(thm RS @{thm Eq_TrueI}) 
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1886
      end  
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1887
    | (_, _) => NONE
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1888
  end
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  1889
*}
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
  1890
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  1891
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
  1892
2818
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1893
lemma THE_defaultI2:
2849
31c338d562fd tuned some proofs
Christian Urban <urbanc@in.tum.de>
parents: 2848
diff changeset
  1894
  assumes "\<exists>!x. P x" "\<And>x. P x \<Longrightarrow> Q x"
2818
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1895
  shows "Q (THE_default d P)"
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1896
by (iprover intro: assms THE_defaultI')
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1897
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1898
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
  1899
  assumes unique: "\<exists>!x. P x"
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1900
  shows "(p \<bullet> (THE_default d P)) = (THE_default (p \<bullet> d) (p \<bullet> P))"
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1901
  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
  1902
  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
  1903
  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
  1904
  apply(rule unique)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1905
  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
  1906
  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
  1907
  apply(simp)
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1908
  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
  1909
  done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1910
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1911
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
  1912
  fixes x::"'a::pt"
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1913
  assumes f_def: "f == (\<lambda>x::'a. THE_default (d x) (G x))"
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1914
  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
  1915
  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
  1916
  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
  1917
  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
  1918
  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
  1919
  apply(rule ex1)
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1920
  apply(rule THE_default1_equality [symmetric])
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1921
  apply(rule_tac p="-p" in permute_boolE)
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1922
  apply(perm_simp add: permute_minus_cancel)
2849
31c338d562fd tuned some proofs
Christian Urban <urbanc@in.tum.de>
parents: 2848
diff changeset
  1923
  using eqvt[simplified eqvt_def]
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1924
  apply(simp)
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1925
  apply(rule ex1)
2849
31c338d562fd tuned some proofs
Christian Urban <urbanc@in.tum.de>
parents: 2848
diff changeset
  1926
  apply(rule THE_defaultI2) 
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1927
  apply(rule_tac p="-p" in permute_boolE)
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1928
  apply(perm_simp add: permute_minus_cancel)
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1929
  apply(rule ex1)
2849
31c338d562fd tuned some proofs
Christian Urban <urbanc@in.tum.de>
parents: 2848
diff changeset
  1930
  apply(perm_simp)
31c338d562fd tuned some proofs
Christian Urban <urbanc@in.tum.de>
parents: 2848
diff changeset
  1931
  using eqvt[simplified eqvt_def]
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1932
  apply(simp)
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1933
  done
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1934
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1935
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
  1936
  fixes x::"'a::pt"
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1937
  assumes f_def: "f == (\<lambda>x::'a. THE_default (d x) (G x))"
2663
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1938
  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
  1939
  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
  1940
  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
  1941
  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
  1942
  using assms
54aade5d0fe6 moved high level code from LamTest into the main libraries.
Christian Urban <urbanc@in.tum.de>
parents: 2659
diff changeset
  1943
  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
  1944
2818
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1945
lemma fundef_ex1_prop:
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1946
  fixes x::"'a::pt"
2848
da7e6655cd4c fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents: 2847
diff changeset
  1947
  assumes f_def: "f == (\<lambda>x::'a. THE_default (d x) (G x))"
2820
77e1d9f2925e slightly stronger property in fundef_ex_prop
Christian Urban <urbanc@in.tum.de>
parents: 2818
diff changeset
  1948
  assumes P_all: "\<And>x y. G x y \<Longrightarrow> P x y"
2818
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1949
  assumes ex1: "\<exists>!y. G x y"
2820
77e1d9f2925e slightly stronger property in fundef_ex_prop
Christian Urban <urbanc@in.tum.de>
parents: 2818
diff changeset
  1950
  shows "P x (f x)"
2818
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1951
  unfolding f_def
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1952
  using ex1
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1953
  apply(erule_tac ex1E)
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1954
  apply(rule THE_defaultI2)
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1955
  apply(blast)
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1956
  apply(rule P_all)
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1957
  apply(assumption)
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1958
  done
8fe80e9f796d added a more general lemma fro fundef_ex1
Christian Urban <urbanc@in.tum.de>
parents: 2810
diff changeset
  1959
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  1960
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1961
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
  1962
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1963
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
  1964
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1965
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
  1966
  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
  1967
  assumes "finite S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1968
  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
  1969
  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
  1970
  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
  1971
  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
  1972
  apply(rule assms)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1973
  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
  1974
done
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1975
2742
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1976
lemma supp_cofinite_atom_set:
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1977
  fixes S::"atom set"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1978
  assumes "finite (UNIV - S)"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1979
  shows "supp S = (UNIV - S)"
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1980
  apply(rule finite_supp_unique)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1981
  apply(simp add: supports_def)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1982
  apply(simp add: swap_set_both_in)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1983
  apply(rule assms)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1984
  apply(subst swap_commute)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1985
  apply(simp add: swap_set_in)
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1986
done
f1192e3474e0 more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2735
diff changeset
  1987
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1988
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
  1989
  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
  1990
  assumes "finite S"
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1991
  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
  1992
  unfolding fresh_def
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  1993
  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
  1994
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1995
lemma fresh_minus_atom_set:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1996
  fixes S::"atom set"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1997
  assumes "finite S"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  1998
  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
  1999
  unfolding fresh_def
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2000
  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
  2001
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2002
lemma Union_supports_set:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2003
  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
  2004
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2005
  { fix a b
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2006
    have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
  2007
      unfolding permute_set_def by force
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2008
  }
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2009
  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
  2010
    unfolding supports_def 
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2011
    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
  2012
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2013
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2014
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
  2015
  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
  2016
  assumes fin: "finite S"   
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2017
  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
  2018
  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
  2019
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2020
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
  2021
  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
  2022
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2023
  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
  2024
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
  2025
  have eqvt: "eqvt (\<lambda>S. \<Union> supp ` S)" 
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2026
    unfolding eqvt_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
  2027
    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
  2028
  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
  2029
    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
  2030
  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
  2031
  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
  2032
    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
  2033
  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
  2034
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2035
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2036
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
  2037
  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
  2038
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2039
  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
  2040
apply(rule subset_antisym)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2041
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
  2042
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
  2043
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
  2044
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
  2045
done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2046
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2047
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
  2048
  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
  2049
  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
  2050
  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
  2051
using assms
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2052
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
  2053
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2054
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
  2055
  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
  2056
  assumes fin1: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2057
  and     fin2: "finite T"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2058
  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
  2059
  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
  2060
  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
  2061
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2062
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
  2063
  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
  2064
  assumes fin:  "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  2065
  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
  2066
  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
  2067
  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
  2068
2588
8f5420681039 completed the strong exhausts rules for Foo2 using general lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2587
diff changeset
  2069
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
  2070
  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
  2071
  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
  2072
  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
  2073
  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
  2074
  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
  2075
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2076
lemma supp_set_empty:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2077
  shows "supp {} = {}"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2078
  unfolding supp_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2079
  by (simp add: empty_eqvt)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2080
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2081
lemma fresh_set_empty:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2082
  shows "a \<sharp> {}"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2083
  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
  2084
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2085
lemma supp_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2086
  fixes xs :: "('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2087
  shows "supp (set xs) = supp xs"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2088
apply(induct xs)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2089
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
  2090
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
  2091
done
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2092
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2093
lemma fresh_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2094
  fixes xs :: "('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2095
  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
  2096
unfolding fresh_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2097
by (simp add: supp_set)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2098
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2099
3121
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2100
subsection {* Type @{typ "'a multiset"} is finitely supported *}
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2101
3197
25d11b449e92 definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents: 3195
diff changeset
  2102
lemma set_of_eqvt [eqvt]:
3121
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2103
  shows "p \<bullet> (set_of M) = set_of (p \<bullet> M)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2104
by (induct M) (simp_all add: insert_eqvt empty_eqvt)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2105
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2106
lemma supp_set_of:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2107
  shows "supp (set_of M) \<subseteq> supp M"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2108
  apply (rule supp_fun_app_eqvt)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2109
  unfolding eqvt_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2110
  apply(perm_simp)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2111
  apply(simp)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2112
  done
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2113
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2114
lemma Union_finite_multiset:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2115
  fixes M::"'a::fs multiset"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2116
  shows "finite (\<Union>{supp x | x. x \<in># M})"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2117
proof - 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2118
  have "finite (\<Union>(supp ` {x. x \<in># M}))"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2119
    by (induct M) (simp_all add: Collect_imp_eq Collect_neg_eq finite_supp)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2120
  then show "finite (\<Union>{supp x | x. x \<in># M})"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2121
    by (simp only: image_Collect)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2122
qed
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2123
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2124
lemma Union_supports_multiset:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2125
  shows "\<Union>{supp x | x. x :# M} supports M"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2126
proof -
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2127
  have sw: "\<And>a b. ((\<And>x. x :# M \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> x = x) \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> M = M)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2128
    unfolding permute_multiset_def 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2129
    apply(induct M)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2130
    apply(simp_all)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2131
    done
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2132
  show "(\<Union>{supp x | x. x :# M}) supports M"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2133
    unfolding supports_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2134
    apply(clarify)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2135
    apply(rule sw)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2136
    apply(rule swap_fresh_fresh)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2137
    apply(simp_all only: fresh_def)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2138
    apply(auto)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2139
    apply(metis neq0_conv)+
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2140
    done
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2141
qed
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2142
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2143
lemma Union_included_multiset:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2144
  fixes M::"('a::fs multiset)" 
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2145
  shows "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2146
proof -
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2147
  have "(\<Union>{supp x | x. x \<in># M}) = (\<Union>{supp x | x. x \<in> set_of M})" by simp
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2148
  also have "... \<subseteq> (\<Union>x \<in> set_of M. supp x)" by auto
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2149
  also have "... = supp (set_of M)" by (simp add: subst supp_of_finite_sets)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2150
  also have " ... \<subseteq> supp M" by (rule supp_set_of)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2151
  finally show "(\<Union>{supp x | x. x \<in># M}) \<subseteq> supp M" .
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2152
qed
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2153
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2154
lemma supp_of_multisets:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2155
  fixes M::"('a::fs multiset)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2156
  shows "(supp M) = (\<Union>{supp x | x. x :# M})"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2157
apply(rule subset_antisym)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2158
apply(rule supp_is_subset)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2159
apply(rule Union_supports_multiset)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2160
apply(rule Union_finite_multiset)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2161
apply(rule Union_included_multiset)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2162
done
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2163
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2164
lemma multisets_supp_finite:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2165
  fixes M::"('a::fs multiset)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2166
  shows "finite (supp M)"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2167
by (simp only: supp_of_multisets Union_finite_multiset)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2168
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2169
lemma supp_of_multiset_union:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2170
  fixes M N::"('a::fs) multiset"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2171
  shows "supp (M + N) = supp M \<union> supp N"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2172
  by (auto simp add: supp_of_multisets)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2173
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2174
lemma supp_empty_mset [simp]:
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2175
  shows "supp {#} = {}"
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2176
  unfolding supp_def
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2177
  by simp
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2178
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2179
instance multiset :: (fs) fs
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2180
  apply (default)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2181
  apply (rule multisets_supp_finite)
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2182
  done
878de0084b62 added fs and pt for multisets
Christian Urban <urbanc@in.tum.de>
parents: 3104
diff changeset
  2183
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2184
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
  2185
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2186
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
  2187
  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
  2188
  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
  2189
  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
  2190
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2191
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
  2192
  shows "supp {||} = {}"
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2193
  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
  2194
  by simp
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2195
2641
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2196
lemma fresh_empty_fset:
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2197
  shows "a \<sharp> {||}"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2198
unfolding fresh_def
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2199
by (simp)
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2200
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2201
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
  2202
  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
  2203
  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
  2204
  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
  2205
  apply(subst supp_fset[symmetric])
2587
78623a0f294b tuned proof to reduce number of warnings
Christian Urban <urbanc@in.tum.de>
parents: 2586
diff changeset
  2206
  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
  2207
  done
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2208
2641
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2209
lemma fresh_insert_fset:
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2210
  fixes x::"'a::fs"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2211
  and   S::"'a fset"
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2212
  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
  2213
  unfolding fresh_def
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2214
  by (simp)
592d17e26e09 some further lemmas for fsets
Christian Urban <urbanc@in.tum.de>
parents: 2635
diff changeset
  2215
2565
6bf332360510 moved most material fron Nominal2_FSet into the Nominal_Base theory
Christian Urban <urbanc@in.tum.de>
parents: 2560
diff changeset
  2216
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
  2217
  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
  2218
  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
  2219
  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
  2220
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
  2221
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
  2222
  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
  2223
  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
  2224
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
  2225
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  2226
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
  2227
  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
  2228
  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
  2229
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
  2230
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
  2231
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2232
instance fset :: (fs) fs
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2233
  apply (default)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2234
  apply (rule fset_finite_supp)
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2235
  done
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2236
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
  2237
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  2238
subsection {* Type @{typ "('a, 'b) finfun"} is finitely supported *}
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2239
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2240
lemma fresh_finfun_const:
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  2241
  shows "a \<sharp> (finfun_const b) \<longleftrightarrow> a \<sharp> b"
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2242
  by (simp add: fresh_def supp_def)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2243
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2244
lemma fresh_finfun_update:
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  2245
  shows "\<lbrakk>a \<sharp> f; a \<sharp> x; a \<sharp> y\<rbrakk> \<Longrightarrow> a \<sharp> finfun_update f x y"
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2246
  unfolding fresh_conv_MOST
3189
e46d4ee64221 added eqvt for finfun_apply
Christian Urban <urbanc@in.tum.de>
parents: 3188
diff changeset
  2247
  unfolding finfun_update_eqvt
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2248
  by (elim MOST_rev_mp) (simp)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2249
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2250
lemma supp_finfun_const:
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  2251
  shows "supp (finfun_const b) = supp(b)"
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2252
  by (simp add: supp_def)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2253
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2254
lemma supp_finfun_update:
3188
264253617b5e improved the finfun parts
Christian Urban <urbanc@in.tum.de>
parents: 3187
diff changeset
  2255
  shows "supp (finfun_update f x y) \<subseteq> supp(f, x, y)"
3187
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2256
using fresh_finfun_update
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2257
by (auto simp add: fresh_def supp_Pair)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2258
    
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2259
instance finfun :: (fs, fs) fs
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2260
  apply(default)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2261
  apply(induct_tac x rule: finfun_weak_induct)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2262
  apply(simp add: supp_finfun_const finite_supp)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2263
  apply(rule finite_subset)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2264
  apply(rule supp_finfun_update)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2265
  apply(simp add: supp_Pair finite_supp)
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2266
  done
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2267
b3d97424b130 added finfun-type to Nominal
Christian Urban <urbanc@in.tum.de>
parents: 3185
diff changeset
  2268
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2269
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
  2270
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2271
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
  2272
  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
  2273
  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
  2274
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2275
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
  2276
  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
  2277
  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
  2278
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2279
(* 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
  2280
(* 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
  2281
lemma [simp]:
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2282
  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
  2283
  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
  2284
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2285
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
  2286
  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
  2287
  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
  2288
  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
  2289
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2290
declaration {* fn _ =>
3051
a06de111c70e updated to Isabelle 26 Nov
Christian Urban <urbanc@in.tum.de>
parents: 3050
diff changeset
  2291
let
a06de111c70e updated to Isabelle 26 Nov
Christian Urban <urbanc@in.tum.de>
parents: 3050
diff changeset
  2292
  val mksimps_pairs = (@{const_name Nominal2_Base.fresh}, @{thms fresh_PairD}) :: mksimps_pairs
a06de111c70e updated to Isabelle 26 Nov
Christian Urban <urbanc@in.tum.de>
parents: 3050
diff changeset
  2293
in
a06de111c70e updated to Isabelle 26 Nov
Christian Urban <urbanc@in.tum.de>
parents: 3050
diff changeset
  2294
  Simplifier.map_ss (fn ss => Simplifier.set_mksimps (mksimps mksimps_pairs) ss)
a06de111c70e updated to Isabelle 26 Nov
Christian Urban <urbanc@in.tum.de>
parents: 3050
diff changeset
  2295
end
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2296
*}
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2297
3174
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2298
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2299
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
  2300
  induction principles. *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2301
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2302
definition 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2303
  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
  2304
where 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2305
  "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
  2306
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2307
lemma fresh_star_supp_conv:
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2308
  shows "supp x \<sharp>* y \<Longrightarrow> supp y \<sharp>* x"
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2309
by (auto simp add: fresh_star_def fresh_def)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2310
2675
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2311
lemma fresh_star_perm_set_conv:
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2312
  fixes p::"perm"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2313
  assumes fresh: "as \<sharp>* p"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2314
  and     fin: "finite as"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2315
  shows "supp p \<sharp>* as"
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2316
apply(rule fresh_star_supp_conv)
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2317
apply(simp add: supp_finite_atom_set fin fresh)
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2318
done
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2319
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2320
lemma fresh_star_atom_set_conv:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2321
  assumes fresh: "as \<sharp>* bs"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2322
  and     fin: "finite as" "finite bs"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2323
  shows "bs \<sharp>* as"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2324
using fresh
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2325
unfolding fresh_star_def fresh_def
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2326
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
  2327
2730
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2328
lemma atom_fresh_star_disjoint:
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2329
  assumes fin: "finite bs" 
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2330
  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
  2331
eebc24b9cf39 added a lemma about fresh_star and Abs
Christian Urban <urbanc@in.tum.de>
parents: 2708
diff changeset
  2332
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
  2333
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
  2334
2675
68ccf847507d defined properly substitution
Christian Urban <urbanc@in.tum.de>
parents: 2672
diff changeset
  2335
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2336
lemma fresh_star_Pair:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2337
  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
  2338
  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
  2339
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2340
lemma fresh_star_list:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2341
  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
  2342
  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
  2343
  and   "as \<sharp>* []"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2344
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
  2345
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2346
lemma fresh_star_set:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2347
  fixes xs::"('a::fs) list"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2348
  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
  2349
unfolding fresh_star_def
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2350
by (simp add: fresh_set)
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2351
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
  2352
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
  2353
  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
  2354
  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
  2355
  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
  2356
3d101f2f817c simple cases for strong inducts done; infrastructure for the difficult ones is there
Christian Urban <urbanc@in.tum.de>
parents: 2609
diff changeset
  2357
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
  2358
  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
  2359
  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
  2360
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
  2361
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2362
lemma fresh_star_Un:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2363
  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
  2364
  by (auto simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2365
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2366
lemma fresh_star_insert:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2367
  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
  2368
  by (auto simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2369
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2370
lemma fresh_star_Un_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2371
  "((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
  2372
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2373
  apply(rule)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2374
  apply(erule meta_mp)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2375
  apply(auto)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2376
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2377
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2378
lemma fresh_star_insert_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2379
  "(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
  2380
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2381
  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
  2382
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2383
lemma fresh_star_empty_elim:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2384
  "({} \<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
  2385
  by (simp add: fresh_star_def)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2386
2632
e8732350a29f added small example for strong inductions; functions still need a sorry
Christian Urban <urbanc@in.tum.de>
parents: 2614
diff changeset
  2387
lemma fresh_star_Unit_elim: 
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2388
  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
  2389
  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
  2390
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2391
lemma fresh_star_Pair_elim: 
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2392
  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
  2393
  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
  2394
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2395
lemma fresh_star_zero:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2396
  shows "as \<sharp>* (0::perm)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2397
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2398
  by (simp add: fresh_zero_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2399
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2400
lemma fresh_star_plus:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2401
  fixes p q::perm
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2402
  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
  2403
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2404
  by (simp add: fresh_plus_perm)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2405
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2406
lemma fresh_star_permute_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2407
  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
  2408
  unfolding fresh_star_def
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2409
  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
  2410
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
  2411
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
  2412
  shows "p \<bullet> (as \<sharp>* x) \<longleftrightarrow> (p \<bullet> as) \<sharp>* (p \<bullet> x)"
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2413
unfolding fresh_star_def by simp
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2414
2735
d97e04126a3d a bit more tuning
Christian Urban <urbanc@in.tum.de>
parents: 2733
diff changeset
  2415
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2416
section {* Induction principle for permutations *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2417
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2418
lemma smaller_supp:
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2419
  assumes a: "a \<in> supp p"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2420
  shows "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subset> supp p"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2421
proof -
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2422
  have "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subseteq> supp p"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2423
    unfolding supp_perm by (auto simp add: swap_atom)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2424
  moreover
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2425
  have "a \<notin> supp ((p \<bullet> a \<rightleftharpoons> a) + p)" by (simp add: supp_perm)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2426
  then have "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<noteq> supp p" using a by auto
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2427
  ultimately 
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2428
  show "supp ((p \<bullet> a \<rightleftharpoons> a) + p) \<subset> supp p" by auto
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2429
qed
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2430
  
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2431
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2432
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
  2433
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2434
  and zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2435
  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
  2436
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2437
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2438
  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
  2439
  then show "P p" using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2440
  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
  2441
    case (psubset p)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2442
    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
  2443
    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
  2444
    { assume "supp p = {}"
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  2445
      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
  2446
      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
  2447
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2448
    moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2449
    { assume "supp p \<noteq> {}"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2450
      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
  2451
      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
  2452
        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
  2453
      let ?q = "(p \<bullet> a \<rightleftharpoons> a) + p"
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2454
      have a2: "supp ?q \<subset> supp p" using a0 smaller_supp by simp
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2455
      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
  2456
      moreover
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2457
      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
  2458
      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
  2459
      moreover 
2732
9abc4a70540c some slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 2730
diff changeset
  2460
      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
  2461
      ultimately have "P p" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2462
    }
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2463
    ultimately show "P p" by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2464
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2465
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2466
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2467
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
  2468
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2469
  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
  2470
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2471
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
  2472
   (auto intro: zero swap)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2473
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
  2474
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
  2475
  assumes S: "supp p \<subseteq> S"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2476
  assumes zero: "P 0"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2477
  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
  2478
  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
  2479
  shows "P p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2480
using S
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2481
by (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2482
   (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
  2483
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
  2484
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
  2485
  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
  2486
  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
  2487
  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
  2488
  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
  2489
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
  2490
   (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
  2491
2679
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2492
lemma supp_perm_singleton:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2493
  fixes p::"perm"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2494
  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
  2495
proof -
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2496
  { assume "supp p \<subseteq> {b}"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2497
    then have "p = 0"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2498
      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
  2499
  }
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2500
  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
  2501
qed
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2502
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2503
lemma supp_perm_pair:
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2504
  fixes p::"perm"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2505
  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
  2506
proof -
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2507
  { assume "supp p \<subseteq> {a, b}"
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2508
    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
  2509
      apply (induct p rule: perm_struct_induct) 
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2510
      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
  2511
      apply (simp add: swap_commute)
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2512
      done
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2513
  }
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2514
  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
  2515
    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
  2516
qed
e003e5e36bae added Minimal file to test things
Christian Urban <urbanc@in.tum.de>
parents: 2675
diff changeset
  2517
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2518
lemma supp_perm_eq:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2519
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2520
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2521
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2522
  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
  2523
    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
  2524
  then show "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2525
  proof (induct p rule: perm_struct_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2526
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2527
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2528
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2529
    case (swap p a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2530
    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
  2531
    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
  2532
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2533
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2534
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2535
text {* same lemma as above, but proved with a different induction principle *}
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2536
lemma supp_perm_eq_test:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2537
  assumes "(supp x) \<sharp>* p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2538
  shows "p \<bullet> x = x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2539
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2540
  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
  2541
    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
  2542
  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
  2543
  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
  2544
    case zero
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2545
    show "0 \<bullet> x = x" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2546
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2547
    case (swap a b)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2548
    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
  2549
    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
  2550
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2551
    case (plus p1 p2)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2552
    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
  2553
    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
  2554
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2555
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2556
2591
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2557
lemma perm_supp_eq:
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2558
  assumes a: "(supp p) \<sharp>* x"
35c570891a3a isarfied some of the high-level proofs
Christian Urban <urbanc@in.tum.de>
parents: 2589
diff changeset
  2559
  shows "p \<bullet> x = x"
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2560
proof -
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2561
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2562
    unfolding supp_perm fresh_star_def fresh_def by auto
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2563
  then show "p \<bullet> x = x"
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2564
  proof (induct p rule: perm_struct_induct2)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2565
    case zero
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2566
    show "0 \<bullet> x = x" by simp
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2567
  next
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2568
    case (swap a b)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2569
    then have "a \<sharp> x" "b \<sharp> x" by simp_all
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2570
    then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2571
  next
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2572
    case (plus p1 p2)
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2573
    have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2574
    then show "(p1 + p2) \<bullet> x = x" by simp
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2575
  qed
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2576
qed
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  2577
3065
51ef8a3cb6ef updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents: 3051
diff changeset
  2578
51ef8a3cb6ef updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents: 3051
diff changeset
  2579
51ef8a3cb6ef updated to lates changes in the datatype package
Christian Urban <urbanc@in.tum.de>
parents: 3051
diff changeset
  2580
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2581
lemma supp_perm_perm_eq:
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2582
  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
  2583
  shows "p \<bullet> x = q \<bullet> x"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2584
proof -
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2585
  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
  2586
  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
  2587
    unfolding supp_perm by simp
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2588
  then have "supp x \<sharp>* (-q + p)"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2589
    unfolding fresh_star_def fresh_def by simp
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2590
  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
  2591
  then show "p \<bullet> x = q \<bullet> x"
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2592
    by (metis permute_minus_cancel permute_plus)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2593
qed
2907
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2594
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2595
text {* disagreement set *}
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2596
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2597
definition
2908
ad426ba60606 renamed ds to dset (disagreement set)
Christian Urban <urbanc@in.tum.de>
parents: 2907
diff changeset
  2598
  dset :: "perm \<Rightarrow> perm \<Rightarrow> atom set"
2907
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2599
where
2908
ad426ba60606 renamed ds to dset (disagreement set)
Christian Urban <urbanc@in.tum.de>
parents: 2907
diff changeset
  2600
  "dset p q = {a::atom. p \<bullet> a \<noteq> q \<bullet> a}"
2907
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2601
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2602
lemma ds_fresh:
2908
ad426ba60606 renamed ds to dset (disagreement set)
Christian Urban <urbanc@in.tum.de>
parents: 2907
diff changeset
  2603
  assumes "dset p q \<sharp>* x"
2907
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2604
  shows "p \<bullet> x = q \<bullet> x"
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2605
using assms
2908
ad426ba60606 renamed ds to dset (disagreement set)
Christian Urban <urbanc@in.tum.de>
parents: 2907
diff changeset
  2606
unfolding dset_def fresh_star_def fresh_def
2907
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2607
by (auto intro: supp_perm_perm_eq)
9096338a7985 added small lemma about disagreement set
Christian Urban <urbanc@in.tum.de>
parents: 2900
diff changeset
  2608
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2609
lemma atom_set_perm_eq:
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2610
  assumes a: "as \<sharp>* p"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2611
  shows "p \<bullet> as = as"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2612
proof -
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2613
  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
  2614
    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
  2615
  then show "p \<bullet> as = as"
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2616
  proof (induct p rule: perm_struct_induct)
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2617
    case zero
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2618
    show "0 \<bullet> as = as" by simp
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2619
  next
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2620
    case (swap p a b)
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2621
    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
  2622
    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
  2623
  qed
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2624
qed
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2625
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2626
section {* Avoiding of atom sets *}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2627
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2628
text {* 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2629
  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
  2630
  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
  2631
  which 'translates' between both sets.
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2632
*}
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2633
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2634
lemma at_set_avoiding_aux:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2635
  fixes Xs::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2636
  and   As::"atom set"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2637
  assumes b: "Xs \<subseteq> As"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2638
  and     c: "finite As"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2639
  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
  2640
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2641
  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
  2642
  then show ?thesis using b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2643
  proof (induct rule: finite_subset_induct)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2644
    case empty
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2645
    have "0 \<bullet> {} \<inter> As = {}" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2646
    moreover
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2647
    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
  2648
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2649
  next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2650
    case (insert x Xs)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2651
    then obtain p where
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2652
      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
  2653
      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
  2654
    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
  2655
    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
  2656
    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
  2657
    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
  2658
      using `finite As` `finite Xs`
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2659
      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
  2660
    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
  2661
      by (rule obtain_atom)
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2662
    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
  2663
      by simp_all
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2664
    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
  2665
      by (auto simp add: supp_perm)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2666
    let ?q = "(x \<rightleftharpoons> y) + p"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2667
    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
  2668
      unfolding insert_eqvt
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2669
      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
  2670
      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
  2671
      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
  2672
    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
  2673
      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
  2674
      unfolding q by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2675
    moreover
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2676
    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
  2677
      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
  2678
    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
  2679
      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
  2680
    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
  2681
      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
  2682
      by auto
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2683
    ultimately show ?case by blast
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2684
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2685
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2686
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2687
lemma at_set_avoiding:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2688
  assumes a: "finite Xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2689
  and     b: "finite (supp c)"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2690
  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
  2691
  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
  2692
  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
  2693
2589
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2694
lemma at_set_avoiding1:
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2695
  assumes "finite xs"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2696
  and     "finite (supp c)"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2697
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c"
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2698
using assms
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2699
apply(erule_tac c="c" in at_set_avoiding)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2700
apply(auto)
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2701
done
9781db0e2196 completed proofs in Foo2
Christian Urban <urbanc@in.tum.de>
parents: 2588
diff changeset
  2702
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2703
lemma at_set_avoiding2:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2704
  assumes "finite xs"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2705
  and     "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2706
  and     "xs \<sharp>* x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2707
  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
  2708
using assms
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2709
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
  2710
apply(simp add: supp_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2711
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
  2712
apply(simp add: fresh_star_Pair)
2507
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2713
apply(rule fresh_star_supp_conv)
f5621efe5a20 changed to llncs
Christian Urban <urbanc@in.tum.de>
parents: 2479
diff changeset
  2714
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
  2715
done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2716
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2717
lemma at_set_avoiding3:
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2718
  assumes "finite xs"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2719
  and     "finite (supp c)" "finite (supp x)"
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2720
  and     "xs \<sharp>* x"
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2721
  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
  2722
using assms
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2723
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
  2724
apply(simp add: supp_Pair)
3ebc7ecfb0dd disabled the Foo examples, because of heavy work
Christian Urban <urbanc@in.tum.de>
parents: 2573
diff changeset
  2725
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
  2726
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
  2727
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
  2728
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
  2729
done
2573
6c131c089ce2 added example Foo2.thy
Christian Urban <urbanc@in.tum.de>
parents: 2568
diff changeset
  2730
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2731
lemma at_set_avoiding2_atom:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2732
  assumes "finite (supp c)" "finite (supp x)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2733
  and     b: "a \<sharp> x"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2734
  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
  2735
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2736
  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
  2737
  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
  2738
    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
  2739
  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
  2740
    unfolding fresh_star_def Ball_def 
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
  2741
    by(erule_tac x="p \<bullet> a" in allE) (simp add: permute_set_def)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2742
  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
  2743
  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
  2744
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2745
2614
0d7a1703fe28 a stronger statement for at_set_avoiding
Christian Urban <urbanc@in.tum.de>
parents: 2611
diff changeset
  2746
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2747
section {* Renaming permutations *}
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2748
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2749
lemma set_renaming_perm:
2659
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2750
  assumes b: "finite bs"
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2751
  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
  2752
using b
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2753
proof (induct)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2754
  case empty
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2755
  have "(\<forall>b \<in> {}. 0 \<bullet> b = p \<bullet> b) \<and> supp (0::perm) \<subseteq> {} \<union> p \<bullet> {}"
3104
f7c4b8e6918b updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents: 3101
diff changeset
  2756
    by (simp add: permute_set_def supp_perm)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2757
  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
  2758
next
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2759
  case (insert a bs)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2760
  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
  2761
  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
  2762
    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
  2763
  { 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
  2764
    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
  2765
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2766
    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
  2767
      using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2768
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2769
    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
  2770
  }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2771
  moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2772
  { 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
  2773
    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
  2774
    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
  2775
      by (auto simp add: swap_atom)
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2776
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2777
    { 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
  2778
	using ** 
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2779
	apply (auto simp add: supp_perm insert_eqvt)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2780
	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
  2781
	apply(auto)[1]
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2782
	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
  2783
	apply(blast)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2784
	apply(simp)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2785
	done
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2786
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> insert a bs \<union> p \<bullet> insert a bs" 
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2787
        unfolding supp_swap by auto
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2788
      moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2789
      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
  2790
	using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2791
      ultimately 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2792
      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
  2793
        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
  2794
    }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2795
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2796
    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
  2797
  }
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2798
  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
  2799
    by blast
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2800
qed
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2801
2672
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2802
lemma set_renaming_perm2:
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2803
  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
  2804
proof -
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2805
  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
  2806
  then obtain q 
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2807
    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
  2808
    using set_renaming_perm by blast
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2809
  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
  2810
  moreover
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2811
  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
  2812
    apply(auto)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2813
    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
  2814
    apply(simp add: fresh_def[symmetric])
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2815
    apply(simp add: fresh_perm)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2816
    apply(clarify)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2817
    apply(rotate_tac 2)
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2818
    apply(drule subsetD[OF **])
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2819
    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
  2820
    done
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2821
  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
  2822
  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
  2823
qed
7e7662890477 removed finiteness assumption from set_rename_perm
Christian Urban <urbanc@in.tum.de>
parents: 2669
diff changeset
  2824
    
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2825
lemma list_renaming_perm:
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2826
  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
  2827
proof (induct bs)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2828
  case (Cons a bs)
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2829
  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
  2830
  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
  2831
    by (blast)
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2832
  { assume 1: "a \<in> set bs"
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2833
    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
  2834
    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
  2835
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2836
    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
  2837
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2838
    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
  2839
  }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2840
  moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2841
  { assume 2: "a \<notin> set bs"
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2842
    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
  2843
    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
  2844
      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
  2845
    moreover 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2846
    { 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
  2847
	using **
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2848
	apply (auto simp add: supp_perm insert_eqvt)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2849
	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
  2850
	apply(auto)[1]
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2851
	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
  2852
	apply(blast)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2853
	apply(simp)
619ecb57db38 strengthened renaming lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2657
diff changeset
  2854
	done
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2855
      then have "supp (q \<bullet> a \<rightleftharpoons> p \<bullet> a) \<subseteq> set (a # bs) \<union> p \<bullet> set (a # bs)" 
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  2856
        unfolding supp_swap by auto
2599
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2857
      moreover
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2858
      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
  2859
	using ** by (auto simp add: insert_eqvt)
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2860
      ultimately 
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2861
      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
  2862
        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
  2863
    }
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2864
    ultimately 
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2865
    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
  2866
  }
2668
92c001d93225 modified the renaming_perm lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2663
diff changeset
  2867
  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
  2868
    by blast
2771
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2869
next
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2870
 case Nil
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2871
  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
  2872
    by (simp add: supp_zero_perm)
66ef2a2c64fb more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents: 2760
diff changeset
  2873
  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
  2874
qed
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2875
d6fe94028a5d moved general theorems into the libraries
Christian Urban <urbanc@in.tum.de>
parents: 2591
diff changeset
  2876
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  2877
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
  2878
1972
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2879
text {*
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2880
  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
  2881
  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
  2882
*}
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  2883
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
  2884
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
  2885
  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
  2886
  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
  2887
  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
  2888
3197
25d11b449e92 definition of an auxiliary graph in nominal-primrec definitions
Christian Urban <urbanc@in.tum.de>
parents: 3195
diff changeset
  2889
declare atom_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
  2890
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
  2891
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
  2892
  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
  2893
2900
d66430c7c4f1 an alternative FCB for Abs_lst1; seems simpler but not as simple as I thought; not sure whether it generalises to multiple binders.
Christian Urban <urbanc@in.tum.de>
parents: 2891
diff changeset
  2894
lemma sort_ineq [simp]:
d66430c7c4f1 an alternative FCB for Abs_lst1; seems simpler but not as simple as I thought; not sure whether it generalises to multiple binders.
Christian Urban <urbanc@in.tum.de>
parents: 2891
diff changeset
  2895
  assumes "sort_of (atom a) \<noteq> sort_of (atom b)"
d66430c7c4f1 an alternative FCB for Abs_lst1; seems simpler but not as simple as I thought; not sure whether it generalises to multiple binders.
Christian Urban <urbanc@in.tum.de>
parents: 2891
diff changeset
  2896
  shows "atom a \<noteq> atom b"
d66430c7c4f1 an alternative FCB for Abs_lst1; seems simpler but not as simple as I thought; not sure whether it generalises to multiple binders.
Christian Urban <urbanc@in.tum.de>
parents: 2891
diff changeset
  2897
using assms by metis
d66430c7c4f1 an alternative FCB for Abs_lst1; seems simpler but not as simple as I thought; not sure whether it generalises to multiple binders.
Christian Urban <urbanc@in.tum.de>
parents: 2891
diff changeset
  2898
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
  2899
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
  2900
  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
  2901
  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
  2902
  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
  2903
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
  2904
lemma fresh_at_base: 
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2905
  shows  "sort_of a \<noteq> sort_of (atom b) \<Longrightarrow> a \<sharp> b"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2906
  and "a \<sharp> b \<longleftrightarrow> a \<noteq> atom b"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2907
  unfolding fresh_def 
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2908
  apply(simp_all add: supp_at_base)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2909
  apply(metis)
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  2910
  done
3185
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2911
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2912
(* solves the freshness only if the inequality can be shown by the
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2913
   simproc below *)  
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2914
lemma fresh_ineq_at_base [simp]:
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2915
  shows "a \<noteq> atom b \<Longrightarrow> a \<sharp> b"
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2916
  by (simp add: fresh_at_base)
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2917
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2918
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2919
lemma fresh_atom_at_base [simp]: 
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
  2920
  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
  2921
  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
  2922
  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
  2923
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
  2924
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
  2925
  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
  2926
  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
  2927
  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
  2928
3174
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2929
lemma if_fresh_at_base [simp]:
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2930
  shows "atom a \<sharp> x \<Longrightarrow> P (if a = x then t else s) = P s"
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2931
  and   "atom a \<sharp> x \<Longrightarrow> P (if x = a then t else s) = P s"
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2932
by (simp_all add: fresh_at_base)
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2933
3185
3641530002d6 added a rule about inequality of freshness between atoms to the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 3184
diff changeset
  2934
3174
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2935
simproc_setup fresh_ineq ("x \<noteq> (y::'a::at_base)") = {* fn _ => fn ss => fn ctrm =>
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2936
  let
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2937
    fun first_is_neg lhs rhs [] = NONE
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2938
      | first_is_neg lhs rhs (thm::thms) =
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2939
          (case Thm.prop_of thm of
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2940
             _ $ (@{term "HOL.Not"} $ (Const ("HOL.eq", _) $ l $ r)) =>
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2941
               (if l = lhs andalso r = rhs then SOME(thm)
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2942
                else if r = lhs andalso l = rhs then SOME(thm RS @{thm not_sym})
3176
31372760c2fb fixed bug in simproc (also in the exec-version)
Christian Urban <urbanc@in.tum.de>
parents: 3175
diff changeset
  2943
                else first_is_neg lhs rhs thms)  
3174
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2944
           | _ => first_is_neg lhs rhs thms)
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2945
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2946
    val simp_thms = @{thms fresh_Pair fresh_at_base atom_eq_iff}
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2947
    val prems = Simplifier.prems_of ss
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2948
      |> filter (fn thm => case Thm.prop_of thm of                    
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2949
           _ $ (Const (@{const_name fresh}, _) $ _ $ _) => true | _ => false)
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2950
      |> map (simplify (HOL_basic_ss addsimps simp_thms))
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2951
      |> map HOLogic.conj_elims
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2952
      |> flat
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2953
  in 
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2954
    case term_of ctrm of
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2955
      @{term "HOL.Not"} $ (Const ("HOL.eq", _) $ lhs $ rhs) => 
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2956
         (case first_is_neg lhs rhs prems of
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2957
            SOME(thm) => SOME(thm RS @{thm Eq_TrueI})
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2958
          | NONE => NONE)
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2959
    | _ => NONE
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2960
  end
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2961
*}
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2962
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  2963
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
  2964
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
  2965
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
  2966
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
  2967
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
  2968
  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
  2969
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
  2970
  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
  2971
  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
  2972
  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
  2973
    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
  2974
  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
  2975
    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
  2976
  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
  2977
    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
  2978
    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
  2979
  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
  2980
  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
  2981
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
  2982
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
  2983
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
  2984
  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
  2985
  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
  2986
  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
  2987
  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
  2988
  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
  2989
  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
  2990
  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
  2991
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
  2992
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
  2993
  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
  2994
  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
  2995
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
  2996
  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
  2997
    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
  2998
  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
  2999
    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
  3000
  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
  3001
    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
  3002
  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
  3003
    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
  3004
  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
  3005
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
  3006
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3007
lemma obtain_fresh':
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3008
  assumes fin: "finite (supp x)"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3009
  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
  3010
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
  3011
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
  3012
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3013
lemma obtain_fresh:
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3014
  fixes x::"'b::fs"
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3015
  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
  3016
  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
  3017
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1972
diff changeset
  3018
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
  3019
  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
  3020
  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
  3021
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
  3022
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
  3023
apply(auto)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  3024
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
  3025
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
  3026
(* 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
  3027
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
  3028
  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
  3029
  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
  3030
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
  3031
*)
7085ab735de7 equivariance for All and Ex can be proved in terms of their definition
Christian Urban <urbanc@in.tum.de>
parents: 2742
diff changeset
  3032
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  3033
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
  3034
  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
  3035
  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
  3036
  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
  3037
  unfolding fresh_def
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  3038
  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
  3039
  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
  3040
  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
  3041
  apply(simp)
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  3042
  done
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  3043
2776
8e0f0b2b51dd more on pearl-paper
Christian Urban <urbanc@in.tum.de>
parents: 2771
diff changeset
  3044
lemma fresh_at_base_permute_iff [simp]:
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  3045
  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
  3046
  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
  3047
  unfolding atom_eqvt[symmetric]
3183
313e6f2cdd89 added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents: 3180
diff changeset
  3048
  by (simp only: fresh_permute_iff)
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  3049
2657
1ea9c059fc0f a few lemmas about freshness for at and at_base
Christian Urban <urbanc@in.tum.de>
parents: 2641
diff changeset
  3050
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3051
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
  3052
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3053
definition
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3054
  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
  3055
where
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3056
  "(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
  3057
3191
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3058
lemma flip_fresh_fresh:
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3059
  assumes "atom a \<sharp> x" "atom b \<sharp> x"
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3060
  shows "(a \<leftrightarrow> b) \<bullet> x = x"
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3061
using assms
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3062
by (simp add: flip_def swap_fresh_fresh)
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3063
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3064
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
  3065
  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
  3066
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3067
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
  3068
  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
  3069
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3070
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
  3071
  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
  3072
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3073
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
  3074
  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
  3075
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3076
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
  3077
  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
  3078
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3079
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
  3080
  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
  3081
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
  3082
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
  3083
  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
  3084
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3085
  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
  3086
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3087
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
  3088
  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
  3089
  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
  3090
  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
  3091
  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
  3092
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3093
  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
  3094
  unfolding atom_eqvt [symmetric]
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3095
  by simp_all
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3096
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3097
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
  3098
  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
  3099
3191
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3100
lemma flip_triple:
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3101
  fixes a b c::"'a::at"
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3102
  assumes "a \<noteq> b" and "c \<noteq> b"
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3103
  shows "(a \<leftrightarrow> c) + (b \<leftrightarrow> c) + (a \<leftrightarrow> c) = (a \<leftrightarrow> b)"
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3104
  unfolding flip_def
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3105
  by (rule swap_triple) (simp_all add: assms)
0440bc1a2438 streamlined definition of alpha-equivalence for single binders (used flip instead of swap)
Christian Urban <urbanc@in.tum.de>
parents: 3189
diff changeset
  3106
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3107
lemma permute_flip_at:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3108
  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
  3109
  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
  3110
  unfolding flip_def
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3111
  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
  3112
  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
  3113
  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
  3114
  done
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3115
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3116
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
  3117
  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
  3118
  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
  3119
  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
  3120
  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
  3121
2683
42c0d011a177 ported some of the old proofs to serve as testcases
Christian Urban <urbanc@in.tum.de>
parents: 2679
diff changeset
  3122
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3123
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
  3124
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3125
syntax
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3126
  "_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
  3127
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3128
translations
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3129
  "_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
  3130
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3131
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3132
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
  3133
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3134
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
  3135
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
  3136
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3137
text {*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3138
  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
  3139
*}
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3140
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3141
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
  3142
  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
  3143
  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
  3144
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3145
lemma exists_eq_sort: 
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3146
  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
  3147
  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
  3148
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3149
lemma at_base_class:
2847
Christian Urban <urbanc@in.tum.de>
parents: 2820
diff changeset
  3150
  fixes sort_fun :: "'b \<Rightarrow> atom_sort"
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3151
  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
  3152
  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
  3153
  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
  3154
  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
  3155
  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
  3156
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3157
  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
  3158
  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
  3159
  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
  3160
  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
  3161
    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
  3162
  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
  3163
    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
  3164
  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
  3165
    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
  3166
  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
  3167
    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
  3168
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3169
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3170
(*
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3171
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3172
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3173
  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
  3174
  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
  3175
  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
  3176
  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
  3177
  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
  3178
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3179
  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
  3180
  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
  3181
  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
  3182
  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
  3183
    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
  3184
  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
  3185
    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
  3186
  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
  3187
    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
  3188
  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
  3189
    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
  3190
  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
  3191
    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
  3192
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3193
*)
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3194
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3195
lemma at_class:
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3196
  fixes s :: atom_sort
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3197
  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
  3198
  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
  3199
  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
  3200
  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
  3201
  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
  3202
proof
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3203
  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
  3204
  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
  3205
  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
  3206
  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
  3207
    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
  3208
  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
  3209
    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
  3210
  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
  3211
    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
  3212
  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
  3213
    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
  3214
  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
  3215
    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
  3216
qed
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3217
2891
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3218
lemma at_class_sort:
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3219
  fixes s :: atom_sort
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3220
  fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3221
  fixes a::"'a"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3222
  assumes type: "type_definition Rep Abs {a. sort_of a = s}"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3223
  assumes atom_def: "\<And>a. atom a = Rep a"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3224
  shows "sort_of (atom a) = s"
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3225
  using atom_def type
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3226
  unfolding type_definition_def by simp
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3227
304dfe6cc83a the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
parents: 2868
diff changeset
  3228
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3229
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
  3230
  (@{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
  3231
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
  3232
  (@{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
  3233
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3234
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3235
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3236
section {* Library functions for the nominal infrastructure *}
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3237
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3238
use "nominal_library.ML"
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3239
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3240
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3241
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3242
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
  3243
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3244
lemma freshness_lemma:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3245
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3246
  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
  3247
  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
  3248
proof -
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3249
  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
  3250
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3251
  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
  3252
  proof (intro exI allI impI)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3253
    fix a :: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3254
    assume a3: "atom a \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3255
    show "h a = h b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3256
    proof (cases "a = b")
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3257
      assume "a = b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3258
      thus "h a = h b" by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3259
    next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3260
      assume "a \<noteq> b"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3261
      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
  3262
      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
  3263
        by (rule fresh_fun_app)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3264
      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
  3265
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3266
      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
  3267
        by (rule swap_fresh_fresh)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3268
      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
  3269
      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
  3270
        by (rule permute_fun_app_eq)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3271
      also have "\<dots> = h a"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3272
        using d2 by simp
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3273
      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
  3274
    qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3275
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3276
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3277
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3278
lemma freshness_lemma_unique:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3279
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3280
  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
  3281
  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
  3282
proof (rule ex_ex1I)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3283
  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
  3284
    by (rule freshness_lemma)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3285
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3286
  fix x y
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3287
  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
  3288
  assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
3174
8f51702e1f2e improved handling in the simplifier for inequalities derived from freshness assumptions
Christian Urban <urbanc@in.tum.de>
parents: 3167
diff changeset
  3289
  from a x y show "x = y" 
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3290
    by (auto simp add: fresh_Pair)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3291
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3292
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3293
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
  3294
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3295
definition
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3296
  Fresh :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3297
where
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3298
  "Fresh h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3299
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3300
lemma Fresh_apply:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3301
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3302
  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
  3303
  assumes b: "atom a \<sharp> h"
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3304
  shows "Fresh h = h a"
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3305
unfolding Fresh_def
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3306
proof (rule the_equality)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3307
  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
  3308
  proof (intro strip)
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3309
    fix a':: 'a
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3310
    assume c: "atom a' \<sharp> h"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3311
    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
  3312
    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
  3313
  qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3314
next
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3315
  fix fr :: 'b
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3316
  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
  3317
  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
  3318
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3319
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3320
lemma Fresh_apply':
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3321
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3322
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3323
  shows "Fresh h = h a"
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3324
  apply (rule Fresh_apply)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3325
  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
  3326
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3327
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3328
lemma "1 = 1 &&& 2 = 2"
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3329
apply(tactic {* ALLGOALS (asm_full_simp_tac @{simpset}) *})
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3330
done
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3331
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3332
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3333
simproc_setup Fresh_simproc ("Fresh (h::'a::at \<Rightarrow> 'b::pt)") = {* fn _ => fn ss => fn ctrm =>
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3334
  let
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3335
     val ctxt = Simplifier.the_context ss
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3336
     val _ $ h = term_of ctrm
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3337
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3338
     val cfresh = @{const_name fresh}
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3339
     val catom  = @{const_name atom}
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3340
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3341
     val atoms = Simplifier.prems_of ss
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3342
      |> map_filter (fn thm => case Thm.prop_of thm of                    
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3343
           _ $ (Const (cfresh, _) $ (Const (catom, _) $ atm) $ _) => SOME (atm) | _ => NONE)
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3344
      |> distinct (op=)
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3345
     
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3346
     fun get_thm atm = 
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3347
       let
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3348
         val goal1 = HOLogic.mk_Trueprop (mk_fresh (mk_atom atm) h)
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3349
         val goal2 = HOLogic.mk_Trueprop (mk_fresh (mk_atom atm) (h $ atm))
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3350
 
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3351
         val thm1 = Goal.prove ctxt [] [] goal1 (K (asm_simp_tac ss 1)) 
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3352
         val thm2 = Goal.prove ctxt [] [] goal2 (K (asm_simp_tac ss 1)) 
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3353
       in
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3354
         SOME (@{thm Fresh_apply'} OF [thm1, thm2] RS eq_reflection)
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3355
       end handle ERROR _ => NONE
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3356
  in
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3357
    get_first get_thm atoms
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3358
  end
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3359
*}
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3360
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3361
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3362
lemma Fresh_eqvt:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3363
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3364
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3365
  shows "p \<bullet> (Fresh h) = Fresh (p \<bullet> h)"
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3366
proof -
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3367
  from a obtain a::"'a::at" where fr: "atom a \<sharp> h" "atom a \<sharp> h a"
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3368
    by (metis fresh_Pair)
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3369
  then have fr_p: "atom (p \<bullet> a) \<sharp> (p \<bullet> h)" "atom (p \<bullet> a) \<sharp> (p \<bullet> h) (p \<bullet> a)"
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3370
    by (metis atom_eqvt fresh_permute_iff eqvt_apply)+
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3371
  have "p \<bullet> (Fresh h) = p \<bullet> (h a)" using fr by simp
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3372
  also have "... = (p \<bullet> h) (p \<bullet> a)" by simp
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3373
  also have "... = Fresh (p \<bullet> h)" using fr_p by simp
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3374
  finally show "p \<bullet> (Fresh h) = Fresh (p \<bullet> h)" .
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3375
qed
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3376
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3377
lemma Fresh_supports:
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3378
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3379
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3380
  shows "(supp h) supports (Fresh h)"
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3381
  apply (simp add: supports_def fresh_def [symmetric])
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3382
  apply (simp add: Fresh_eqvt [OF a] swap_fresh_fresh)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3383
  done
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3384
3178
a331468b2f5a renamed fresh_fun to Fresh; added a simproc that deals with freshness of functions
Christian Urban <urbanc@in.tum.de>
parents: 3176
diff changeset
  3385
notation Fresh (binder "FRESH " 10)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3386
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3387
lemma FRESH_f_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3388
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3389
  fixes f :: "'b \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3390
  assumes P: "finite (supp P)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3391
  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
  3392
proof -
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3393
  obtain a::'a where "atom a \<sharp> P" using P by (rule obtain_fresh')
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3394
  then show "(FRESH x. f (P x)) = f (FRESH x. P x)"
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3395
    by (simp add: pure_fresh)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3396
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3397
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3398
lemma FRESH_binop_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3399
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3400
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3401
  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
  3402
  assumes P: "finite (supp P)" 
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3403
  and     Q: "finite (supp Q)"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3404
  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
  3405
proof -
2685
1df873b63cb2 added obtain_fresh lemma; tuned Lambda.thy
Christian Urban <urbanc@in.tum.de>
parents: 2683
diff changeset
  3406
  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
  3407
  then obtain a::'a where "atom a \<sharp> (P, Q)" by (rule obtain_fresh') 
3184
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3408
  then show ?thesis
ae1defecd8c0 a simproc for simplifying Fresh when there is a sufficiently fresh atom
Christian Urban <urbanc@in.tum.de>
parents: 3183
diff changeset
  3409
    by (simp add: pure_fresh)
2470
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3410
qed
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3411
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3412
lemma FRESH_conj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3413
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3414
  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
  3415
  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
  3416
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
  3417
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3418
lemma FRESH_disj_iff:
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3419
  fixes P Q :: "'a::at \<Rightarrow> bool"
bdb1eab47161 moved everything out of Nominal_Supp
Christian Urban <urbanc@in.tum.de>
parents: 2467
diff changeset
  3420
  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
  3421
  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
  3422
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
  3423
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3424
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
  3425
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3426
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
  3427
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3428
use "nominal_atoms.ML"
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3429
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
  3430
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
  3431
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
  3432
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  3433
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
  3434
5f6fefdbf055 split the library into a basics file; merged Nominal_Eqvt into Nominal_Base
Christian Urban <urbanc@in.tum.de>
parents: 2732
diff changeset
  3435
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  3436
2948
b0b2adafb6d2 made the tests go through again
Christian Urban <urbanc@in.tum.de>
parents: 2908
diff changeset
  3437
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  3438
end