author | Christian Urban <urbanc@in.tum.de> |
Mon, 04 Jun 2012 21:39:51 +0100 | |
changeset 3183 | 313e6f2cdd89 |
parent 3109 | d79e936e30ea |
child 3197 | 25d11b449e92 |
permissions | -rw-r--r-- |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
1 |
theory TypeSchemes1 |
2454
9ffee4eb1ae1
renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
2 |
imports "../Nominal2" |
1795 | 3 |
begin |
4 |
||
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
5 |
section {* Type Schemes defined as two separate nominal datatypes *} |
1795 | 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 |
|
1795 | 9 |
nominal_datatype ty = |
10 |
Var "name" |
|
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
11 |
| Fun "ty" "ty" ("_ \<rightarrow> _") |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
12 |
|
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
13 |
nominal_datatype tys = |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
14 |
All xs::"name fset" ty::"ty" binds (set+) xs in ty ("All [_]._") |
2434 | 15 |
|
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
16 |
thm tys.distinct |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
17 |
thm tys.induct tys.strong_induct |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
18 |
thm tys.exhaust tys.strong_exhaust |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
19 |
thm tys.fv_defs |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
20 |
thm tys.bn_defs |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
21 |
thm tys.perm_simps |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
22 |
thm tys.eq_iff |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
23 |
thm tys.fv_bn_eqvt |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
24 |
thm tys.size_eqvt |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
25 |
thm tys.supports |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
26 |
thm tys.supp |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
27 |
thm tys.fresh |
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
parents:
2867
diff
changeset
|
28 |
|
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
29 |
subsection {* Some Tests about Alpha-Equality *} |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
30 |
|
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
31 |
lemma |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
32 |
shows "All [{|a, b|}].((Var a) \<rightarrow> (Var b)) = All [{|b, a|}]. ((Var a) \<rightarrow> (Var b))" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
33 |
apply(simp add: Abs_eq_iff) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
34 |
apply(rule_tac x="0::perm" in exI) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
35 |
apply(simp add: alphas fresh_star_def ty.supp supp_at_base) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
36 |
done |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
37 |
|
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
38 |
lemma |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
39 |
shows "All [{|a, b|}].((Var a) \<rightarrow> (Var b)) = All [{|a, b|}].((Var b) \<rightarrow> (Var a))" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
40 |
apply(simp add: Abs_eq_iff) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
41 |
apply(rule_tac x="(atom a \<rightleftharpoons> atom b)" in exI) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
42 |
apply(simp add: alphas fresh_star_def supp_at_base ty.supp) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
43 |
done |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
44 |
|
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
45 |
lemma |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
46 |
shows "All [{|a, b, c|}].((Var a) \<rightarrow> (Var b)) = All [{|a, b|}].((Var a) \<rightarrow> (Var b))" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
47 |
apply(simp add: Abs_eq_iff) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
48 |
apply(rule_tac x="0::perm" in exI) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
49 |
apply(simp add: alphas fresh_star_def ty.supp supp_at_base) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
50 |
done |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
51 |
|
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
52 |
lemma |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
53 |
assumes a: "a \<noteq> b" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
54 |
shows "\<not>(All [{|a, b|}].((Var a) \<rightarrow> (Var b)) = All [{|c|}].((Var c) \<rightarrow> (Var c)))" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
55 |
using a |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
56 |
apply(simp add: Abs_eq_iff) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
57 |
apply(clarify) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
58 |
apply(simp add: alphas fresh_star_def ty.supp supp_at_base) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
59 |
apply auto |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
60 |
done |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
61 |
|
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
62 |
|
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
63 |
subsection {* Substitution function for types and type schemes *} |
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
64 |
|
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
65 |
type_synonym |
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
66 |
Subst = "(name \<times> ty) list" |
1795 | 67 |
|
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
68 |
fun |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
69 |
lookup :: "Subst \<Rightarrow> name \<Rightarrow> ty" |
2707
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
70 |
where |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
71 |
"lookup [] Y = Var Y" |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
72 |
| "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
|
73 |
|
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
74 |
lemma lookup_eqvt[eqvt]: |
747ebf2f066d
made eqvt-proof explicit in the function definitions
Christian Urban <urbanc@in.tum.de>
parents:
2676
diff
changeset
|
75 |
shows "(p \<bullet> lookup Ts T) = lookup (p \<bullet> Ts) (p \<bullet> T)" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
76 |
by (induct Ts T rule: lookup.induct) (simp_all) |
2981 | 77 |
|
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
78 |
nominal_primrec |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
79 |
subst :: "Subst \<Rightarrow> ty \<Rightarrow> ty" ("_<_>" [100,60] 120) |
2838
36544bac1659
More experiments with 'default'
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2836
diff
changeset
|
80 |
where |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
81 |
"\<theta><Var X> = lookup \<theta> X" |
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
82 |
| "\<theta><T1 \<rightarrow> T2> = (\<theta><T1>) \<rightarrow> (\<theta><T2>)" |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
83 |
unfolding eqvt_def subst_graph_def |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
84 |
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
|
85 |
apply(rule TrueI) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
86 |
apply(case_tac x) |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
87 |
apply(rule_tac y="b" in ty.exhaust) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
88 |
apply(blast) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
89 |
apply(blast) |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
90 |
apply(simp_all) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
91 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
92 |
|
2973
d1038e67923a
added a flag (eqvt) to termination proofs arising fron nominal_primrecs
Christian Urban <urbanc@in.tum.de>
parents:
2950
diff
changeset
|
93 |
termination (eqvt) |
2859 | 94 |
by lexicographic_order |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
95 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
96 |
lemma subst_id1: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
97 |
fixes T::"ty" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
98 |
shows "[]<T> = T" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
99 |
by (induct T rule: ty.induct) (simp_all) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
100 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
101 |
lemma subst_id2: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
102 |
fixes T::"ty" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
103 |
shows "[(X, Var X)]<T> = T" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
104 |
by (induct T rule: ty.induct) (simp_all) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
105 |
|
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
106 |
lemma supp_fun_app_eqvt: |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
107 |
assumes e: "eqvt f" |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
108 |
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
|
109 |
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
|
110 |
by blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
111 |
|
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
112 |
lemma supp_subst: |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
113 |
"supp (subst \<theta> t) \<subseteq> supp \<theta> \<union> supp t" |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
114 |
apply (rule supp_fun_app_eqvt) |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
115 |
unfolding eqvt_def |
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
116 |
by (simp add: permute_fun_def subst.eqvt) |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
117 |
|
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
118 |
nominal_primrec |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
119 |
substs :: "(name \<times> ty) list \<Rightarrow> tys \<Rightarrow> tys" ("_<_>" [100,60] 120) |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
120 |
where |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
121 |
"fset (map_fset atom Xs) \<sharp>* \<theta> \<Longrightarrow> \<theta><All [Xs].T> = All [Xs].(\<theta><T>)" |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
122 |
unfolding eqvt_def substs_graph_def |
2801
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
123 |
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
|
124 |
apply auto[2] |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
125 |
apply (rule_tac y="b" and c="a" in tys.strong_exhaust) |
2982
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
126 |
apply auto[1] |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
127 |
apply(simp) |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
128 |
apply(erule conjE) |
2830
297cff1d1048
FCB for res binding and simplified proof of subst for type schemes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2822
diff
changeset
|
129 |
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
|
130 |
apply (simp add: Abs_fresh_iff) |
2982
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
131 |
apply(simp add: fresh_def) |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
132 |
apply(simp add: supp_Abs) |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
133 |
apply(rule impI) |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
134 |
apply(subgoal_tac "x \<notin> supp \<theta>") |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
135 |
prefer 2 |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
136 |
apply(auto simp add: fresh_star_def fresh_def)[1] |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
137 |
apply(subgoal_tac "x \<in> supp T") |
2982
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
138 |
using supp_subst |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
139 |
apply(blast) |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
140 |
using supp_subst |
4a00077c008f
completed the eqvt-proofs for functions; they are stored under the name function_name.eqvt and added to the eqvt-list
Christian Urban <urbanc@in.tum.de>
parents:
2981
diff
changeset
|
141 |
apply(blast) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
142 |
apply clarify |
3100
8779fb01d8b4
separated the two versions of type schemes into two files
Christian Urban <urbanc@in.tum.de>
parents:
2982
diff
changeset
|
143 |
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
|
144 |
apply (subst Abs_eq_iff) |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
145 |
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
|
146 |
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
|
147 |
apply (simp add: alphas fresh_star_zero) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
148 |
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") |
3183
313e6f2cdd89
added permutation simplification to the simplifier; this makes the simplifier more powerful, but it potentially loops more often
Christian Urban <urbanc@in.tum.de>
parents:
3109
diff
changeset
|
149 |
apply(simp) |
2804 | 150 |
apply blast |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
151 |
apply (subgoal_tac "x \<in> supp(p \<bullet> \<theta>', p \<bullet> T)") |
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
|
152 |
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
|
153 |
apply auto[1] |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
154 |
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
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
apply (simp add: supp_Pair) |
2832
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
161 |
apply (rule perm_supp_eq) |
76db0b854bf6
Simpler proof of TypeSchemes/substs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2831
diff
changeset
|
162 |
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
|
163 |
apply blast |
5ecb857e9de7
proved subst for All constructor in type schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
2787
diff
changeset
|
164 |
done |
2676
028d5511c15f
some tryes about substitution over type-schemes
Christian Urban <urbanc@in.tum.de>
parents:
2634
diff
changeset
|
165 |
|
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
166 |
termination (eqvt) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
167 |
by (lexicographic_order) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
168 |
|
1795 | 169 |
|
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
170 |
subsection {* Generalisation of types and type-schemes*} |
1795 | 171 |
|
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
172 |
fun |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
173 |
subst_Dom_pi :: "Subst \<Rightarrow> perm \<Rightarrow> Subst" ("_|_") |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
174 |
where |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
175 |
"[]|p = []" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
176 |
| "((X,T)#\<theta>)|p = (p \<bullet> X, T)#(\<theta>|p)" |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
177 |
|
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
178 |
fun |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
179 |
subst_subst :: "Subst \<Rightarrow> Subst \<Rightarrow> Subst" ("_<_>" [100,60] 120) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
180 |
where |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
181 |
"\<theta><[]> = []" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
182 |
| "\<theta> <((X,T)#\<theta>')> = (X,\<theta><T>)#(\<theta><\<theta>'>)" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
183 |
|
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
184 |
fun |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
185 |
Dom :: "Subst \<Rightarrow> name set" |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
186 |
where |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
187 |
"Dom [] = {}" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
188 |
| "Dom ((X,T)#\<theta>) = {X} \<union> Dom \<theta>" |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
189 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
190 |
lemma Dom_eqvt[eqvt]: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
191 |
shows "p \<bullet> (Dom \<theta>) = Dom (p \<bullet> \<theta>)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
192 |
apply (induct \<theta> rule: Dom.induct) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
193 |
apply (simp_all add: permute_set_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
194 |
apply (auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
195 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
196 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
197 |
lemma Dom_subst: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
198 |
fixes \<theta>1 \<theta>2::"Subst" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
199 |
shows "Dom (\<theta>2<\<theta>1>) = (Dom \<theta>1)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
200 |
by (induct \<theta>1) (auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
201 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
202 |
lemma Dom_pi: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
203 |
shows "Dom (\<theta>|p) = Dom (p \<bullet> \<theta>)" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
204 |
by (induct \<theta>) (auto) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
205 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
206 |
lemma Dom_fresh_lookup: |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
207 |
fixes \<theta>::"Subst" |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
208 |
assumes "\<forall>Y \<in> Dom \<theta>. atom Y \<sharp> X" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
209 |
shows "lookup \<theta> X = Var X" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
210 |
using assms |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
211 |
by (induct \<theta>) (auto simp add: fresh_at_base) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
212 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
213 |
lemma Dom_fresh_ty: |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
214 |
fixes \<theta>::"Subst" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
215 |
and T::"ty" |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
216 |
assumes "\<forall>X \<in> Dom \<theta>. atom X \<sharp> T" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
217 |
shows "\<theta><T> = T" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
218 |
using assms |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
219 |
by (induct T rule: ty.induct) (auto simp add: ty.fresh Dom_fresh_lookup) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
220 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
221 |
lemma Dom_fresh_subst: |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
222 |
fixes \<theta> \<theta>'::"Subst" |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
223 |
assumes "\<forall>X \<in> Dom \<theta>. atom X \<sharp> \<theta>'" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
224 |
shows "\<theta><\<theta>'> = \<theta>'" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
225 |
using assms |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
226 |
by (induct \<theta>') (auto simp add: fresh_Pair fresh_Cons Dom_fresh_ty) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
227 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
228 |
lemma s1: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
229 |
assumes "name \<in> Dom \<theta>" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
230 |
shows "lookup \<theta> name = lookup \<theta>|p (p \<bullet> name)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
231 |
using assms |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
232 |
apply(induct \<theta>) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
233 |
apply(auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
234 |
done |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
235 |
|
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
236 |
lemma lookup_fresh: |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
237 |
fixes X::"name" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
238 |
assumes a: "atom X \<sharp> \<theta>" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
239 |
shows "lookup \<theta> X = Var X" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
240 |
using a |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
241 |
by (induct \<theta>) (auto simp add: fresh_Cons fresh_Pair fresh_at_base) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
242 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
243 |
lemma lookup_Dom: |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
244 |
fixes X::"name" |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
245 |
assumes "X \<notin> Dom \<theta>" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
246 |
shows "lookup \<theta> X = Var X" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
247 |
using assms |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
248 |
by (induct \<theta>) (auto) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
249 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
250 |
lemma t: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
251 |
fixes T::"ty" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
252 |
assumes a: "(supp T - atom ` Dom \<theta>) \<sharp>* p" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
253 |
shows "\<theta><T> = \<theta>|p<p \<bullet> T>" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
254 |
using a |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
255 |
apply(induct T rule: ty.induct) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
256 |
defer |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
257 |
apply(simp add: ty.supp fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
258 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
259 |
apply(case_tac "name \<in> Dom \<theta>") |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
260 |
apply(rule s1) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
261 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
262 |
apply(subst lookup_Dom) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
263 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
264 |
apply(subst lookup_Dom) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
265 |
apply(simp add: Dom_pi) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
266 |
apply(rule_tac p="- p" in permute_boolE) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
267 |
apply(perm_simp add: permute_minus_cancel) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
268 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
269 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
270 |
apply(simp add: ty.supp supp_at_base) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
271 |
apply(simp add: fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
272 |
apply(drule_tac x="atom name" in bspec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
273 |
apply(auto)[1] |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
274 |
apply(simp add: fresh_def supp_perm) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
275 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
276 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
277 |
nominal_primrec |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
278 |
generalises :: "ty \<Rightarrow> tys \<Rightarrow> bool" ("_ \<prec>\<prec> _") |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
279 |
where |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
280 |
"atom ` (fset Xs) \<sharp>* T \<Longrightarrow> |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
281 |
T \<prec>\<prec> All [Xs].T' \<longleftrightarrow> (\<exists>\<theta>. T = \<theta><T'> \<and> atom ` Dom \<theta> = atom ` fset Xs \<inter> supp T')" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
282 |
unfolding generalises_graph_def |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
283 |
unfolding eqvt_def |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
284 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
285 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
286 |
apply(rule TrueI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
287 |
apply(case_tac x) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
288 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
289 |
apply(rule_tac y="b" and c="a" in tys.strong_exhaust) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
290 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
291 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
292 |
apply(simp only: tys.eq_iff map_fset_image) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
293 |
apply(erule_tac c="Ta" in Abs_res_fcb2) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
294 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
295 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
296 |
apply(simp add: fresh_star_def pure_fresh) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
297 |
apply(simp add: fresh_star_def pure_fresh) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
298 |
apply(simp add: fresh_star_def pure_fresh) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
299 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
300 |
apply(subst perm_supp_eq) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
301 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
302 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
303 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
304 |
apply(subst perm_supp_eq) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
305 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
306 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
307 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
308 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
309 |
termination (eqvt) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
310 |
by lexicographic_order |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
311 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
312 |
lemma better: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
313 |
"T \<prec>\<prec> All [Xs].T' \<longleftrightarrow> (\<exists>\<theta>. T = \<theta><T'> \<and> atom ` Dom \<theta> = atom ` fset Xs \<inter> supp T')" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
314 |
using at_set_avoiding3 |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
315 |
apply - |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
316 |
apply(drule_tac x="atom ` fset Xs" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
317 |
apply(drule_tac x="T" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
318 |
apply(drule_tac x="All [Xs].T'" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
319 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
320 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
321 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
322 |
apply(simp add: finite_supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
323 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
324 |
apply(simp add: finite_supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
325 |
apply(drule_tac meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
326 |
apply(simp add: fresh_star_def tys.fresh) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
327 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
328 |
apply(rule_tac t="All [Xs].T'" and s="p \<bullet> All [Xs].T'" in subst) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
329 |
apply(rule supp_perm_eq) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
330 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
331 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
332 |
apply(subst generalises.simps) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
333 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
334 |
apply(rule iffI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
335 |
defer |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
336 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
337 |
apply(rule_tac x="\<theta>|p" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
338 |
apply(rule conjI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
339 |
apply(rule t) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
340 |
apply(simp add: tys.supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
341 |
apply (metis Diff_Int_distrib Int_Diff Int_commute inf_sup_absorb) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
342 |
apply(simp add: Dom_pi) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
343 |
apply(rotate_tac 3) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
344 |
apply(drule_tac p="p" in permute_boolI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
345 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
346 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
347 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
348 |
apply(rule_tac x="\<theta>|- p" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
349 |
apply(rule conjI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
350 |
apply(subst t[where p="- p"]) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
351 |
apply(simp add: tys.supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
352 |
apply(rotate_tac 1) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
353 |
apply(drule_tac p="p" in permute_boolI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
354 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
355 |
apply(simp add: permute_self) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
356 |
apply(simp add: fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
357 |
apply(simp add: fresh_minus_perm) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
358 |
apply (metis Diff_Int_distrib Int_Diff Int_commute inf_sup_absorb) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
359 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
360 |
apply(simp add: Dom_pi) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
361 |
apply(rule_tac p="p" in permute_boolE) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
362 |
apply(perm_simp add: permute_minus_cancel) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
363 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
364 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
365 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
366 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
367 |
(* Tests *) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
368 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
369 |
fun |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
370 |
compose::"Subst \<Rightarrow> Subst \<Rightarrow> Subst" ("_ \<circ> _" [100,100] 100) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
371 |
where |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
372 |
"\<theta>\<^isub>1 \<circ> [] = \<theta>\<^isub>1" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
373 |
| "\<theta>\<^isub>1 \<circ> ((X,T)#\<theta>\<^isub>2) = (X,\<theta>\<^isub>1<T>)#(\<theta>\<^isub>1 \<circ> \<theta>\<^isub>2)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
374 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
375 |
lemma compose_ty: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
376 |
fixes \<theta>1 \<theta>2 :: "Subst" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
377 |
and T :: "ty" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
378 |
shows "\<theta>1<\<theta>2<T>> = (\<theta>1\<circ>\<theta>2)<T>" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
379 |
proof (induct T rule: ty.induct) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
380 |
case (Var X) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
381 |
have "\<theta>1<lookup \<theta>2 X> = lookup (\<theta>1\<circ>\<theta>2) X" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
382 |
by (induct \<theta>2) (auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
383 |
then show ?case by simp |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
384 |
next |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
385 |
case (Fun T1 T2) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
386 |
then show ?case by simp |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
387 |
qed |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
388 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
389 |
lemma compose_Dom: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
390 |
shows "Dom (\<theta>1 \<circ> \<theta>2) = Dom \<theta>1 \<union> Dom \<theta>2" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
391 |
apply(induct \<theta>2) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
392 |
apply(auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
393 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
394 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
395 |
lemma t1: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
396 |
fixes T::"ty" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
397 |
and Xs::"name fset" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
398 |
shows "\<exists>\<theta>. atom ` Dom \<theta> = atom ` fset Xs \<and> \<theta><T> = T" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
399 |
apply(induct Xs) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
400 |
apply(rule_tac x="[]" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
401 |
apply(simp add: subst_id1) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
402 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
403 |
apply(rule_tac x="[(x, Var x)] \<circ> \<theta>" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
404 |
apply(simp add: compose_ty[symmetric] subst_id2 compose_Dom) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
405 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
406 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
407 |
nominal_primrec |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
408 |
ftv :: "ty \<Rightarrow> name fset" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
409 |
where |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
410 |
"ftv (Var X) = {|X|}" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
411 |
| "ftv (T1 \<rightarrow> T2) = (ftv T1) |\<union>| (ftv T2)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
412 |
unfolding eqvt_def ftv_graph_def |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
413 |
apply (rule, perm_simp, rule) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
414 |
apply(rule TrueI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
415 |
apply(rule_tac y="x" in ty.exhaust) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
416 |
apply(blast) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
417 |
apply(blast) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
418 |
apply(simp_all) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
419 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
420 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
421 |
termination (eqvt) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
422 |
by lexicographic_order |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
423 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
424 |
lemma tt: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
425 |
shows "supp T = atom ` fset (ftv T)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
426 |
apply(induct T rule: ty.induct) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
427 |
apply(simp_all add: ty.supp supp_at_base) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
428 |
apply(auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
429 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
430 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
431 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
432 |
lemma t2: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
433 |
shows "T \<prec>\<prec> All [Xs].T" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
434 |
unfolding better |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
435 |
using t1 |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
436 |
apply - |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
437 |
apply(drule_tac x="Xs |\<inter>| ftv T" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
438 |
apply(drule_tac x="T" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
439 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
440 |
apply(rule_tac x="\<theta>" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
441 |
apply(simp add: tt) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
442 |
apply(auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
443 |
done |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
444 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
445 |
(* HERE *) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
446 |
|
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
447 |
lemma w1: |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
448 |
shows "\<theta><\<theta>'|p> = (\<theta><\<theta>'>)|p" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
449 |
by (induct \<theta>')(auto) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
450 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
451 |
(* |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
452 |
lemma w2: |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
453 |
assumes "name |\<in>| Dom \<theta>'" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
454 |
shows "\<theta><lookup \<theta>' name> = lookup (\<theta><\<theta>'>) name" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
455 |
using assms |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
456 |
apply(induct \<theta>') |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
457 |
apply(auto simp add: notin_empty_fset) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
458 |
done |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
459 |
|
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
460 |
lemma w3: |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
461 |
assumes "name |\<in>| Dom \<theta>" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
462 |
shows "lookup \<theta> name = lookup (\<theta>|p) (p \<bullet> name)" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
463 |
using assms |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
464 |
apply(induct \<theta>) |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
465 |
apply(auto simp add: notin_empty_fset) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
466 |
done |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
467 |
|
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
468 |
lemma fresh_lookup: |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
469 |
fixes X Y::"name" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
470 |
and \<theta>::"Subst" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
471 |
assumes asms: "atom X \<sharp> Y" "atom X \<sharp> \<theta>" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
472 |
shows "atom X \<sharp> (lookup \<theta> Y)" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
473 |
using assms |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
474 |
apply (induct \<theta>) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
475 |
apply (auto simp add: fresh_Cons fresh_Pair fresh_at_base ty.fresh) |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
476 |
done |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
477 |
|
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
478 |
lemma test: |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
479 |
fixes \<theta> \<theta>'::"Subst" |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
480 |
and T::"ty" |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
481 |
assumes "(p \<bullet> atom ` fset (Dom \<theta>')) \<sharp>* \<theta>" "supp All [Dom \<theta>'].T \<sharp>* p" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
482 |
shows "\<theta><\<theta>'<T>> = \<theta><\<theta>'|p><\<theta><p \<bullet> T>>" |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
483 |
using assms |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
484 |
apply(induct T rule: ty.induct) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
485 |
defer |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
486 |
apply(auto simp add: tys.supp ty.supp fresh_star_def)[1] |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
487 |
apply(auto simp add: tys.supp ty.supp fresh_star_def supp_at_base)[1] |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
488 |
apply(case_tac "name |\<in>| Dom \<theta>'") |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
489 |
apply(subgoal_tac "atom (p \<bullet> name) \<sharp> \<theta>") |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
490 |
apply(subst (2) lookup_fresh) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
491 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
492 |
apply(auto simp add: fresh_star_def)[1] |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
493 |
apply(simp) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
494 |
apply(simp add: w1) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
495 |
apply(simp add: w2) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
496 |
apply(subst w3[symmetric]) |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
497 |
apply(simp add: Dom_subst) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
498 |
apply(simp) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
499 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
500 |
apply(rotate_tac 2) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
501 |
apply(drule_tac p="p" in permute_boolI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
502 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
503 |
apply(auto simp add: fresh_star_def)[1] |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
504 |
apply(metis notin_fset) |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
505 |
apply(simp add: lookup_Dom) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
506 |
apply(perm_simp) |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
507 |
apply(subst Dom_fresh_ty) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
508 |
apply(auto)[1] |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
509 |
apply(rule fresh_lookup) |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
510 |
apply(simp add: Dom_subst) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
511 |
apply(simp add: Dom_pi) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
512 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
513 |
apply(rotate_tac 2) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
514 |
apply(drule_tac p="p" in permute_boolI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
515 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
516 |
apply(simp add: fresh_at_base) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
517 |
apply (metis in_fset) |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
518 |
apply(simp add: Dom_subst) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
519 |
apply(simp add: Dom_pi[symmetric]) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
520 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
521 |
apply(subst supp_perm_eq) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
522 |
apply(simp add: supp_at_base fresh_star_def) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
523 |
apply (smt Diff_iff atom_eq_iff image_iff insertI1 notin_fset) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
524 |
apply(simp) |
3102
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
525 |
done |
5b5ade6bc889
added definition for generalisation of type schemes (for paper)
Christian Urban <urbanc@in.tum.de>
parents:
3100
diff
changeset
|
526 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
527 |
lemma generalises_subst: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
528 |
shows "T \<prec>\<prec> All [Xs].T' \<Longrightarrow> \<theta><T> \<prec>\<prec> \<theta><All [Xs].T'>" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
529 |
using at_set_avoiding3 |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
530 |
apply - |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
531 |
apply(drule_tac x="fset (map_fset atom Xs)" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
532 |
apply(drule_tac x="\<theta>" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
533 |
apply(drule_tac x="All [Xs].T'" in meta_spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
534 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
535 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
536 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
537 |
apply(simp add: finite_supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
538 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
539 |
apply(simp add: finite_supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
540 |
apply(drule meta_mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
541 |
apply(simp add: tys.fresh fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
542 |
apply(erule exE) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
543 |
apply(erule conjE)+ |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
544 |
apply(rule_tac t="All[Xs].T'" and s="p \<bullet> (All [Xs].T')" in subst) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
545 |
apply(rule supp_perm_eq) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
546 |
apply(assumption) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
547 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
548 |
apply(subst substs.simps) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
549 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
550 |
apply(simp add: better) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
551 |
apply(erule exE) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
552 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
553 |
apply(rule_tac x="\<theta><\<theta>'|p>" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
554 |
apply(rule conjI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
555 |
apply(rule test) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
556 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
557 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
558 |
apply(simp add: fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
559 |
apply(auto)[1] |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
560 |
apply(simp add: tys.supp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
561 |
apply(simp add: fresh_star_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
562 |
apply(auto)[1] |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
563 |
oops |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
564 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
565 |
lemma generalises_subst: |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
566 |
shows "T \<prec>\<prec> S \<Longrightarrow> \<theta><T> \<prec>\<prec> \<theta><S>" |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
567 |
unfolding generalises_def |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
568 |
apply(erule exE)+ |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
569 |
apply(erule conjE)+ |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
570 |
apply(rule_tac t="S" and s="All [Xs].T'" in subst) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
571 |
apply(simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
572 |
using at_set_avoiding3 |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
573 |
apply - |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
574 |
apply(drule_tac x="fset (map_fset atom Xs)" in meta_spec) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
575 |
apply(drule_tac x="\<theta>" in meta_spec) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
576 |
apply(drule_tac x="All [Xs].T'" in meta_spec) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
577 |
apply(drule meta_mp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
578 |
apply(simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
579 |
apply(drule meta_mp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
580 |
apply(simp add: finite_supp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
581 |
apply(drule meta_mp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
582 |
apply(simp add: finite_supp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
583 |
apply(drule meta_mp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
584 |
apply(simp add: tys.fresh fresh_star_def) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
585 |
apply(erule exE) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
586 |
apply(erule conjE)+ |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
587 |
apply(rule_tac t="All[Xs].T'" and s="p \<bullet> (All [Xs].T')" in subst) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
588 |
apply(rule supp_perm_eq) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
589 |
apply(assumption) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
590 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
591 |
apply(subst substs.simps) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
592 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
593 |
apply(simp) |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
594 |
apply(rule_tac x="\<theta><\<theta>'|p>" in exI) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
595 |
apply(rule_tac x="p \<bullet> Xs" in exI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
596 |
apply(rule_tac x="\<theta><p \<bullet> T'>" in exI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
597 |
apply(rule conjI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
598 |
apply(simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
599 |
apply(rule conjI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
600 |
defer |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
601 |
apply(simp add: Dom_subst) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
602 |
apply(simp add: Dom_pi Dom_eqvt[symmetric]) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
603 |
apply(rule_tac t="T" and s="\<theta>'<T'>" in subst) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
604 |
apply(simp) |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
605 |
apply(simp) |
3103
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
606 |
apply(rule test) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
607 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
608 |
apply(rotate_tac 2) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
609 |
apply(drule_tac p="p" in permute_boolI) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
610 |
apply(perm_simp) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
611 |
apply(auto simp add: fresh_star_def) |
9a63d90d1752
proved that generalisation is closed under substitution
Christian Urban <urbanc@in.tum.de>
parents:
3102
diff
changeset
|
612 |
done |
1795 | 613 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
614 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
615 |
lemma r: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
616 |
"A - (B \<inter> A) = A - B" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
617 |
by (metis Diff_Int Diff_cancel sup_bot_right) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
618 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
619 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
620 |
lemma t3: |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
621 |
"T \<prec>\<prec> All [Xs].T' \<longleftrightarrow> (\<exists>\<theta>. T = \<theta><T'> \<and> Dom \<theta> = Xs)" |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
622 |
apply(auto) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
623 |
defer |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
624 |
apply(simp add: generalises_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
625 |
apply(auto)[1] |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
626 |
unfolding generalises_def |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
627 |
apply(auto)[1] |
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
628 |
apply(simp add: Abs_eq_res_set) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
629 |
apply(simp add: Abs_eq_iff2) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
630 |
apply(simp add: alphas) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
631 |
apply(perm_simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
632 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
633 |
apply(simp add: r) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
634 |
apply(drule sym) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
635 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
636 |
apply(rule_tac x="\<theta>|p" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
637 |
sorry |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
638 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
639 |
definition |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
640 |
generalises_tys :: "tys \<Rightarrow> tys \<Rightarrow> bool" ("_ \<prec>\<prec> _") |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
641 |
where |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
642 |
"S1 \<prec>\<prec> S2 = (\<forall>T::ty. T \<prec>\<prec> S1 \<longrightarrow> T \<prec>\<prec> S2)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
643 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
644 |
lemma |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
645 |
"All [Xs1].T1 \<prec>\<prec> All [Xs2].T2 |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
646 |
\<longleftrightarrow> (\<exists>\<theta>. Dom \<theta> = Xs2 \<and> T1 = \<theta><T2> \<and> (\<forall>X \<in> fset Xs1. atom X \<sharp> All [Xs2].T2))" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
647 |
apply(rule iffI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
648 |
apply(simp add: generalises_tys_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
649 |
apply(drule_tac x="T1" in spec) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
650 |
apply(drule mp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
651 |
apply(rule t2) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
652 |
apply(simp add: t3) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
653 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
654 |
apply(rule_tac x="\<theta>" in exI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
655 |
apply(simp) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
656 |
apply(rule ballI) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
657 |
defer |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
658 |
apply(simp add: generalises_tys_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
659 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
660 |
apply(simp add: t3) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
661 |
apply(clarify) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
662 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
663 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
664 |
|
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
665 |
lemma |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
666 |
"T \<prec>\<prec> All [Xs].T' \<longleftrightarrow> (\<exists>\<theta>. T = \<theta><T'> \<and> Dom \<theta> = Xs)" |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
667 |
apply(auto) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
668 |
defer |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
669 |
apply(simp add: generalises_def) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
670 |
apply(auto)[1] |
3104
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
671 |
apply(auto)[1] |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
672 |
apply(drule sym) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
673 |
apply(simp add: Abs_eq_iff2) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
674 |
apply(simp add: alphas) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
675 |
apply(auto) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
676 |
apply(rule_tac x="map (\<lambda>(X, T). (p \<bullet> X, T)) \<theta>" in exI) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
677 |
apply(auto) |
f7c4b8e6918b
updated to explicit set type constructor (post Isabelle 3rd January)
Christian Urban <urbanc@in.tum.de>
parents:
3103
diff
changeset
|
678 |
oops |
1795 | 679 |
|
3109
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
680 |
*) |
d79e936e30ea
commented out parts of TypeScheme1 in order to run all tests
Christian Urban <urbanc@in.tum.de>
parents:
3104
diff
changeset
|
681 |
|
1795 | 682 |
end |