author | Christian Urban <urbanc@in.tum.de> |
Tue, 27 Apr 2010 22:21:16 +0200 | |
changeset 1962 | 84a13d1e2511 |
parent 1941 | d33781f9d2c7 |
child 1971 | 8daf6ff5e11a |
permissions | -rw-r--r-- |
1062 | 1 |
(* Title: Nominal2_Atoms |
2 |
Authors: Brian Huffman, Christian Urban |
|
3 |
||
4 |
Definitions for concrete atom types. |
|
5 |
*) |
|
6 |
theory Nominal2_Atoms |
|
7 |
imports Nominal2_Base |
|
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:
1779
diff
changeset
|
8 |
Nominal2_Eqvt |
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
9 |
uses ("nominal_atoms.ML") |
1062 | 10 |
begin |
11 |
||
12 |
section {* Concrete atom types *} |
|
13 |
||
14 |
text {* |
|
15 |
Class @{text at_base} allows types containing multiple sorts of atoms. |
|
16 |
Class @{text at} only allows types with a single sort. |
|
17 |
*} |
|
18 |
||
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:
1779
diff
changeset
|
19 |
lemma atom_image_cong: |
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:
1779
diff
changeset
|
20 |
fixes X Y::"('a::at_base) 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:
1779
diff
changeset
|
21 |
shows "(atom ` X = atom ` Y) = (X = Y)" |
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:
1779
diff
changeset
|
22 |
apply(rule inj_image_eq_iff) |
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:
1779
diff
changeset
|
23 |
apply(simp add: inj_on_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:
1779
diff
changeset
|
24 |
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:
1779
diff
changeset
|
25 |
|
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:
1779
diff
changeset
|
26 |
lemma atom_image_supp: |
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:
1779
diff
changeset
|
27 |
"supp S = supp (atom ` 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:
1779
diff
changeset
|
28 |
apply(simp add: supp_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:
1779
diff
changeset
|
29 |
apply(simp add: image_eqvt) |
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:
1779
diff
changeset
|
30 |
apply(subst (2) permute_fun_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:
1779
diff
changeset
|
31 |
apply(simp add: atom_eqvt) |
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:
1779
diff
changeset
|
32 |
apply(simp add: atom_image_cong) |
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:
1779
diff
changeset
|
33 |
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:
1779
diff
changeset
|
34 |
|
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:
1779
diff
changeset
|
35 |
lemma supp_finite_at_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:
1779
diff
changeset
|
36 |
fixes S::"('a::at) 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:
1779
diff
changeset
|
37 |
assumes a: "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:
1779
diff
changeset
|
38 |
shows "supp S = atom ` 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:
1779
diff
changeset
|
39 |
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:
1779
diff
changeset
|
40 |
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:
1779
diff
changeset
|
41 |
apply(rule allI)+ |
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:
1779
diff
changeset
|
42 |
apply(rule impI) |
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:
1779
diff
changeset
|
43 |
apply(rule swap_fresh_fresh) |
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:
1779
diff
changeset
|
44 |
apply(simp add: fresh_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:
1779
diff
changeset
|
45 |
apply(simp add: atom_image_supp) |
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:
1779
diff
changeset
|
46 |
apply(subst 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:
1779
diff
changeset
|
47 |
apply(rule finite_imageI) |
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:
1779
diff
changeset
|
48 |
apply(simp add: a) |
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:
1779
diff
changeset
|
49 |
apply(simp) |
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:
1779
diff
changeset
|
50 |
apply(simp add: fresh_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:
1779
diff
changeset
|
51 |
apply(simp add: atom_image_supp) |
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:
1779
diff
changeset
|
52 |
apply(subst 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:
1779
diff
changeset
|
53 |
apply(rule finite_imageI) |
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:
1779
diff
changeset
|
54 |
apply(simp add: a) |
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:
1779
diff
changeset
|
55 |
apply(simp) |
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:
1779
diff
changeset
|
56 |
apply(rule finite_imageI) |
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:
1779
diff
changeset
|
57 |
apply(simp add: a) |
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:
1779
diff
changeset
|
58 |
apply(drule 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:
1779
diff
changeset
|
59 |
apply(assumption) |
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:
1779
diff
changeset
|
60 |
apply(simp) |
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:
1779
diff
changeset
|
61 |
apply(simp add: image_eqvt) |
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:
1779
diff
changeset
|
62 |
apply(simp add: permute_fun_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:
1779
diff
changeset
|
63 |
apply(simp add: atom_eqvt) |
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:
1779
diff
changeset
|
64 |
apply(simp add: atom_image_cong) |
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:
1779
diff
changeset
|
65 |
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:
1779
diff
changeset
|
66 |
|
1941 | 67 |
lemma supp_finite_at_set_aux: |
68 |
fixes S::"('a::at) set" |
|
69 |
assumes a: "finite S" |
|
70 |
shows "supp S = atom ` S" |
|
71 |
proof |
|
72 |
show "supp S \<subseteq> ((atom::'a::at \<Rightarrow> atom) ` S)" |
|
73 |
apply(rule supp_is_subset) |
|
74 |
apply(simp add: supports_def) |
|
75 |
apply(rule allI)+ |
|
76 |
apply(rule impI) |
|
77 |
apply(rule swap_fresh_fresh) |
|
78 |
apply(simp add: fresh_def) |
|
79 |
apply(simp add: atom_image_supp) |
|
80 |
apply(subst supp_finite_atom_set) |
|
81 |
apply(rule finite_imageI) |
|
82 |
apply(simp add: a) |
|
83 |
apply(simp) |
|
84 |
apply(simp add: fresh_def) |
|
85 |
apply(simp add: atom_image_supp) |
|
86 |
apply(subst supp_finite_atom_set) |
|
87 |
apply(rule finite_imageI) |
|
88 |
apply(simp add: a) |
|
89 |
apply(simp) |
|
90 |
apply(rule finite_imageI) |
|
91 |
apply(simp add: a) |
|
92 |
done |
|
93 |
next |
|
94 |
have "supp ((atom::'a::at \<Rightarrow> atom) ` S) \<subseteq> supp ((op `) (atom::'a::at \<Rightarrow> atom)) \<union> supp S" |
|
95 |
by (simp add: supp_fun_app) |
|
96 |
moreover |
|
97 |
have "supp ((op `) (atom::'a::at \<Rightarrow> atom)) = {}" |
|
98 |
apply(rule supp_fun_eqvt) |
|
99 |
apply(perm_simp) |
|
100 |
apply(simp) |
|
101 |
done |
|
102 |
moreover |
|
103 |
have "supp ((atom::'a::at \<Rightarrow> atom) ` S) = ((atom::'a::at \<Rightarrow> atom) ` S)" |
|
104 |
apply(subst supp_finite_atom_set) |
|
105 |
apply(rule finite_imageI) |
|
106 |
apply(simp add: a) |
|
107 |
apply(simp) |
|
108 |
done |
|
109 |
ultimately |
|
110 |
show "((atom::'a::at \<Rightarrow> atom) ` S) \<subseteq> supp S" by simp |
|
111 |
qed |
|
112 |
||
113 |
||
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:
1779
diff
changeset
|
114 |
lemma supp_at_insert: |
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:
1779
diff
changeset
|
115 |
fixes S::"('a::at) 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:
1779
diff
changeset
|
116 |
assumes a: "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:
1779
diff
changeset
|
117 |
shows "supp (insert a S) = supp a \<union> supp S" |
1941 | 118 |
using a by (simp add: supp_finite_at_set supp_at_base) |
119 |
||
1062 | 120 |
|
121 |
section {* A swapping operation for concrete atoms *} |
|
122 |
||
123 |
definition |
|
124 |
flip :: "'a::at_base \<Rightarrow> 'a \<Rightarrow> perm" ("'(_ \<leftrightarrow> _')") |
|
125 |
where |
|
126 |
"(a \<leftrightarrow> b) = (atom a \<rightleftharpoons> atom b)" |
|
127 |
||
128 |
lemma flip_self [simp]: "(a \<leftrightarrow> a) = 0" |
|
129 |
unfolding flip_def by (rule swap_self) |
|
130 |
||
131 |
lemma flip_commute: "(a \<leftrightarrow> b) = (b \<leftrightarrow> a)" |
|
132 |
unfolding flip_def by (rule swap_commute) |
|
133 |
||
134 |
lemma minus_flip [simp]: "- (a \<leftrightarrow> b) = (a \<leftrightarrow> b)" |
|
135 |
unfolding flip_def by (rule minus_swap) |
|
136 |
||
137 |
lemma add_flip_cancel: "(a \<leftrightarrow> b) + (a \<leftrightarrow> b) = 0" |
|
138 |
unfolding flip_def by (rule swap_cancel) |
|
139 |
||
140 |
lemma permute_flip_cancel [simp]: "(a \<leftrightarrow> b) \<bullet> (a \<leftrightarrow> b) \<bullet> x = x" |
|
141 |
unfolding permute_plus [symmetric] add_flip_cancel by simp |
|
142 |
||
143 |
lemma permute_flip_cancel2 [simp]: "(a \<leftrightarrow> b) \<bullet> (b \<leftrightarrow> a) \<bullet> x = x" |
|
144 |
by (simp add: flip_commute) |
|
145 |
||
146 |
lemma flip_eqvt: |
|
147 |
fixes a b c::"'a::at_base" |
|
148 |
shows "p \<bullet> (a \<leftrightarrow> b) = (p \<bullet> a \<leftrightarrow> p \<bullet> b)" |
|
149 |
unfolding flip_def |
|
150 |
by (simp add: swap_eqvt atom_eqvt) |
|
151 |
||
152 |
lemma flip_at_base_simps [simp]: |
|
153 |
shows "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> a = b" |
|
154 |
and "sort_of (atom a) = sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> b = a" |
|
155 |
and "\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> c = c" |
|
156 |
and "sort_of (atom a) \<noteq> sort_of (atom b) \<Longrightarrow> (a \<leftrightarrow> b) \<bullet> x = x" |
|
157 |
unfolding flip_def |
|
158 |
unfolding atom_eq_iff [symmetric] |
|
159 |
unfolding atom_eqvt [symmetric] |
|
160 |
by simp_all |
|
161 |
||
162 |
text {* the following two lemmas do not hold for at_base, |
|
163 |
only for single sort atoms from at *} |
|
164 |
||
165 |
lemma permute_flip_at: |
|
166 |
fixes a b c::"'a::at" |
|
167 |
shows "(a \<leftrightarrow> b) \<bullet> c = (if c = a then b else if c = b then a else c)" |
|
168 |
unfolding flip_def |
|
169 |
apply (rule atom_eq_iff [THEN iffD1]) |
|
170 |
apply (subst atom_eqvt [symmetric]) |
|
171 |
apply (simp add: swap_atom) |
|
172 |
done |
|
173 |
||
174 |
lemma flip_at_simps [simp]: |
|
175 |
fixes a b::"'a::at" |
|
176 |
shows "(a \<leftrightarrow> b) \<bullet> a = b" |
|
177 |
and "(a \<leftrightarrow> b) \<bullet> b = a" |
|
178 |
unfolding permute_flip_at by simp_all |
|
179 |
||
1499
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
180 |
lemma flip_fresh_fresh: |
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
181 |
fixes a b::"'a::at_base" |
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
182 |
assumes "atom a \<sharp> x" "atom b \<sharp> x" |
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
183 |
shows "(a \<leftrightarrow> b) \<bullet> x = x" |
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
184 |
using assms |
21dda372fb11
simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents:
1363
diff
changeset
|
185 |
by (simp add: flip_def swap_fresh_fresh) |
1062 | 186 |
|
187 |
subsection {* Syntax for coercing at-elements to the atom-type *} |
|
188 |
||
189 |
syntax |
|
190 |
"_atom_constrain" :: "logic \<Rightarrow> type \<Rightarrow> logic" ("_:::_" [4, 0] 3) |
|
191 |
||
192 |
translations |
|
1569 | 193 |
"_atom_constrain a t" => "CONST atom (_constrain a t)" |
194 |
||
1062 | 195 |
|
196 |
subsection {* A lemma for proving instances of class @{text at}. *} |
|
197 |
||
198 |
setup {* Sign.add_const_constraint (@{const_name "permute"}, NONE) *} |
|
199 |
setup {* Sign.add_const_constraint (@{const_name "atom"}, NONE) *} |
|
200 |
||
201 |
text {* |
|
202 |
New atom types are defined as subtypes of @{typ atom}. |
|
203 |
*} |
|
204 |
||
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
205 |
lemma exists_eq_simple_sort: |
1062 | 206 |
shows "\<exists>a. a \<in> {a. sort_of a = s}" |
207 |
by (rule_tac x="Atom s 0" in exI, simp) |
|
208 |
||
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
209 |
lemma exists_eq_sort: |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
210 |
shows "\<exists>a. a \<in> {a. sort_of a \<in> range sort_fun}" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
211 |
by (rule_tac x="Atom (sort_fun x) y" in exI, simp) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
212 |
|
1062 | 213 |
lemma at_base_class: |
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
214 |
fixes sort_fun :: "'b \<Rightarrow>atom_sort" |
1062 | 215 |
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a" |
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
216 |
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range sort_fun}" |
1062 | 217 |
assumes atom_def: "\<And>a. atom a = Rep a" |
218 |
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)" |
|
219 |
shows "OFCLASS('a, at_base_class)" |
|
220 |
proof |
|
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
221 |
interpret type_definition Rep Abs "{a. sort_of a \<in> range sort_fun}" by (rule type) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
222 |
have sort_of_Rep: "\<And>a. sort_of (Rep a) \<in> range sort_fun" using Rep by simp |
1062 | 223 |
fix a b :: 'a and p p1 p2 :: perm |
224 |
show "0 \<bullet> a = a" |
|
225 |
unfolding permute_def by (simp add: Rep_inverse) |
|
226 |
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a" |
|
227 |
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep) |
|
228 |
show "atom a = atom b \<longleftrightarrow> a = b" |
|
229 |
unfolding atom_def by (simp add: Rep_inject) |
|
230 |
show "p \<bullet> atom a = atom (p \<bullet> a)" |
|
231 |
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep) |
|
232 |
qed |
|
233 |
||
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
234 |
(* |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
235 |
lemma at_class: |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
236 |
fixes s :: atom_sort |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
237 |
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
238 |
assumes type: "type_definition Rep Abs {a. sort_of a \<in> range (\<lambda>x::unit. s)}" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
239 |
assumes atom_def: "\<And>a. atom a = Rep a" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
240 |
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
241 |
shows "OFCLASS('a, at_class)" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
242 |
proof |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
243 |
interpret type_definition Rep Abs "{a. sort_of a \<in> range (\<lambda>x::unit. s)}" by (rule type) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
244 |
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
245 |
fix a b :: 'a and p p1 p2 :: perm |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
246 |
show "0 \<bullet> a = a" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
247 |
unfolding permute_def by (simp add: Rep_inverse) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
248 |
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
249 |
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
250 |
show "sort_of (atom a) = sort_of (atom b)" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
251 |
unfolding atom_def by (simp add: sort_of_Rep) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
252 |
show "atom a = atom b \<longleftrightarrow> a = b" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
253 |
unfolding atom_def by (simp add: Rep_inject) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
254 |
show "p \<bullet> atom a = atom (p \<bullet> a)" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
255 |
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
256 |
qed |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
257 |
*) |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
258 |
|
1062 | 259 |
lemma at_class: |
260 |
fixes s :: atom_sort |
|
261 |
fixes Rep :: "'a \<Rightarrow> atom" and Abs :: "atom \<Rightarrow> 'a" |
|
262 |
assumes type: "type_definition Rep Abs {a. sort_of a = s}" |
|
263 |
assumes atom_def: "\<And>a. atom a = Rep a" |
|
264 |
assumes permute_def: "\<And>p a. p \<bullet> a = Abs (p \<bullet> Rep a)" |
|
265 |
shows "OFCLASS('a, at_class)" |
|
266 |
proof |
|
267 |
interpret type_definition Rep Abs "{a. sort_of a = s}" by (rule type) |
|
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
268 |
have sort_of_Rep: "\<And>a. sort_of (Rep a) = s" using Rep by (simp add: image_def) |
1062 | 269 |
fix a b :: 'a and p p1 p2 :: perm |
270 |
show "0 \<bullet> a = a" |
|
271 |
unfolding permute_def by (simp add: Rep_inverse) |
|
272 |
show "(p1 + p2) \<bullet> a = p1 \<bullet> p2 \<bullet> a" |
|
273 |
unfolding permute_def by (simp add: Abs_inverse sort_of_Rep) |
|
274 |
show "sort_of (atom a) = sort_of (atom b)" |
|
275 |
unfolding atom_def by (simp add: sort_of_Rep) |
|
276 |
show "atom a = atom b \<longleftrightarrow> a = b" |
|
277 |
unfolding atom_def by (simp add: Rep_inject) |
|
278 |
show "p \<bullet> atom a = atom (p \<bullet> a)" |
|
279 |
unfolding permute_def atom_def by (simp add: Abs_inverse sort_of_Rep) |
|
280 |
qed |
|
281 |
||
282 |
setup {* Sign.add_const_constraint |
|
283 |
(@{const_name "permute"}, SOME @{typ "perm \<Rightarrow> 'a::pt \<Rightarrow> 'a"}) *} |
|
284 |
setup {* Sign.add_const_constraint |
|
285 |
(@{const_name "atom"}, SOME @{typ "'a::at_base \<Rightarrow> atom"}) *} |
|
286 |
||
287 |
section {* Automation for creating concrete atom types *} |
|
288 |
||
289 |
text {* at the moment only single-sort concrete atoms are supported *} |
|
290 |
||
1079
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
291 |
use "nominal_atoms.ML" |
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
292 |
|
c70e7545b738
updated to latest Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
1062
diff
changeset
|
293 |
|
1062 | 294 |
end |