Nominal-General/Nominal2_Base.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 04 Sep 2010 05:43:03 +0800
changeset 2466 47c840599a6b
parent 2378 2f13fe48c877
child 2467 67b3933c3190
permissions -rw-r--r--
cleaned a bit various thy-files in Nominal-General
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     1
(*  Title:      Nominal2_Base
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     2
    Authors:    Brian Huffman, Christian Urban
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     3
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     4
    Basic definitions and lemma infrastructure for 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     5
    Nominal Isabelle. 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     6
*)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     7
theory Nominal2_Base
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     8
imports Main Infinite_Set
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
     9
uses ("nominal_library.ML")
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    10
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    11
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    12
section {* Atoms and Sorts *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    13
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    14
text {* A simple implementation for atom_sorts is strings. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    15
(* types atom_sort = string *)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    16
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    17
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
    18
  strings as sorts. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    19
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    20
datatype atom_sort = Sort "string" "atom_sort list"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    21
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    22
datatype atom = Atom atom_sort nat
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
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    25
text {* Basic projection function. *}
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
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    28
  sort_of :: "atom \<Rightarrow> atom_sort"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    29
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    30
  "sort_of (Atom s i) = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    31
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    32
primrec
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    33
  nat_of :: "atom \<Rightarrow> nat"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    34
where
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    35
  "nat_of (Atom s n) = n"
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    36
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    37
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    38
text {* There are infinitely many atoms of each sort. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    39
lemma INFM_sort_of_eq: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    40
  shows "INFM a. sort_of a = s"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    41
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    42
  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
    43
  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
    44
  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
    45
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    46
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    47
lemma infinite_sort_of_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    48
  shows "infinite {a. sort_of a = s}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    49
  using INFM_sort_of_eq unfolding INFM_iff_infinite .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    50
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    51
lemma atom_infinite [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    52
  shows "infinite (UNIV :: atom set)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    53
  using subset_UNIV infinite_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    54
  by (rule infinite_super)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    55
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    56
lemma obtain_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    57
  fixes X :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    58
  assumes X: "finite X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    59
  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
    60
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    61
  from X have "MOST a. a \<notin> X"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    62
    unfolding MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    63
  with INFM_sort_of_eq
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    64
  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
    65
    by (rule INFM_conjI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    66
  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
    67
    by (auto elim: INFM_E)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    68
  then show ?thesis ..
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    69
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    70
1930
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    71
lemma atom_components_eq_iff:
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    72
  fixes a b :: atom
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    73
  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
    74
  by (induct a, induct b, simp)
f189cf2c0987 moved some lemmas into the right places
Christian Urban <urbanc@in.tum.de>
parents: 1879
diff changeset
    75
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    76
section {* Sort-Respecting Permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    77
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    78
typedef perm =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    79
  "{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
    80
proof
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    81
  show "id \<in> ?perm" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    82
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    83
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    84
lemma permI:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    85
  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
    86
  shows "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    87
  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
    88
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    89
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
    90
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    91
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    92
lemma 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
    93
  unfolding perm_def by simp
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 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
    96
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    97
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    98
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
    99
  unfolding perm_def MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   100
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   101
lemma perm_id: "id \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   102
  unfolding perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   103
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   104
lemma perm_comp:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   105
  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
   106
  shows "(f \<circ> g) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   107
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   108
apply (rule bij_comp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   109
apply (rule perm_is_bij [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   110
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   111
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
   112
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
   113
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   114
apply (simp add: perm_is_sort_respecting [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   115
apply (simp add: perm_is_sort_respecting [OF g])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   116
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   117
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   118
lemma perm_inv:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   119
  assumes f: "f \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   120
  shows "(inv f) \<in> perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   121
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   122
apply (rule bij_imp_bij_inv)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   123
apply (rule perm_is_bij [OF f])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   124
apply (rule MOST_mono [OF perm_MOST [OF f]])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   125
apply (erule subst, rule inv_f_f)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   126
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
   127
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
   128
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
   129
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   130
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   131
lemma bij_Rep_perm: "bij (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   132
  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
   133
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   134
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
   135
  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
   136
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   137
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
   138
  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
   139
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   140
lemma Rep_perm_ext:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   141
  "Rep_perm p1 = Rep_perm p2 \<Longrightarrow> p1 = p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   142
  by (simp add: expand_fun_eq Rep_perm_inject [symmetric])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   143
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
subsection {* Permutations form a group *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   146
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   147
instantiation perm :: group_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   148
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   149
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   150
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   151
  "0 = Abs_perm id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   152
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   153
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   154
  "- p = Abs_perm (inv (Rep_perm p))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   155
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   156
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   157
  "p + 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
   158
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   159
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   160
  "(p1::perm) - p2 = p1 + - p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   161
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   162
lemma Rep_perm_0: "Rep_perm 0 = id"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   163
  unfolding zero_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   164
  by (simp add: Abs_perm_inverse 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
lemma Rep_perm_add:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   167
  "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
   168
  unfolding plus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   169
  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
   170
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   171
lemma Rep_perm_uminus:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   172
  "Rep_perm (- p) = inv (Rep_perm p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
  unfolding uminus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
  by (simp add: Abs_perm_inverse perm_inv Rep_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   175
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   178
unfolding Rep_perm_inject [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   179
unfolding minus_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   180
unfolding Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   181
unfolding Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   182
unfolding Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   183
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
   184
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   185
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   188
section {* Implementation of swappings *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
  swap :: "atom \<Rightarrow> atom \<Rightarrow> perm" ("'(_ \<rightleftharpoons> _')")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   193
  "(a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   194
    Abs_perm (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   195
              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
   196
              else id)"
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
lemma Rep_perm_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   199
  "Rep_perm (a \<rightleftharpoons> b) =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   200
    (if sort_of a = sort_of b 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   201
     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
   202
     else id)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
unfolding swap_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
apply (rule Abs_perm_inverse)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
apply (rule permI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   206
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
   207
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
   208
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
   209
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
apply (simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   212
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   213
lemmas Rep_perm_simps =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   214
  Rep_perm_0
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   215
  Rep_perm_add
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   216
  Rep_perm_uminus
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   217
  Rep_perm_swap
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   218
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   219
lemma swap_different_sorts [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   220
  "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
   221
  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
   222
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
lemma swap_cancel:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
  "(a \<rightleftharpoons> b) + (a \<rightleftharpoons> b) = 0"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   225
  by (rule Rep_perm_ext) 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   226
     (simp add: Rep_perm_simps expand_fun_eq)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   228
lemma swap_self [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   229
  "(a \<rightleftharpoons> a) = 0"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
  by (rule Rep_perm_ext, simp add: Rep_perm_simps expand_fun_eq)
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 minus_swap [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   233
  "- (a \<rightleftharpoons> b) = (a \<rightleftharpoons> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   234
  by (rule minus_unique [OF swap_cancel])
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_commute:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   237
  "(a \<rightleftharpoons> b) = (b \<rightleftharpoons> a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   238
  by (rule Rep_perm_ext)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   239
     (simp add: Rep_perm_swap expand_fun_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   240
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   241
lemma swap_triple:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   242
  assumes "a \<noteq> b" and "c \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
  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
   244
  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
   245
  using assms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
  by (rule_tac Rep_perm_ext)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
     (auto simp add: Rep_perm_simps expand_fun_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   248
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
section {* Permutation Types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   251
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   252
text {*
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   253
  Infix syntax for @{text permute} has higher precedence than
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
  addition, but lower than unary minus.
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   255
*}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   256
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
class pt =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   258
  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
   259
  assumes permute_zero [simp]: "0 \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
  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
   261
begin
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
lemma permute_diff [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   264
  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
   265
  unfolding diff_minus by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
lemma permute_minus_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   268
  shows "p \<bullet> - p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   269
  and   "- p \<bullet> p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   270
  unfolding permute_plus [symmetric] by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   272
lemma permute_swap_cancel [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   273
  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
   274
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   275
  by (simp add: swap_cancel)
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_swap_cancel2 [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
  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
   279
  unfolding permute_plus [symmetric]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
  by (simp add: swap_commute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
lemma inj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
  shows "inj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
  by (rule inj_on_inverseI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   285
     (rule permute_minus_cancel)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
lemma surj_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   288
  shows "surj (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
  by (rule surjI, rule permute_minus_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 bij_permute [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
  shows "bij (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   293
  by (rule bijI [OF inj_permute surj_permute])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   294
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   295
lemma inv_permute: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
  shows "inv (permute p) = permute (- p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   297
  by (rule inv_equality) (simp_all)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   298
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   299
lemma permute_minus: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   300
  shows "permute (- p) = inv (permute p)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   301
  by (simp add: inv_permute)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   302
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
lemma permute_eq_iff [simp]: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
  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
   305
  by (rule inj_permute [THEN inj_eq])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   306
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
end
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
subsection {* Permutations for atoms *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   310
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   311
instantiation atom :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   313
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   314
definition
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   315
  "p \<bullet> a = (Rep_perm p) a"
1062
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
instance 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   318
apply(default)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   319
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
   320
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   323
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   324
lemma sort_of_permute [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   325
  shows "sort_of (p \<bullet> a) = sort_of a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   326
  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
   327
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   328
lemma swap_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   329
  shows "(a \<rightleftharpoons> b) \<bullet> c =
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
           (if sort_of a = sort_of b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   331
            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
   332
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   333
  by (simp add: Rep_perm_swap)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   334
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   335
lemma swap_atom_simps [simp]:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
  "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
   337
  "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
   338
  "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
   339
  unfolding swap_atom by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   341
lemma expand_perm_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
  fixes p q :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   343
  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
   344
  unfolding permute_atom_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
  by (metis Rep_perm_ext ext)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   346
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   348
subsection {* Permutations for permutations *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   349
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   350
instantiation perm :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   351
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   352
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   353
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
  "p \<bullet> q = p + q - p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   355
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   358
apply (simp add: permute_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   359
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
   360
done
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
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   363
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   364
lemma permute_self: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   365
  shows "p \<bullet> p = p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   366
  unfolding permute_perm_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   367
  by (simp add: diff_minus add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   368
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   369
lemma permute_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   370
  shows "p \<bullet> (q \<bullet> x) = (p \<bullet> q) \<bullet> (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   371
  unfolding permute_perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   372
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
lemma zero_perm_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   374
  shows "p \<bullet> (0::perm) = 0"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   375
  unfolding permute_perm_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   376
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   377
lemma add_perm_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   378
  fixes p p1 p2 :: perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   379
  shows "p \<bullet> (p1 + p2) = p \<bullet> p1 + p \<bullet> p2"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   380
  unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   381
  by (simp add: expand_perm_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   382
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   383
lemma swap_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   384
  shows "p \<bullet> (a \<rightleftharpoons> b) = (p \<bullet> a \<rightleftharpoons> p \<bullet> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   385
  unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   386
  by (auto simp add: swap_atom expand_perm_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   387
2310
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   388
lemma uminus_eqvt:
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   389
  fixes p q::"perm"
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   390
  shows "p \<bullet> (- q) = - (p \<bullet> q)"
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   391
  unfolding permute_perm_def
dd3b9c046c7d added uminus_eqvt
Christian Urban <urbanc@in.tum.de>
parents: 2013
diff changeset
   392
  by (simp add: diff_minus minus_add add_assoc)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   393
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   394
subsection {* Permutations for functions *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   395
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   396
instantiation "fun" :: (pt, pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   397
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   398
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   399
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   400
  "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
   401
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   402
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   403
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   404
apply (simp add: permute_fun_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   405
apply (simp add: permute_fun_def minus_add)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   406
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   407
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   408
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   409
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   410
lemma permute_fun_app_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   411
  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
   412
  unfolding permute_fun_def by simp
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   413
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   414
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   415
subsection {* Permutations for booleans *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   416
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   417
instantiation bool :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   418
begin
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
definition "p \<bullet> (b::bool) = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   421
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   422
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   423
apply(default) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   424
apply(simp_all add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   425
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   426
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   427
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   428
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   429
lemma Not_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   430
  shows "p \<bullet> (\<not> A) = (\<not> (p \<bullet> A))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   431
by (simp add: permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   432
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   433
lemma conj_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   434
  shows "p \<bullet> (A \<and> B) = ((p \<bullet> A) \<and> (p \<bullet> B))"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   435
  by (simp add: permute_bool_def)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   436
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   437
lemma imp_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   438
  shows "p \<bullet> (A \<longrightarrow> B) = ((p \<bullet> A) \<longrightarrow> (p \<bullet> B))"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   439
  by (simp add: permute_bool_def)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   440
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   441
lemma ex_eqvt:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   442
  shows "p \<bullet> (\<exists>x. P x) = (\<exists>x. (p \<bullet> P) x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   443
  unfolding permute_fun_def permute_bool_def
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   444
  by (auto, rule_tac x="p \<bullet> x" in exI, simp)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   445
1557
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   446
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
   447
  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
   448
  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
   449
  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
   450
fee2389789ad moved infinite_Un into mainstream Isabelle; moved permute_boolI/E lemmas
Christian Urban <urbanc@in.tum.de>
parents: 1305
diff changeset
   451
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
   452
  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
   453
  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
   454
  by(simp add: permute_bool_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   455
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   456
subsection {* Permutations for sets *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   457
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   458
lemma permute_set_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   459
  fixes x::"'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   460
  and   p::"perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   461
  shows "(p \<bullet> X) = {p \<bullet> x | x. x \<in> X}"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   462
  unfolding permute_fun_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   463
  unfolding permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   464
  apply(auto simp add: mem_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   465
  apply(rule_tac x="- p \<bullet> x" in exI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   466
  apply(simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   467
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   468
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   469
lemma permute_set_eq_image:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   470
  shows "p \<bullet> X = permute p ` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   471
  unfolding permute_set_eq by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   472
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   473
lemma permute_set_eq_vimage:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   474
  shows "p \<bullet> X = permute (- p) -` X"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   475
  unfolding permute_fun_def permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   476
  unfolding vimage_def Collect_def mem_def ..
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   477
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   478
lemma swap_set_not_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   479
  assumes a: "a \<notin> S" "b \<notin> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   480
  shows "(a \<rightleftharpoons> b) \<bullet> S = S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   481
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   482
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   483
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   484
lemma swap_set_in:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   485
  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
   486
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   487
  unfolding permute_set_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   488
  using a by (auto simp add: swap_atom)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   489
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   490
subsection {* Permutations for units *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   491
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   492
instantiation unit :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   493
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   494
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   495
definition "p \<bullet> (u::unit) = u"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   496
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   497
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   498
by (default) (simp_all add: permute_unit_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   499
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   500
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   501
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   502
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   503
subsection {* Permutations for products *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   504
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   505
instantiation prod :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   506
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   507
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   508
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   509
  permute_prod 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   510
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   511
  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
   512
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   513
instance
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   514
by default auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   515
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   516
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   517
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   518
subsection {* Permutations for sums *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   519
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   520
instantiation sum :: (pt, pt) pt
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   521
begin
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
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   524
  permute_sum 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   525
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   526
  "p \<bullet> (Inl x) = Inl (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   527
| "p \<bullet> (Inr y) = Inr (p \<bullet> y)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   528
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   529
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   530
by (default) (case_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   531
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   532
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   533
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   534
subsection {* Permutations for lists *}
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
instantiation list :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   537
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   538
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   539
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   540
  permute_list 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   541
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   542
  "p \<bullet> [] = []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   543
| "p \<bullet> (x # xs) = p \<bullet> x # p \<bullet> xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   544
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   545
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   546
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   547
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   548
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   549
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   550
subsection {* Permutations for options *}
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
instantiation option :: (pt) pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   553
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   554
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   555
primrec 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   556
  permute_option 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   557
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   558
  "p \<bullet> None = None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   559
| "p \<bullet> (Some x) = Some (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   560
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   561
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   562
by (default) (induct_tac [!] x, simp_all)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   563
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   564
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   565
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   566
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
   567
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   568
instantiation char :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   569
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   570
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   571
definition "p \<bullet> (c::char) = c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   572
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   573
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   574
by (default) (simp_all add: permute_char_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   575
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   576
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   577
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   578
instantiation nat :: 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
definition "p \<bullet> (n::nat) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   582
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   583
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   584
by (default) (simp_all add: permute_nat_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   585
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   586
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   587
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   588
instantiation int :: pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   589
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   590
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   591
definition "p \<bullet> (i::int) = i"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   592
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   593
instance 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   594
by (default) (simp_all add: permute_int_def)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   595
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   596
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   597
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   598
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   599
section {* Pure types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   600
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   601
text {* Pure types will have always empty support. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   602
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   603
class pure = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   604
  assumes permute_pure: "p \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   605
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   606
text {* Types @{typ unit} and @{typ bool} are pure. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   607
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   608
instance unit :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   609
proof qed (rule permute_unit_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   610
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   611
instance bool :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   612
proof qed (rule permute_bool_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   613
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   614
text {* Other type constructors preserve purity. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   615
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   616
instance "fun" :: (pure, pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   617
by default (simp add: permute_fun_def permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   618
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   619
instance prod :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   620
by default (induct_tac x, simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   621
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   622
instance sum :: (pure, pure) pure
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   623
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
   624
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   625
instance list :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   626
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
   627
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   628
instance option :: (pure) pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   629
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
   630
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   631
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   632
subsection {* Types @{typ char}, @{typ nat}, and @{typ int} *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   633
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   634
instance char :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   635
proof qed (rule permute_char_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   636
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   637
instance nat :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   638
proof qed (rule permute_nat_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   639
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   640
instance int :: pure
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   641
proof qed (rule permute_int_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   642
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   643
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   644
subsection {* Supp, Freshness and Supports *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   645
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   646
context pt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   647
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   648
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   649
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   650
  supp :: "'a \<Rightarrow> atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   651
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   652
  "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
   653
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   654
end
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   655
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   656
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   657
  fresh :: "atom \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp> _" [55, 55] 55)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   658
where   
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   659
  "a \<sharp> x \<equiv> a \<notin> supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   660
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   661
lemma supp_conv_fresh: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   662
  shows "supp x = {a. \<not> a \<sharp> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   663
  unfolding fresh_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   664
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   665
lemma swap_rel_trans:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   666
  assumes "sort_of a = sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   667
  assumes "sort_of b = sort_of c"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   668
  assumes "(a \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   669
  assumes "(b \<rightleftharpoons> c) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   670
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   671
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   672
  assume "a = b \<or> c = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   673
  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
   674
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   675
  assume *: "\<not> (a = b \<or> c = b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   676
  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
   677
    using assms by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   678
  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
   679
    using assms * by (simp add: swap_triple)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   680
  finally show "(a \<rightleftharpoons> b) \<bullet> x = x" .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   681
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   682
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   683
lemma swap_fresh_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   684
  assumes a: "a \<sharp> x" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   685
  and     b: "b \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   686
  shows "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   687
proof (cases)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   688
  assume asm: "sort_of a = sort_of b" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   689
  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
   690
    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
   691
  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
   692
  then obtain c 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   693
    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
   694
    by (rule obtain_atom) (auto)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   695
  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
   696
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   697
  assume "sort_of a \<noteq> sort_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   698
  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
   699
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   700
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   701
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   702
subsection {* supp and fresh are equivariant *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   703
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   704
lemma finite_Collect_bij:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   705
  assumes a: "bij f"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   706
  shows "finite {x. P (f x)} = finite {x. P x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   707
by (metis a finite_vimage_iff vimage_Collect_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   708
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   709
lemma fresh_permute_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   710
  shows "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   711
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   712
  have "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   713
    unfolding fresh_def supp_def by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   714
  also have "\<dots> \<longleftrightarrow> finite {b. (p \<bullet> a \<rightleftharpoons> p \<bullet> b) \<bullet> p \<bullet> x \<noteq> p \<bullet> x}"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   715
    using bij_permute by (rule finite_Collect_bij[symmetric])
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   716
  also have "\<dots> \<longleftrightarrow> finite {b. p \<bullet> (a \<rightleftharpoons> b) \<bullet> x \<noteq> p \<bullet> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   717
    by (simp only: permute_eqvt [of p] swap_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   718
  also have "\<dots> \<longleftrightarrow> finite {b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   719
    by (simp only: permute_eq_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   720
  also have "\<dots> \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   721
    unfolding fresh_def supp_def by simp
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   722
  finally show "(p \<bullet> a) \<sharp> (p \<bullet> x) \<longleftrightarrow> a \<sharp> x" .
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   723
qed
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
lemma fresh_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   726
  shows "p \<bullet> (a \<sharp> x) = (p \<bullet> a) \<sharp> (p \<bullet> x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   727
  unfolding permute_bool_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   728
  by (simp add: fresh_permute_iff)
1062
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
lemma supp_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   731
  fixes  p  :: "perm"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   732
  and    x   :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   733
  shows "p \<bullet> (supp x) = supp (p \<bullet> x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   734
  unfolding supp_conv_fresh
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   735
  unfolding Collect_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   736
  unfolding permute_fun_def
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   737
  by (simp add: Not_eqvt fresh_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   738
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   739
subsection {* supports *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   740
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   741
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   742
  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
   743
where  
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   744
  "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
   745
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   746
lemma supp_is_subset:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   747
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   748
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   749
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   750
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   751
  shows "(supp x) \<subseteq> S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   752
proof (rule ccontr)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   753
  assume "\<not> (supp x \<subseteq> S)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   754
  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
   755
  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
   756
  then have "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x} \<subseteq> S" by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   757
  with a2 have "finite {b. (a \<rightleftharpoons> b)\<bullet>x \<noteq> x}" by (simp add: finite_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   758
  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
   759
  with b1 show False by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   760
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   761
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   762
lemma supports_finite:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   763
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   764
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   765
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   766
  and     a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   767
  shows "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   768
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   769
  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
   770
  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
   771
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   772
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   773
lemma supp_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   774
  fixes x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   775
  shows "(supp x) supports x"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   776
unfolding supports_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   777
proof (intro strip)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   778
  fix a b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   779
  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
   780
  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
   781
  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
   782
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   783
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   784
lemma supp_is_least_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   785
  fixes S :: "atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   786
  and   x :: "'a::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   787
  assumes  a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   788
  and      a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   789
  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
   790
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   791
proof (rule equalityI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   792
  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
   793
  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
   794
  have "(supp x) supports x" by (rule supp_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   795
  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
   796
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   797
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   798
lemma subsetCI: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   799
  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
   800
  by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   801
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   802
lemma finite_supp_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   803
  assumes a1: "S supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   804
  assumes a2: "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   805
  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
   806
  shows "(supp x) = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   807
  using a1 a2
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   808
proof (rule supp_is_least_supports)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   809
  fix S'
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   810
  assume "finite S'" and "S' supports x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   811
  show "S \<subseteq> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   812
  proof (rule subsetCI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   813
    fix a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   814
    assume "a \<in> S" and "a \<notin> S'"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   815
    have "finite (S \<union> S')"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   816
      using `finite S` `finite S'` by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   817
    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
   818
      by (rule obtain_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   819
    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
   820
      by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   821
    then have "(a \<rightleftharpoons> b) \<bullet> x = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   822
      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
   823
    moreover have "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   824
      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
   825
      by (rule a3)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   826
    ultimately show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   827
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   828
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   829
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   830
section {* Finitely-supported types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   831
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   832
class fs = pt +
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   833
  assumes finite_supp: "finite (supp x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   834
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   835
lemma pure_supp: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   836
  shows "supp (x::'a::pure) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   837
  unfolding supp_def by (simp add: permute_pure)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   838
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   839
lemma pure_fresh:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   840
  fixes x::"'a::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   841
  shows "a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   842
  unfolding fresh_def by (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   843
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   844
instance pure < fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   845
by default (simp add: pure_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   846
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   847
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   848
subsection  {* Type @{typ atom} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   849
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   850
lemma supp_atom:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   851
  shows "supp a = {a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   852
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   853
apply (clarsimp simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   854
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   855
apply simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   856
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   857
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   858
lemma fresh_atom: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   859
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   860
  unfolding fresh_def supp_atom by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   861
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   862
instance atom :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   863
by default (simp add: supp_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   864
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
   865
section {* Support for finite sets of atoms *}
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   866
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
   867
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
   868
lemma supp_finite_atom_set:
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   869
  fixes S::"atom set"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   870
  assumes "finite S"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   871
  shows "supp S = S"
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   872
  apply(rule finite_supp_unique)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   873
  apply(simp add: supports_def)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   874
  apply(simp add: swap_set_not_in)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   875
  apply(rule assms)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   876
  apply(simp add: swap_set_in)
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   877
done
9eab1dfc14d2 moved lemmas from FSet.thy to do with atom to Nominal2_Base, and to do with 'a::at set to Nominal2_Atoms; moved Nominal2_Eqvt.thy one up to be loaded before Nominal2_Atoms
Christian Urban <urbanc@in.tum.de>
parents: 1932
diff changeset
   878
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   879
section {* Type @{typ perm} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   880
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   881
lemma perm_swap_eq:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   882
  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
   883
unfolding permute_perm_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   884
by (metis add_diff_cancel minus_perm_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   885
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   886
lemma supports_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   887
  shows "{a. p \<bullet> a \<noteq> a} supports p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   888
  unfolding supports_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   889
  unfolding perm_swap_eq
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   890
  by (simp add: swap_eqvt)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   891
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   892
lemma finite_perm_lemma: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   893
  shows "finite {a::atom. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   894
  using finite_Rep_perm [of p]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   895
  unfolding permute_atom_def .
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   896
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   897
lemma supp_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   898
  shows "supp p = {a. p \<bullet> a \<noteq> a}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   899
apply (rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   900
apply (rule supports_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   901
apply (rule finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   902
apply (simp add: perm_swap_eq swap_eqvt)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   903
apply (auto simp add: expand_perm_eq swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   904
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   905
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   906
lemma fresh_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   907
  shows "a \<sharp> p \<longleftrightarrow> p \<bullet> a = a"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   908
  unfolding fresh_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   909
  by (simp add: supp_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   910
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   911
lemma supp_swap:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   912
  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
   913
  by (auto simp add: supp_perm swap_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   914
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   915
lemma fresh_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   916
  shows "a \<sharp> (0::perm)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   917
  unfolding fresh_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   918
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   919
lemma supp_zero_perm: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   920
  shows "supp (0::perm) = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   921
  unfolding supp_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   922
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   923
lemma fresh_plus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   924
  fixes p q::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   925
  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
   926
  shows "a \<sharp> (p + q)"
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   927
  using assms
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   928
  unfolding fresh_def
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   929
  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
   930
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   931
lemma supp_plus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   932
  fixes p q::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   933
  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
   934
  by (auto simp add: supp_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   935
1087
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   936
lemma fresh_minus_perm:
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   937
  fixes p::perm
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   938
  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
   939
  unfolding fresh_def
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   940
  unfolding supp_perm
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   941
  apply(simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   942
  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
   943
  done
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   944
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   945
lemma supp_minus_perm:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   946
  fixes p::perm
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   947
  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
   948
  unfolding supp_conv_fresh
bb7f4457091a moved some lemmas to Nominal; updated all files
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   949
  by (simp add: fresh_minus_perm)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   950
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   951
instance perm :: fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   952
by default (simp add: supp_perm finite_perm_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   953
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   954
lemma plus_perm_eq:
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   955
  fixes p q::"perm"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
   956
  assumes asm: "supp p \<inter> supp q = {}"
1305
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   957
  shows "p + q  = q + p"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   958
unfolding expand_perm_eq
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   959
proof
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   960
  fix a::"atom"
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   961
  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
   962
  proof -
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   963
    { 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
   964
      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
   965
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   966
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   967
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   968
    { 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
   969
      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
   970
      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
   971
      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
   972
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   973
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   974
    moreover
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   975
    { 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
   976
      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
   977
      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
   978
      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
   979
	by (simp add: supp_perm)
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   980
    }
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   981
    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
   982
      using asm by blast
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   983
  qed
61319a9af976 updated (added lemma about commuting permutations)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   984
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   985
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   986
section {* Finite Support instances for other types *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   987
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   988
subsection {* Type @{typ "'a \<times> 'b"} is finitely-supported. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   989
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   990
lemma supp_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   991
  shows "supp (x, y) = supp x \<union> supp y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   992
  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
   993
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   994
lemma fresh_Pair: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   995
  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
   996
  by (simp add: fresh_def supp_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   997
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
   998
instance prod :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   999
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1000
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1001
apply (simp add: supp_Pair finite_supp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1002
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1003
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1004
subsection {* Type @{typ "'a + 'b"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1005
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1006
lemma supp_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1007
  shows "supp (Inl x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1008
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1009
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1010
lemma supp_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1011
  shows "supp (Inr x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1012
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1013
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1014
lemma fresh_Inl: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1015
  shows "a \<sharp> Inl x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1016
  by (simp add: fresh_def supp_Inl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1017
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1018
lemma fresh_Inr: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1019
  shows "a \<sharp> Inr y \<longleftrightarrow> a \<sharp> y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1020
  by (simp add: fresh_def supp_Inr)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1021
2378
2f13fe48c877 updated to new Isabelle; made FSet more "quiet"
Christian Urban <urbanc@in.tum.de>
parents: 2310
diff changeset
  1022
instance sum :: (fs, fs) fs
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1023
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1024
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1025
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
  1026
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1027
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1028
subsection {* Type @{typ "'a option"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1029
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1030
lemma supp_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1031
  shows "supp None = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1032
by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1033
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1034
lemma supp_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1035
  shows "supp (Some x) = supp x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1036
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1037
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1038
lemma fresh_None: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1039
  shows "a \<sharp> None"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1040
  by (simp add: fresh_def supp_None)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1041
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1042
lemma fresh_Some: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1043
  shows "a \<sharp> Some x \<longleftrightarrow> a \<sharp> x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1044
  by (simp add: fresh_def supp_Some)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1045
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1046
instance option :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1047
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1048
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1049
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
  1050
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1051
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1052
subsubsection {* Type @{typ "'a list"} is finitely supported *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1053
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1054
lemma supp_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1055
  shows "supp [] = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1056
  by (simp add: supp_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1057
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1058
lemma supp_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1059
  shows "supp (x # xs) = supp x \<union> supp xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1060
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
  1061
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1062
lemma fresh_Nil: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1063
  shows "a \<sharp> []"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1064
  by (simp add: fresh_def supp_Nil)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1065
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1066
lemma fresh_Cons: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1067
  shows "a \<sharp> (x # xs) \<longleftrightarrow> a \<sharp> x \<and> a \<sharp> xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1068
  by (simp add: fresh_def supp_Cons)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1069
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1070
instance list :: (fs) fs
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1071
apply default
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1072
apply (induct_tac x)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1073
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
  1074
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1075
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1076
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1077
section {* Support and freshness for applications *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1078
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1079
lemma fresh_conv_MOST: 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1080
  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
  1081
  unfolding fresh_def supp_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1082
  unfolding MOST_iff_cofinite by simp
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1083
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1084
lemma supp_subset_fresh:
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1085
  assumes a: "\<And>a. a \<sharp> x \<Longrightarrow> a \<sharp> y"
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1086
  shows "supp y \<subseteq> supp x"
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1087
  using a
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1088
  unfolding fresh_def
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1089
  by blast
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1090
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1091
lemma fresh_fun_app:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1092
  assumes "a \<sharp> f" and "a \<sharp> x" 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1093
  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
  1094
  using assms
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1095
  unfolding fresh_conv_MOST
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1096
  unfolding permute_fun_app_eq 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1097
  by (elim MOST_rev_mp, simp)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1098
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1099
lemma supp_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1100
  shows "supp (f x) \<subseteq> (supp f) \<union> (supp x)"
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1101
  using fresh_fun_app
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1102
  unfolding fresh_def
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1103
  by auto
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1104
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1105
text {* support of equivariant functions *}
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1106
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1107
lemma supp_fun_eqvt:
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1108
  assumes a: "\<And>p. p \<bullet> f = f"
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1109
  shows "supp f = {}"
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1110
  unfolding supp_def 
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1111
  using a by simp
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1112
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1113
lemma fresh_fun_eqvt_app:
2003
b53e98bfb298 added lemmas establishing the support of finite sets of finitely supported elements
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
  1114
  assumes a: "\<And>p. p \<bullet> f = f"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1115
  shows "a \<sharp> x \<Longrightarrow> a \<sharp> f x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1116
proof -
1941
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
  1117
  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
  1118
  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
  1119
    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
  1120
    using supp_fun_app by auto
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1121
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1122
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
  1123
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1124
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
  1125
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1126
lemma Union_fresh:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1127
  shows "a \<sharp> S \<Longrightarrow> a \<sharp> (\<Union>x \<in> S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1128
  unfolding Union_image_eq[symmetric]
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1129
  apply(rule_tac f="\<lambda>S. \<Union> supp ` S" in fresh_fun_eqvt_app)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1130
  apply(simp add: permute_fun_def UNION_def Collect_def Bex_def ex_eqvt mem_def conj_eqvt)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1131
  apply(subst permute_fun_app_eq)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1132
  back
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1133
  apply(simp add: supp_eqvt)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1134
  apply(assumption)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1135
  done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1136
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1137
lemma Union_supports_set:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1138
  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
  1139
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1140
  { fix a b
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1141
    have "\<forall>x \<in> S. (a \<rightleftharpoons> b) \<bullet> x = x \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> S = S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1142
      unfolding permute_set_eq by force
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1143
  }
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1144
  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
  1145
    unfolding supports_def 
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1146
    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
  1147
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1148
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1149
lemma Union_of_fin_supp_sets:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1150
  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
  1151
  assumes fin: "finite S"   
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1152
  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
  1153
  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
  1154
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1155
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
  1156
  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
  1157
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1158
  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
  1159
proof -
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1160
  have "(\<Union>x\<in>S. supp x) = supp (\<Union>x\<in>S. supp x)"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1161
    by (rule supp_finite_atom_set[symmetric])
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1162
       (rule Union_of_fin_supp_sets[OF fin])
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1163
  also have "\<dots> \<subseteq> supp S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1164
    by (rule supp_subset_fresh)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1165
       (simp add: Union_fresh)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1166
  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
  1167
qed
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1168
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1169
lemma supp_of_fin_sets:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1170
  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
  1171
  assumes fin: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1172
  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
  1173
apply(rule subset_antisym)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1174
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
  1175
apply(rule Union_supports_set)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1176
apply(rule Union_of_fin_supp_sets[OF fin])
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1177
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
  1178
done
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1179
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1180
lemma supp_of_fin_union:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1181
  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
  1182
  assumes fin1: "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1183
  and     fin2: "finite T"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1184
  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
  1185
  using fin1 fin2
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1186
  by (simp add: supp_of_fin_sets)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1187
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1188
lemma supp_of_fin_insert:
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1189
  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
  1190
  assumes fin:  "finite S"
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1191
  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
  1192
  using fin
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1193
  by (simp add: supp_of_fin_sets)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1194
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1195
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
  1196
section {* Concrete atoms types *}
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
  1197
1972
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1198
text {*
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1199
  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
  1200
  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
  1201
*}
40db835442a0 deleted left-over code
Christian Urban <urbanc@in.tum.de>
parents: 1971
diff changeset
  1202
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
  1203
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
  1204
  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
  1205
  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
  1206
  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
  1207
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
  1208
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
  1209
  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
  1210
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
  1211
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
  1212
  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
  1213
  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
  1214
  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
  1215
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
  1216
lemma fresh_at_base: 
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1217
  shows "a \<sharp> b \<longleftrightarrow> a \<noteq> atom b"
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1218
  unfolding fresh_def by (simp add: supp_at_base)
84a13d1e2511 moved mk_atom into the library; that meant that concrete atom classes need to be in Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1941
diff changeset
  1219
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
  1220
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
  1221
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
  1222
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
  1223
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
  1224
  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
  1225
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
  1226
  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
  1227
  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
  1228
  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
  1229
    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
  1230
  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
  1231
    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
  1232
  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
  1233
    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
  1234
    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
  1235
  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
  1236
  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
  1237
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
  1238
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
  1239
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
  1240
  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
  1241
  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
  1242
  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
  1243
  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
  1244
  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
  1245
  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
  1246
  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
  1247
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
  1248
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
  1249
  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
  1250
  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
  1251
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
  1252
  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
  1253
    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
  1254
  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
  1255
    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
  1256
  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
  1257
    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
  1258
  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
  1259
    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
  1260
  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
  1261
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
  1262
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1972
diff changeset
  1263
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
  1264
  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
  1265
  shows "supp S = atom ` S"
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1266
apply(simp add: supp_of_fin_sets[OF a])
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1267
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
  1268
apply(auto)
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1269
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
  1270
8daf6ff5e11a simpliied and moved the remaining lemmas about the atom-function to Nominal2_Base
Christian Urban <urbanc@in.tum.de>
parents: 1962
diff changeset
  1271
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1833
diff changeset
  1272
section {* library functions for the nominal infrastructure *}
1833
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
  1273
use "nominal_library.ML"
2050b5723c04 added a library for basic nominal functions; separated nominal_eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
  1274
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1275
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2378
diff changeset
  1276
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
  1277
end