author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Thu, 16 Jun 2011 23:11:50 +0900 | |
changeset 2867 | 39ae45d3a11b |
parent 2859 | 2eeb75cccb8d |
child 2885 | 1264f2a21ea9 |
permissions | -rw-r--r-- |
1795 | 1 |
theory TypeSchemes |
2454
9ffee4eb1ae1
renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
2 |
imports "../Nominal2" |
1795 | 3 |
begin |
4 |
||
5 |
section {*** Type Schemes ***} |
|
6 |
||
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
7 |
thm Set.set_mp Set.subsetD |
2709 | 8 |
|
2556
8ed62410236e
added a test about subtyping; disabled two tests, because of problem with function package
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
9 |
atom_decl name |
8ed62410236e
added a test about subtyping; disabled two tests, because of problem with function package
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
10 |
|
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
11 |
(* defined as a single nominal datatype *) |
1795 | 12 |
|
13 |
nominal_datatype ty = |
|
14 |
Var "name" |
|
15 |
| Fun "ty" "ty" |
|
16 |
and tys = |
|
2714
908750991c2f
Experiments with substitution on set+
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2711
diff
changeset
|
17 |
All xs::"name fset" ty::"ty" bind (set+) xs in ty |
2434 | 18 |
|
2468 | 19 |
thm ty_tys.distinct |
20 |
thm ty_tys.induct |
|
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2611
diff
changeset
|
21 |
thm ty_tys.inducts |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2611
diff
changeset
|
22 |
thm ty_tys.exhaust ty_tys.strong_exhaust |
2468 | 23 |
thm ty_tys.fv_defs |
24 |
thm ty_tys.bn_defs |
|
25 |
thm ty_tys.perm_simps |
|
26 |
thm ty_tys.eq_iff |
|
27 |
thm ty_tys.fv_bn_eqvt |
|
28 |
thm ty_tys.size_eqvt |
|
29 |
thm ty_tys.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
30 |
thm ty_tys.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
31 |
thm ty_tys.fresh |
1795 | 32 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
33 |
fun |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
34 |
lookup :: "(name \<times> ty) list \<Rightarrow> name \<Rightarrow> ty" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
35 |
where |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
36 |
"lookup [] Y = Var Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
37 |
| "lookup ((X, T) # Ts) Y = (if X = Y then T else lookup Ts Y)" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
38 |
|
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
39 |
lemma lookup_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
40 |
shows "(p \<bullet> lookup Ts T) = lookup (p \<bullet> Ts) (p \<bullet> T)" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
41 |
apply(induct Ts T rule: lookup.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
42 |
apply(simp_all) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
43 |
done |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
44 |
|
2709 | 45 |
lemma test: |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
46 |
assumes a: "\<exists>y. f x = Inl y" |
2709 | 47 |
shows "(p \<bullet> (Sum_Type.Projl (f x))) = Sum_Type.Projl ((p \<bullet> f) (p \<bullet> x))" |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
48 |
using a |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
49 |
apply clarify |
2709 | 50 |
apply(frule_tac p="p" in permute_boolI) |
51 |
apply(simp (no_asm_use) only: eqvts) |
|
52 |
apply(subst (asm) permute_fun_app_eq) |
|
53 |
back |
|
54 |
apply(simp) |
|
55 |
done |
|
56 |
||
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
57 |
lemma test2: |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
58 |
assumes a: "\<exists>y. f x = Inl y" |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
59 |
shows "(p \<bullet> (Sum_Type.Projl (f x))) = Sum_Type.Projl (p \<bullet> (f x))" |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
60 |
using a |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
61 |
apply clarify |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
62 |
apply(frule_tac p="p" in permute_boolI) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
63 |
apply(simp (no_asm_use) only: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
64 |
apply(subst (asm) permute_fun_app_eq) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
65 |
back |
2709 | 66 |
apply(simp) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
67 |
done |
2709 | 68 |
|
2848
da7e6655cd4c
fixed the problem when giving a complex default-term; the fundef lemmas in Nominal_Base were not general enough
Christian Urban <urbanc@in.tum.de>
parents:
2843
diff
changeset
|
69 |
nominal_primrec (default "sum_case (\<lambda>x. Inl undefined) (\<lambda>x. Inr undefined)") |
2838
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
70 |
subst :: "(name \<times> ty) list \<Rightarrow> ty \<Rightarrow> ty" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
71 |
and substs :: "(name \<times> ty) list \<Rightarrow> tys \<Rightarrow> tys" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
72 |
where |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
73 |
"subst \<theta> (Var X) = lookup \<theta> X" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
74 |
| "subst \<theta> (Fun T1 T2) = Fun (subst \<theta> T1) (subst \<theta> T2)" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
75 |
| "fset (map_fset atom xs) \<sharp>* \<theta> \<Longrightarrow> substs \<theta> (All xs T) = All xs (subst \<theta> T)" |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
76 |
(*unfolding subst_substs_graph_def eqvt_def |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
77 |
apply rule |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
78 |
apply perm_simp |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
79 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
80 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
81 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
82 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
83 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
84 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
85 |
apply rule*) |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
86 |
apply(subgoal_tac "\<And>p x r. subst_substs_graph x r \<Longrightarrow> subst_substs_graph (p \<bullet> x) (p \<bullet> r)") |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
87 |
apply(simp add: eqvt_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
88 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
89 |
apply(simp add: permute_fun_def permute_bool_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
90 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
91 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
92 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
93 |
apply(drule_tac x="p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
94 |
apply(drule_tac x="- p \<bullet> x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
95 |
apply(drule_tac x="- p \<bullet> xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
96 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
97 |
apply(drule_tac x="-p" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
98 |
apply(drule_tac x="x" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
99 |
apply(drule_tac x="xa" in meta_spec) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
100 |
apply(simp) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
101 |
--"Eqvt One way" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
102 |
apply(erule subst_substs_graph.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
103 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
104 |
apply(rule subst_substs_graph.intros) |
2709 | 105 |
apply(erule subst_substs_graph.cases) |
106 |
apply(simp (no_asm_use) only: eqvts) |
|
107 |
apply(subst test) |
|
108 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
109 |
apply (rule exI) |
2709 | 110 |
apply(assumption) |
111 |
apply(rotate_tac 1) |
|
112 |
apply(erule subst_substs_graph.cases) |
|
113 |
apply(subst test) |
|
114 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
115 |
apply (rule exI) |
2709 | 116 |
apply(assumption) |
117 |
apply(perm_simp) |
|
118 |
apply(rule subst_substs_graph.intros) |
|
119 |
apply(assumption) |
|
120 |
apply(assumption) |
|
121 |
apply(subst test) |
|
122 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
123 |
apply (rule exI) |
2709 | 124 |
apply(assumption) |
125 |
apply(perm_simp) |
|
126 |
apply(rule subst_substs_graph.intros) |
|
127 |
apply(assumption) |
|
128 |
apply(assumption) |
|
129 |
apply(simp) |
|
130 |
--"A" |
|
131 |
apply(simp (no_asm_use) only: eqvts) |
|
132 |
apply(subst test) |
|
133 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
134 |
apply (rule exI) |
2709 | 135 |
apply(assumption) |
136 |
apply(rotate_tac 1) |
|
137 |
apply(erule subst_substs_graph.cases) |
|
138 |
apply(subst test) |
|
139 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
140 |
apply (rule exI) |
2709 | 141 |
apply(assumption) |
142 |
apply(perm_simp) |
|
143 |
apply(rule subst_substs_graph.intros) |
|
144 |
apply(assumption) |
|
145 |
apply(assumption) |
|
146 |
apply(subst test) |
|
147 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
148 |
apply (rule exI) |
2709 | 149 |
apply(assumption) |
150 |
apply(perm_simp) |
|
151 |
apply(rule subst_substs_graph.intros) |
|
152 |
apply(assumption) |
|
153 |
apply(assumption) |
|
154 |
apply(simp) |
|
155 |
--"A" |
|
156 |
apply(simp) |
|
157 |
apply(erule subst_substs_graph.cases) |
|
158 |
apply(simp (no_asm_use) only: eqvts) |
|
159 |
apply(subst test) |
|
160 |
back |
|
161 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
162 |
apply (rule exI) |
2709 | 163 |
apply(assumption) |
164 |
apply(rule subst_substs_graph.intros) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
165 |
apply (simp add: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
166 |
apply (subgoal_tac "(p \<bullet> (atom ` fset xs)) \<sharp>* (p \<bullet> \<theta>)") |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
167 |
apply (simp add: image_eqvt eqvts_raw eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
168 |
apply (simp add: fresh_star_permute_iff) |
2709 | 169 |
apply(perm_simp) |
170 |
apply(assumption) |
|
171 |
apply(simp (no_asm_use) only: eqvts) |
|
172 |
apply(subst test) |
|
173 |
back |
|
174 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
175 |
apply (rule exI) |
2709 | 176 |
apply(assumption) |
177 |
apply(rule subst_substs_graph.intros) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
178 |
apply (simp add: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
179 |
apply (subgoal_tac "(p \<bullet> (atom ` fset xs)) \<sharp>* (p \<bullet> \<theta>)") |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
180 |
apply (simp add: image_eqvt eqvts_raw eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
181 |
apply (simp add: fresh_star_permute_iff) |
2709 | 182 |
apply(perm_simp) |
183 |
apply(assumption) |
|
184 |
apply(simp) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
185 |
--"Eqvt done" |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2805
diff
changeset
|
186 |
apply(rule TrueI) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
187 |
apply (case_tac x) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
188 |
apply simp apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
189 |
apply (rule_tac y="b" in ty_tys.exhaust(1)) |
2787
1a6593bc494d
added eq_iff and distinct lemmas of nominal datatypes to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
2728
diff
changeset
|
190 |
apply (auto)[1] |
1a6593bc494d
added eq_iff and distinct lemmas of nominal datatypes to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
2728
diff
changeset
|
191 |
apply (auto)[1] |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
192 |
apply simp apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
193 |
apply (rule_tac ya="b" and c="a" in ty_tys.strong_exhaust(2)) |
2787
1a6593bc494d
added eq_iff and distinct lemmas of nominal datatypes to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
2728
diff
changeset
|
194 |
apply (auto)[1] |
1a6593bc494d
added eq_iff and distinct lemmas of nominal datatypes to the simplifier
Christian Urban <urbanc@in.tum.de>
parents:
2728
diff
changeset
|
195 |
apply (auto)[5] |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
196 |
--"LAST GOAL" |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
197 |
apply (simp add: meta_eq_to_obj_eq[OF subst_def, symmetric, unfolded fun_eq_iff]) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
198 |
apply (subgoal_tac "eqvt_at (\<lambda>(l, r). subst l r) (\<theta>', T)") |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
199 |
apply (thin_tac "eqvt_at subst_substs_sumC (Inl (\<theta>', T))") |
2867 | 200 |
apply (thin_tac "eqvt_at subst_substs_sumC (Inl (\<theta>', Ta))") |
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
201 |
prefer 2 |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
202 |
apply (simp add: eqvt_at_def subst_def) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
203 |
apply rule |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
204 |
apply (subst test2) |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
205 |
apply (simp add: subst_substs_sumC_def) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
206 |
apply (simp add: THE_default_def) |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
207 |
apply (case_tac "Ex1 (subst_substs_graph (Inl (\<theta>', T)))") |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
208 |
prefer 2 |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
209 |
apply simp |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
210 |
apply (simp add: the1_equality) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
211 |
apply auto[1] |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
212 |
apply (erule_tac x="x" in allE) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
213 |
apply simp |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
214 |
apply(cases rule: subst_substs_graph.cases) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
215 |
apply assumption |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
216 |
apply (rule_tac x="lookup \<theta> X" in exI) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
217 |
apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
218 |
apply (rule the1_equality) |
2867 | 219 |
apply blast apply assumption |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
220 |
apply (rule_tac x="(Fun (Sum_Type.Projl (subst_substs_sum (Inl (\<theta>, T1)))) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
221 |
(Sum_Type.Projl (subst_substs_sum (Inl (\<theta>, T2)))))" in exI) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
222 |
apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
223 |
apply (rule the1_equality) |
2867 | 224 |
apply blast apply assumption |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
225 |
apply clarify |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
226 |
apply simp |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
227 |
--"-" |
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
228 |
apply clarify |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
229 |
apply (frule supp_eqvt_at) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
230 |
apply (simp add: finite_supp) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
231 |
apply (erule Abs_res_fcb) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
232 |
apply (simp add: Abs_fresh_iff) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
233 |
apply (simp add: Abs_fresh_iff) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
234 |
apply auto[1] |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
235 |
apply (simp add: fresh_def fresh_star_def) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
236 |
apply (erule contra_subsetD) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
237 |
apply (simp add: supp_Pair) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
238 |
apply blast |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
239 |
apply clarify |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
240 |
apply (simp) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
241 |
apply (simp add: eqvt_at_def) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
242 |
apply (subst Abs_eq_iff) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
243 |
apply (rule_tac x="0::perm" in exI) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
244 |
apply (subgoal_tac "p \<bullet> \<theta>' = \<theta>'") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
245 |
apply (simp add: alphas fresh_star_zero) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
246 |
apply (subgoal_tac "\<And>x. x \<in> supp (subst \<theta>' (p \<bullet> T)) \<Longrightarrow> x \<in> p \<bullet> atom ` fset xs \<longleftrightarrow> x \<in> atom ` fset xsa") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
247 |
apply blast |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
248 |
apply (subgoal_tac "x \<in> supp(p \<bullet> \<theta>', p \<bullet> T)") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
249 |
apply (simp add: supp_Pair eqvts eqvts_raw) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
250 |
apply auto[1] |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
251 |
apply (subgoal_tac "(atom ` fset (p \<bullet> xs)) \<sharp>* \<theta>'") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
252 |
apply (simp add: fresh_star_def fresh_def) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
253 |
apply(drule_tac p1="p" in iffD2[OF fresh_star_permute_iff]) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
254 |
apply (simp add: eqvts eqvts_raw) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
255 |
apply (simp add: fresh_star_def fresh_def) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
256 |
apply (simp (no_asm) only: supp_eqvt[symmetric] Pair_eqvt[symmetric]) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
257 |
apply (subgoal_tac "p \<bullet> supp (subst \<theta>' T) \<subseteq> p \<bullet> supp (\<theta>', T)") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
258 |
apply (erule subsetD) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
259 |
apply (simp add: supp_eqvt) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
260 |
apply (metis le_eqvt permute_boolI) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
261 |
apply (rule perm_supp_eq) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
262 |
apply (simp add: fresh_def fresh_star_def) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
263 |
apply blast |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
264 |
done |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
265 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
266 |
section {* defined as two separate nominal datatypes *} |
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
267 |
|
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
268 |
nominal_datatype ty2 = |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
269 |
Var2 "name" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
270 |
| Fun2 "ty2" "ty2" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
271 |
|
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
272 |
nominal_datatype tys2 = |
2634
3ce1089cdbf3
changed res keyword to set+ for restrictions; comment by a referee
Christian Urban <urbanc@in.tum.de>
parents:
2630
diff
changeset
|
273 |
All2 xs::"name fset" ty::"ty2" bind (set+) xs in ty |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
2308
diff
changeset
|
274 |
|
2468 | 275 |
thm tys2.distinct |
2630
8268b277d240
automated all strong induction lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
276 |
thm tys2.induct tys2.strong_induct |
2617
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2611
diff
changeset
|
277 |
thm tys2.exhaust tys2.strong_exhaust |
2468 | 278 |
thm tys2.fv_defs |
279 |
thm tys2.bn_defs |
|
280 |
thm tys2.perm_simps |
|
281 |
thm tys2.eq_iff |
|
282 |
thm tys2.fv_bn_eqvt |
|
283 |
thm tys2.size_eqvt |
|
284 |
thm tys2.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
285 |
thm tys2.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
286 |
thm tys2.fresh |
2468 | 287 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
288 |
fun |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
289 |
lookup2 :: "(name \<times> ty2) list \<Rightarrow> name \<Rightarrow> ty2" |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
290 |
where |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
291 |
"lookup2 [] Y = Var2 Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
292 |
| "lookup2 ((X, T) # Ts) Y = (if X = Y then T else lookup2 Ts Y)" |
2556
8ed62410236e
added a test about subtyping; disabled two tests, because of problem with function package
Christian Urban <urbanc@in.tum.de>
parents:
2524
diff
changeset
|
293 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
294 |
lemma lookup2_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
295 |
shows "(p \<bullet> lookup2 Ts T) = lookup2 (p \<bullet> Ts) (p \<bullet> T)" |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
296 |
by (induct Ts T rule: lookup2.induct) simp_all |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
297 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
298 |
nominal_primrec |
2859 | 299 |
subst2 :: "(name \<times> ty2) list \<Rightarrow> ty2 \<Rightarrow> ty2" |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
300 |
where |
2859 | 301 |
"subst2 \<theta> (Var2 X) = lookup2 \<theta> X" |
302 |
| "subst2 \<theta> (Fun2 T1 T2) = Fun2 (subst2 \<theta> T1) (subst2 \<theta> T2)" |
|
303 |
unfolding eqvt_def subst2_graph_def |
|
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
304 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2805
diff
changeset
|
305 |
apply(rule TrueI) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
306 |
apply(case_tac x) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
307 |
apply(rule_tac y="b" in ty2.exhaust) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
308 |
apply(blast) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
309 |
apply(blast) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
310 |
apply(simp_all add: ty2.distinct) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
311 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
312 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
313 |
termination |
2859 | 314 |
by lexicographic_order |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
315 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
316 |
lemma subst_eqvt[eqvt]: |
2859 | 317 |
shows "(p \<bullet> subst2 \<theta> T) = subst2 (p \<bullet> \<theta>) (p \<bullet> T)" |
318 |
by (induct \<theta> T rule: subst2.induct) (simp_all add: lookup2_eqvt) |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
319 |
|
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
320 |
lemma supp_fun_app2_eqvt: |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
321 |
assumes e: "eqvt f" |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
322 |
shows "supp (f a b) \<subseteq> supp a \<union> supp b" |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
323 |
using supp_fun_app_eqvt[OF e] supp_fun_app |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
324 |
by blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
325 |
|
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
326 |
lemma supp_subst: |
2859 | 327 |
"supp (subst2 \<theta> t) \<subseteq> supp \<theta> \<union> supp t" |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
328 |
apply (rule supp_fun_app2_eqvt) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
329 |
unfolding eqvt_def by (simp add: eqvts_raw) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
330 |
|
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
331 |
lemma fresh_star_inter1: |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
332 |
"xs \<sharp>* z \<Longrightarrow> (xs \<inter> ys) \<sharp>* z" |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
333 |
unfolding fresh_star_def by blast |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
334 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
335 |
nominal_primrec |
2859 | 336 |
substs2 :: "(name \<times> ty2) list \<Rightarrow> tys2 \<Rightarrow> tys2" |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
337 |
where |
2859 | 338 |
"fset (map_fset atom xs) \<sharp>* \<theta> \<Longrightarrow> substs2 \<theta> (All2 xs t) = All2 xs (subst2 \<theta> t)" |
339 |
unfolding eqvt_def substs2_graph_def |
|
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
340 |
apply (rule, perm_simp, rule) |
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
parents:
2805
diff
changeset
|
341 |
apply auto[2] |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
342 |
apply (rule_tac y="b" and c="a" in tys2.strong_exhaust) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
343 |
apply auto |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
344 |
apply (erule Abs_res_fcb) |
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
345 |
apply (simp add: Abs_fresh_iff) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
346 |
apply (simp add: Abs_fresh_iff) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
347 |
apply auto[1] |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
348 |
apply (simp add: fresh_def fresh_star_def) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
349 |
apply (rule contra_subsetD[OF supp_subst]) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
350 |
apply simp |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
351 |
apply blast |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
352 |
apply clarify |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
353 |
apply (simp add: subst_eqvt) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
354 |
apply (subst Abs_eq_iff) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
355 |
apply (rule_tac x="0::perm" in exI) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
356 |
apply (subgoal_tac "p \<bullet> \<theta>' = \<theta>'") |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
357 |
apply (simp add: alphas fresh_star_zero) |
2859 | 358 |
apply (subgoal_tac "\<And>x. x \<in> supp (subst2 \<theta>' (p \<bullet> t)) \<Longrightarrow> x \<in> p \<bullet> atom ` fset xs \<longleftrightarrow> x \<in> atom ` fset xsa") |
2804 | 359 |
apply blast |
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
360 |
apply (subgoal_tac "x \<in> supp(p \<bullet> \<theta>', p \<bullet> t)") |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
361 |
apply (simp add: supp_Pair eqvts eqvts_raw) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
362 |
apply auto[1] |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
363 |
apply (subgoal_tac "(atom ` fset (p \<bullet> xs)) \<sharp>* \<theta>'") |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
364 |
apply (simp add: fresh_star_def fresh_def) |
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
365 |
apply(drule_tac p1="p" in iffD2[OF fresh_star_permute_iff]) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
366 |
apply (simp add: eqvts eqvts_raw) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
367 |
apply (simp add: fresh_star_def fresh_def) |
2839
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
368 |
apply (drule subsetD[OF supp_subst]) |
bcf48a1cb24b
abs_res_fcb will be enough to finish the multiple-recursive proof, if we have a working 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2838
diff
changeset
|
369 |
apply (simp add: supp_Pair) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
370 |
apply (rule perm_supp_eq) |
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
371 |
apply (simp add: fresh_def fresh_star_def) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
372 |
apply blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
373 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
374 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
375 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
376 |
text {* Some Tests about Alpha-Equality *} |
1795 | 377 |
|
378 |
lemma |
|
379 |
shows "All {|a, b|} (Fun (Var a) (Var b)) = All {|b, a|} (Fun (Var a) (Var b))" |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
380 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 381 |
apply(rule_tac x="0::perm" in exI) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
382 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 383 |
done |
384 |
||
385 |
lemma |
|
386 |
shows "All {|a, b|} (Fun (Var a) (Var b)) = All {|a, b|} (Fun (Var b) (Var a))" |
|
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
387 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 388 |
apply(rule_tac x="(atom a \<rightleftharpoons> atom b)" in exI) |
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
389 |
apply(simp add: alphas fresh_star_def supp_at_base ty_tys.supp) |
1795 | 390 |
done |
391 |
||
392 |
lemma |
|
393 |
shows "All {|a, b, c|} (Fun (Var a) (Var b)) = All {|a, b|} (Fun (Var a) (Var b))" |
|
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
394 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 395 |
apply(rule_tac x="0::perm" in exI) |
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
396 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 397 |
done |
398 |
||
399 |
lemma |
|
400 |
assumes a: "a \<noteq> b" |
|
401 |
shows "\<not>(All {|a, b|} (Fun (Var a) (Var b)) = All {|c|} (Fun (Var c) (Var c)))" |
|
402 |
using a |
|
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
403 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 404 |
apply(clarify) |
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
405 |
apply(simp add: alphas fresh_star_def ty_tys.eq_iff ty_tys.supp supp_at_base) |
1795 | 406 |
apply auto |
407 |
done |
|
408 |
||
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
409 |
|
1795 | 410 |
|
411 |
||
412 |
end |