author | Christian Urban <urbanc@in.tum.de> |
Tue, 25 Jan 2011 18:58:26 +0100 | |
changeset 2707 | 747ebf2f066d |
parent 2676 | 028d5511c15f |
child 2709 | eb4a2f4078ae |
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 |
||
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
|
7 |
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
|
8 |
|
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
9 |
(* defined as a single nominal datatype *) |
1795 | 10 |
|
11 |
nominal_datatype ty = |
|
12 |
Var "name" |
|
13 |
| Fun "ty" "ty" |
|
14 |
and tys = |
|
2634
3ce1089cdbf3
changed res keyword to set+ for restrictions; comment by a referee
Christian Urban <urbanc@in.tum.de>
parents:
2630
diff
changeset
|
15 |
All xs::"name fset" ty::"ty" bind (set+) xs in ty |
2434 | 16 |
|
2468 | 17 |
thm ty_tys.distinct |
18 |
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
|
19 |
thm ty_tys.inducts |
e44551d067e6
properly exported strong exhaust theorem; cleaned up some examples
Christian Urban <urbanc@in.tum.de>
parents:
2611
diff
changeset
|
20 |
thm ty_tys.exhaust ty_tys.strong_exhaust |
2468 | 21 |
thm ty_tys.fv_defs |
22 |
thm ty_tys.bn_defs |
|
23 |
thm ty_tys.perm_simps |
|
24 |
thm ty_tys.eq_iff |
|
25 |
thm ty_tys.fv_bn_eqvt |
|
26 |
thm ty_tys.size_eqvt |
|
27 |
thm ty_tys.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
28 |
thm ty_tys.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
29 |
thm ty_tys.fresh |
1795 | 30 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
31 |
fun |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
32 |
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
|
33 |
where |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
34 |
"lookup [] Y = Var Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
35 |
| "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
|
36 |
|
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
37 |
lemma lookup_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
38 |
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
|
39 |
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
|
40 |
apply(simp_all) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
41 |
done |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
42 |
|
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
43 |
nominal_primrec |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
44 |
subst :: "(name \<times> ty) list \<Rightarrow> ty \<Rightarrow> ty" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
45 |
and substs :: "(name \<times> ty) list \<Rightarrow> tys \<Rightarrow> tys" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
46 |
where |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
47 |
"subst \<theta> (Var X) = lookup \<theta> X" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
48 |
| "subst \<theta> (Fun T1 T2) = Fun (subst \<theta> T1) (subst \<theta> T2)" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
49 |
| "fset (map_fset atom xs) \<sharp>* \<theta> \<Longrightarrow> substs \<theta> (All xs T) = All xs (subst \<theta> T)" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
50 |
term subst_substs_sumC |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
51 |
term Inl |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
52 |
thm subst_substs_graph.induct |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
53 |
thm subst_substs_graph.intros |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
54 |
thm Projl.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
55 |
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
|
56 |
apply(simp add: eqvt_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
57 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
58 |
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
|
59 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
60 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
61 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
66 |
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
|
67 |
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
|
68 |
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
|
69 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
70 |
thm subst_substs_graph.induct |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
71 |
thm subst_substs_graph.intros |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
72 |
thm Projl.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
73 |
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
|
74 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
75 |
apply(rule subst_substs_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
76 |
apply(simp only: eqvts) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
77 |
thm Projl.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
78 |
term Inl |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
79 |
term Inr |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
80 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
81 |
thm subst_substs_graph.intros |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
82 |
thm Projl.simps |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
83 |
oops |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
84 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
85 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
86 |
section {* defined as two separate nominal datatypes *} |
2486
b4ea19604b0b
cleaned up two examples
Christian Urban <urbanc@in.tum.de>
parents:
2480
diff
changeset
|
87 |
|
2308
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
88 |
nominal_datatype ty2 = |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
89 |
Var2 "name" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
90 |
| Fun2 "ty2" "ty2" |
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
91 |
|
387fcbd33820
fixed problem with bn_info
Christian Urban <urbanc@in.tum.de>
parents:
2181
diff
changeset
|
92 |
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
|
93 |
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
|
94 |
|
2468 | 95 |
thm tys2.distinct |
2630
8268b277d240
automated all strong induction lemmas
Christian Urban <urbanc@in.tum.de>
parents:
2622
diff
changeset
|
96 |
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
|
97 |
thm tys2.exhaust tys2.strong_exhaust |
2468 | 98 |
thm tys2.fv_defs |
99 |
thm tys2.bn_defs |
|
100 |
thm tys2.perm_simps |
|
101 |
thm tys2.eq_iff |
|
102 |
thm tys2.fv_bn_eqvt |
|
103 |
thm tys2.size_eqvt |
|
104 |
thm tys2.supports |
|
2493
2e174807c891
added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents:
2486
diff
changeset
|
105 |
thm tys2.supp |
2494
11133eb76f61
added Foo1 to explore a contrived example
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
106 |
thm tys2.fresh |
2468 | 107 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
108 |
fun |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
109 |
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
|
110 |
where |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
111 |
"lookup2 [] Y = Var2 Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
112 |
| "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
|
113 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
114 |
lemma lookup2_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
115 |
shows "(p \<bullet> lookup2 Ts T) = lookup2 (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
|
116 |
apply(induct Ts T rule: lookup2.induct) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
117 |
apply(simp_all) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
118 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
119 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
120 |
nominal_primrec |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
121 |
subst :: "(name \<times> ty2) list \<Rightarrow> ty2 \<Rightarrow> ty2" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
122 |
where |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
123 |
"subst \<theta> (Var2 X) = lookup2 \<theta> X" |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
124 |
| "subst \<theta> (Fun2 T1 T2) = Fun2 (subst \<theta> T1) (subst \<theta> T2)" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
125 |
defer |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
126 |
apply(case_tac x) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
127 |
apply(simp) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
128 |
apply(rule_tac y="b" in ty2.exhaust) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
129 |
apply(blast) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
130 |
apply(blast) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
131 |
apply(simp_all add: ty2.distinct) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
132 |
apply(simp add: ty2.eq_iff) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
133 |
apply(simp add: ty2.eq_iff) |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
134 |
apply(subgoal_tac "\<And>p x r. subst_graph x r \<Longrightarrow> subst_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
|
135 |
apply(simp add: eqvt_def) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
136 |
apply(rule allI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
137 |
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
|
138 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
139 |
apply(rule ext) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
140 |
apply(rule iffI) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
141 |
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
|
142 |
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
|
143 |
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
|
144 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
145 |
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
|
146 |
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
|
147 |
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
|
148 |
apply(simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
149 |
apply(erule subst_graph.induct) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
150 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
151 |
apply(rule subst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
152 |
apply(perm_simp) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
153 |
apply(rule subst_graph.intros) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
154 |
apply(assumption) |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
155 |
apply(assumption) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
156 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
157 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
158 |
termination |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
159 |
apply(relation "measure (size o snd)") |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
160 |
apply(simp_all add: ty2.size) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
161 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
162 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
163 |
lemma subst_eqvt[eqvt]: |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
164 |
shows "(p \<bullet> subst \<theta> T) = subst (p \<bullet> \<theta>) (p \<bullet> T)" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
165 |
apply(induct \<theta> T rule: subst.induct) |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
166 |
apply(simp_all add: lookup2_eqvt) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
167 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
168 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
169 |
lemma j: |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
170 |
assumes "a \<sharp> Ts" " a \<sharp> X" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
171 |
shows "a \<sharp> lookup2 Ts X" |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
172 |
using assms |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
173 |
apply(induct Ts X rule: lookup2.induct) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
174 |
apply(auto simp add: ty2.fresh fresh_Cons fresh_Pair) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
175 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
176 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
177 |
lemma i: |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
178 |
assumes "a \<sharp> t" " a \<sharp> \<theta>" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
179 |
shows "a \<sharp> subst \<theta> t" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
180 |
using assms |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
181 |
apply(induct \<theta> t rule: subst.induct) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
182 |
apply(auto simp add: ty2.fresh j) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
183 |
done |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
184 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
185 |
lemma k: |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
186 |
assumes "as \<sharp>* t" " as \<sharp>* \<theta>" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
187 |
shows "as \<sharp>* subst \<theta> t" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
188 |
using assms |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
189 |
by (simp add: fresh_star_def i) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
190 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
191 |
lemma h: |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
192 |
assumes "as \<subseteq> bs \<union> cs" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
193 |
and " cs \<sharp>* x" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
194 |
shows "(as - bs) \<sharp>* x" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
195 |
using assms |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
196 |
by (auto simp add: fresh_star_def) |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
197 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
198 |
nominal_primrec |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
199 |
substs :: "(name \<times> ty2) list \<Rightarrow> tys2 \<Rightarrow> tys2" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
200 |
where |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
201 |
"fset (map_fset atom xs) \<sharp>* \<theta> \<Longrightarrow> substs \<theta> (All2 xs t) = All2 xs (subst \<theta> t)" |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
202 |
oops |
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
203 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
204 |
|
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
205 |
text {* Some Tests about Alpha-Equality *} |
1795 | 206 |
|
207 |
lemma |
|
208 |
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
|
209 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 210 |
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
|
211 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 212 |
done |
213 |
||
214 |
lemma |
|
215 |
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
|
216 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 217 |
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
|
218 |
apply(simp add: alphas fresh_star_def supp_at_base ty_tys.supp) |
1795 | 219 |
done |
220 |
||
221 |
lemma |
|
222 |
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
|
223 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 224 |
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
|
225 |
apply(simp add: alphas fresh_star_def ty_tys.supp supp_at_base) |
1795 | 226 |
done |
227 |
||
228 |
lemma |
|
229 |
assumes a: "a \<noteq> b" |
|
230 |
shows "\<not>(All {|a, b|} (Fun (Var a) (Var b)) = All {|c|} (Fun (Var c) (Var c)))" |
|
231 |
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
|
232 |
apply(simp add: ty_tys.eq_iff Abs_eq_iff) |
1795 | 233 |
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
|
234 |
apply(simp add: alphas fresh_star_def ty_tys.eq_iff ty_tys.supp supp_at_base) |
1795 | 235 |
apply auto |
236 |
done |
|
237 |
||
2566
a59d8e1e3a17
moved rest of the lemmas from Nominal2_FSet to the TypeScheme example
Christian Urban <urbanc@in.tum.de>
parents:
2556
diff
changeset
|
238 |
|
1795 | 239 |
|
240 |
||
241 |
end |