author | Christian Urban <urbanc@in.tum.de> |
Wed, 22 Jun 2011 12:18:22 +0100 | |
changeset 2885 | 1264f2a21ea9 |
parent 2867 | 39ae45d3a11b |
child 2886 | d7066575cbb9 |
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 |
||
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
7 |
datatype foo = |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
8 |
Foo1 |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
9 |
| Foo2 bar |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
10 |
and bar = |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
11 |
Bar |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
12 |
|
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
13 |
ML {* #induct (Datatype_Data.the_info @{theory} "TypeSchemes.bar") *} |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
14 |
|
2709 | 15 |
|
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
|
16 |
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
|
17 |
|
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
18 |
(* defined as a single nominal datatype *) |
1795 | 19 |
|
20 |
nominal_datatype ty = |
|
21 |
Var "name" |
|
22 |
| Fun "ty" "ty" |
|
23 |
and tys = |
|
2714
908750991c2f
Experiments with substitution on set+
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2711
diff
changeset
|
24 |
All xs::"name fset" ty::"ty" bind (set+) xs in ty |
2434 | 25 |
|
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
26 |
ML {* |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
27 |
get_all_info @{context} |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
28 |
*} |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
29 |
|
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
30 |
ML {* |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
31 |
get_info @{context} "TypeSchemes.ty" |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
32 |
*} |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
33 |
|
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
34 |
ML {* |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
35 |
#strong_exhaust (the_info @{context} "TypeSchemes.tys") |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
36 |
*} |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
37 |
|
2468 | 38 |
thm ty_tys.distinct |
39 |
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
|
40 |
thm ty_tys.inducts |
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
41 |
thm ty_tys.exhaust |
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
42 |
thm ty_tys.strong_exhaust |
2468 | 43 |
thm ty_tys.fv_defs |
44 |
thm ty_tys.bn_defs |
|
45 |
thm ty_tys.perm_simps |
|
46 |
thm ty_tys.eq_iff |
|
47 |
thm ty_tys.fv_bn_eqvt |
|
48 |
thm ty_tys.size_eqvt |
|
49 |
thm ty_tys.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
50 |
thm ty_tys.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
51 |
thm ty_tys.fresh |
1795 | 52 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
53 |
fun |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
54 |
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
|
55 |
where |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
56 |
"lookup [] Y = Var Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
57 |
| "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
|
58 |
|
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
59 |
lemma lookup_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
60 |
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
|
61 |
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
|
62 |
apply(simp_all) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
63 |
done |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
64 |
|
2709 | 65 |
lemma test: |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
66 |
assumes a: "\<exists>y. f x = Inl y" |
2709 | 67 |
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
|
68 |
using a |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
69 |
apply clarify |
2709 | 70 |
apply(frule_tac p="p" in permute_boolI) |
71 |
apply(simp (no_asm_use) only: eqvts) |
|
72 |
apply(subst (asm) permute_fun_app_eq) |
|
73 |
back |
|
74 |
apply(simp) |
|
75 |
done |
|
76 |
||
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
77 |
lemma test2: |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
78 |
assumes a: "\<exists>y. f x = Inl y" |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
79 |
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
|
80 |
using a |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
81 |
apply clarify |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
82 |
apply(frule_tac p="p" in permute_boolI) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
83 |
apply(simp (no_asm_use) only: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
84 |
apply(subst (asm) permute_fun_app_eq) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
85 |
back |
2709 | 86 |
apply(simp) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
87 |
done |
2709 | 88 |
|
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
|
89 |
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
|
90 |
subst :: "(name \<times> ty) list \<Rightarrow> ty \<Rightarrow> ty" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
91 |
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
|
92 |
where |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
93 |
"subst \<theta> (Var X) = lookup \<theta> X" |
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
94 |
| "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
|
95 |
| "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
|
96 |
(*unfolding subst_substs_graph_def eqvt_def |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
97 |
apply rule |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
98 |
apply perm_simp |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
99 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
100 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
101 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
102 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
103 |
apply (subst test3) |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
104 |
defer |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
105 |
apply rule*) |
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
106 |
thm subst_substs_graph.intros |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
107 |
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
|
108 |
apply(simp add: eqvt_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
109 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
110 |
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
|
111 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
112 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
113 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
apply(simp) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
122 |
--"Eqvt One way" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
123 |
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
|
124 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
125 |
apply(rule subst_substs_graph.intros) |
2709 | 126 |
apply(erule subst_substs_graph.cases) |
127 |
apply(simp (no_asm_use) only: eqvts) |
|
128 |
apply(subst test) |
|
129 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
130 |
apply (rule exI) |
2709 | 131 |
apply(assumption) |
132 |
apply(rotate_tac 1) |
|
133 |
apply(erule subst_substs_graph.cases) |
|
134 |
apply(subst test) |
|
135 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
136 |
apply (rule exI) |
2709 | 137 |
apply(assumption) |
138 |
apply(perm_simp) |
|
139 |
apply(rule subst_substs_graph.intros) |
|
140 |
apply(assumption) |
|
141 |
apply(assumption) |
|
142 |
apply(subst test) |
|
143 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
144 |
apply (rule exI) |
2709 | 145 |
apply(assumption) |
146 |
apply(perm_simp) |
|
147 |
apply(rule subst_substs_graph.intros) |
|
148 |
apply(assumption) |
|
149 |
apply(assumption) |
|
150 |
apply(simp) |
|
151 |
--"A" |
|
152 |
apply(simp (no_asm_use) only: eqvts) |
|
153 |
apply(subst test) |
|
154 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
155 |
apply (rule exI) |
2709 | 156 |
apply(assumption) |
157 |
apply(rotate_tac 1) |
|
158 |
apply(erule subst_substs_graph.cases) |
|
159 |
apply(subst test) |
|
160 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
161 |
apply (rule exI) |
2709 | 162 |
apply(assumption) |
163 |
apply(perm_simp) |
|
164 |
apply(rule subst_substs_graph.intros) |
|
165 |
apply(assumption) |
|
166 |
apply(assumption) |
|
167 |
apply(subst test) |
|
168 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
169 |
apply (rule exI) |
2709 | 170 |
apply(assumption) |
171 |
apply(perm_simp) |
|
172 |
apply(rule subst_substs_graph.intros) |
|
173 |
apply(assumption) |
|
174 |
apply(assumption) |
|
175 |
apply(simp) |
|
176 |
--"A" |
|
177 |
apply(simp) |
|
178 |
apply(erule subst_substs_graph.cases) |
|
179 |
apply(simp (no_asm_use) only: eqvts) |
|
180 |
apply(subst test) |
|
181 |
back |
|
182 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
183 |
apply (rule exI) |
2709 | 184 |
apply(assumption) |
185 |
apply(rule subst_substs_graph.intros) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
186 |
apply (simp add: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
187 |
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
|
188 |
apply (simp add: image_eqvt eqvts_raw eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
189 |
apply (simp add: fresh_star_permute_iff) |
2709 | 190 |
apply(perm_simp) |
191 |
apply(assumption) |
|
192 |
apply(simp (no_asm_use) only: eqvts) |
|
193 |
apply(subst test) |
|
194 |
back |
|
195 |
back |
|
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
196 |
apply (rule exI) |
2709 | 197 |
apply(assumption) |
198 |
apply(rule subst_substs_graph.intros) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
199 |
apply (simp add: eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
200 |
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
|
201 |
apply (simp add: image_eqvt eqvts_raw eqvts) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
202 |
apply (simp add: fresh_star_permute_iff) |
2709 | 203 |
apply(perm_simp) |
204 |
apply(assumption) |
|
205 |
apply(simp) |
|
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
206 |
--"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
|
207 |
apply(rule TrueI) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
208 |
apply (case_tac x) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
209 |
apply simp apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
210 |
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
|
211 |
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
|
212 |
apply (auto)[1] |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
213 |
apply simp apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
214 |
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
|
215 |
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
|
216 |
apply (auto)[5] |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
217 |
--"LAST GOAL" |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
218 |
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
|
219 |
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
|
220 |
apply (thin_tac "eqvt_at subst_substs_sumC (Inl (\<theta>', T))") |
2867 | 221 |
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
|
222 |
prefer 2 |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
223 |
apply (simp add: eqvt_at_def subst_def) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
224 |
apply rule |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
225 |
apply (subst test2) |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
226 |
apply (simp add: subst_substs_sumC_def) |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
227 |
apply (simp add: THE_default_def) |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
228 |
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
|
229 |
prefer 2 |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
230 |
apply simp |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
231 |
apply (simp add: the1_equality) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
232 |
apply auto[1] |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
233 |
apply (erule_tac x="x" in allE) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
234 |
apply simp |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
235 |
apply(cases rule: subst_substs_graph.cases) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
236 |
apply assumption |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
237 |
apply (rule_tac x="lookup \<theta> X" in exI) |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
238 |
apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
239 |
apply (rule the1_equality) |
2867 | 240 |
apply blast apply assumption |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
241 |
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
|
242 |
(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
|
243 |
apply clarify |
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
244 |
apply (rule the1_equality) |
2867 | 245 |
apply blast apply assumption |
2710
7eebe0d5d298
Experiments with functions
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2709
diff
changeset
|
246 |
apply clarify |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
247 |
apply simp |
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
248 |
--"-" |
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
|
249 |
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
|
250 |
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
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
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
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
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
|
281 |
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
|
282 |
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
|
283 |
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
|
284 |
apply blast |
2850
354a930ef18f
TypeSchemes work with 'default'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2848
diff
changeset
|
285 |
done |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
286 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
287 |
section {* defined as two separate nominal datatypes *} |
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
288 |
|
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
289 |
nominal_datatype ty2 = |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
290 |
Var2 "name" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
291 |
| Fun2 "ty2" "ty2" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
292 |
|
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
293 |
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
|
294 |
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
|
295 |
|
2468 | 296 |
thm tys2.distinct |
2630
8268b277d240
automated all strong induction lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
297 |
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
|
298 |
thm tys2.exhaust tys2.strong_exhaust |
2468 | 299 |
thm tys2.fv_defs |
300 |
thm tys2.bn_defs |
|
301 |
thm tys2.perm_simps |
|
302 |
thm tys2.eq_iff |
|
303 |
thm tys2.fv_bn_eqvt |
|
304 |
thm tys2.size_eqvt |
|
305 |
thm tys2.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
306 |
thm tys2.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
307 |
thm tys2.fresh |
2468 | 308 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
309 |
fun |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
310 |
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
|
311 |
where |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
312 |
"lookup2 [] Y = Var2 Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
313 |
| "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
|
314 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
315 |
lemma lookup2_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
316 |
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
|
317 |
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
|
318 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
319 |
nominal_primrec |
2859 | 320 |
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
|
321 |
where |
2859 | 322 |
"subst2 \<theta> (Var2 X) = lookup2 \<theta> X" |
323 |
| "subst2 \<theta> (Fun2 T1 T2) = Fun2 (subst2 \<theta> T1) (subst2 \<theta> T2)" |
|
324 |
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
|
325 |
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
|
326 |
apply(rule TrueI) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
327 |
apply(case_tac x) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
328 |
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
|
329 |
apply(blast) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
330 |
apply(blast) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
331 |
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
|
332 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
333 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
334 |
termination |
2859 | 335 |
by lexicographic_order |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
336 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
337 |
lemma subst_eqvt[eqvt]: |
2859 | 338 |
shows "(p \<bullet> subst2 \<theta> T) = subst2 (p \<bullet> \<theta>) (p \<bullet> T)" |
339 |
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
|
340 |
|
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
341 |
lemma supp_fun_app2_eqvt: |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
342 |
assumes e: "eqvt f" |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
by blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
346 |
|
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
347 |
lemma supp_subst: |
2859 | 348 |
"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
|
349 |
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
|
350 |
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
|
351 |
|
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
352 |
lemma fresh_star_inter1: |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
353 |
"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
|
354 |
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
|
355 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
356 |
nominal_primrec |
2859 | 357 |
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
|
358 |
where |
2859 | 359 |
"fset (map_fset atom xs) \<sharp>* \<theta> \<Longrightarrow> substs2 \<theta> (All2 xs t) = All2 xs (subst2 \<theta> t)" |
360 |
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
|
361 |
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
|
362 |
apply auto[2] |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
363 |
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
|
364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
apply blast |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
373 |
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
|
374 |
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
|
375 |
apply (subst Abs_eq_iff) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
376 |
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
|
377 |
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
|
378 |
apply (simp add: alphas fresh_star_zero) |
2859 | 379 |
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 | 380 |
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
|
381 |
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
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
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
|
389 |
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
|
390 |
apply (simp add: supp_Pair) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
391 |
apply (rule perm_supp_eq) |
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
392 |
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
|
393 |
apply blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
394 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
395 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
396 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
397 |
text {* Some Tests about Alpha-Equality *} |
1795 | 398 |
|
399 |
lemma |
|
400 |
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
|
401 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 402 |
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
|
403 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 404 |
done |
405 |
||
406 |
lemma |
|
407 |
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
|
408 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 409 |
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
|
410 |
apply(simp add: alphas fresh_star_def supp_at_base ty_tys.supp) |
1795 | 411 |
done |
412 |
||
413 |
lemma |
|
414 |
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
|
415 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 416 |
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
|
417 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 418 |
done |
419 |
||
420 |
lemma |
|
421 |
assumes a: "a \<noteq> b" |
|
422 |
shows "\<not>(All {|a, b|} (Fun (Var a) (Var b)) = All {|c|} (Fun (Var c) (Var c)))" |
|
423 |
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
|
424 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 425 |
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
|
426 |
apply(simp add: alphas fresh_star_def ty_tys.eq_iff ty_tys.supp supp_at_base) |
1795 | 427 |
apply auto |
428 |
done |
|
429 |
||
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
430 |
|
1795 | 431 |
|
432 |
||
433 |
end |