author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Mon, 15 Mar 2010 10:02:19 +0100 | |
changeset 1442 | 097b25706436 |
parent 1429 | 866208388c1d |
child 1444 | aca9a6380c3f |
permissions | -rw-r--r-- |
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1 |
theory LFex |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
2 |
imports "Parser" |
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
begin |
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
|
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
5 |
atom_decl name |
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
6 |
atom_decl ident |
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
|
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
8 |
nominal_datatype kind = |
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
Type |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
10 |
| KPi "ty" n::"name" k::"kind" bind n in k |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
11 |
and ty = |
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
12 |
TConst "ident" |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
13 |
| TApp "ty" "trm" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
14 |
| TPi "ty" n::"name" t::"ty" bind n in t |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
15 |
and trm = |
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
Const "ident" |
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
| Var "name" |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
18 |
| App "trm" "trm" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
19 |
| Lam "ty" n::"name" t::"trm" bind n in t |
994
333c24bd595d
More in the LF example in the new nominal way, all is clear until support.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
993
diff
changeset
|
20 |
|
1344
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
21 |
lemma ex_out: |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
22 |
"(\<exists>x. Z x \<and> Q) = (Q \<and> (\<exists>x. Z x))" |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
23 |
"(\<exists>x. Q \<and> Z x) = (Q \<and> (\<exists>x. Z x))" |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
24 |
"(\<exists>x. P x \<and> Q \<and> Z x) = (Q \<and> (\<exists>x. P x \<and> Z x))" |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
25 |
"(\<exists>x. Q \<and> P x \<and> Z x) = (Q \<and> (\<exists>x. P x \<and> Z x))" |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
26 |
apply (blast)+ |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
27 |
done |
b320da14e63c
Fixed LF for one quantifier over 2 premises.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1310
diff
changeset
|
28 |
|
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
29 |
lemma Collect_neg_conj: "{x. \<not>(P x \<and> Q x)} = {x. \<not>(P x)} \<union> {x. \<not>(Q x)}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
30 |
by (simp add: Collect_imp_eq Collect_neg_eq[symmetric]) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
31 |
|
1245
18310dff4e3a
Made the fv-supp proof much more straightforward.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1244
diff
changeset
|
32 |
lemma supp_eqs: |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
33 |
"supp Type = {}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
34 |
"supp rkind = fv_kind rkind \<Longrightarrow> supp (KPi rty name rkind) = supp rty \<union> supp (Abs {atom name} rkind)" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
35 |
"supp (TConst i) = {atom i}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
36 |
"supp (TApp A M) = supp A \<union> supp M" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
37 |
"supp rty2 = fv_ty rty2 \<Longrightarrow> supp (TPi rty1 name rty2) = supp rty1 \<union> supp (Abs {atom name} rty2)" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
38 |
"supp (Const i) = {atom i}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
39 |
"supp (Var x) = {atom x}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
40 |
"supp (App M N) = supp M \<union> supp N" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
41 |
"supp rtrm = fv_trm rtrm \<Longrightarrow> supp (Lam rty name rtrm) = supp rty \<union> supp (Abs {atom name} rtrm)" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
42 |
apply(simp_all (no_asm) add: supp_def permute_set_eq atom_eqvt kind_ty_trm_perm) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
43 |
apply(simp_all only: kind_ty_trm_inject Abs_eq_iff alpha_gen) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
44 |
apply(simp_all only: ex_out) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
45 |
apply(simp_all only: eqvts[symmetric]) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
46 |
apply(simp_all only: Collect_neg_conj) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
47 |
apply(simp_all only: supp_at_base[simplified supp_def] Un_commute Un_assoc) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
48 |
apply(simp_all add: Collect_imp_eq Collect_neg_eq[symmetric] Un_commute Un_assoc) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
49 |
apply(simp_all add: Un_left_commute) |
1245
18310dff4e3a
Made the fv-supp proof much more straightforward.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1244
diff
changeset
|
50 |
done |
1002
3f227ed7e3e5
More proofs in the LF example.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
997
diff
changeset
|
51 |
|
994
333c24bd595d
More in the LF example in the new nominal way, all is clear until support.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
993
diff
changeset
|
52 |
lemma supp_fv: |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
53 |
"supp t1 = fv_kind t1 \<and> supp t2 = fv_ty t2 \<and> supp t3 = fv_trm t3" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
54 |
apply(induct rule: kind_ty_trm_induct) |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
55 |
apply(simp_all (no_asm) only: supp_eqs kind_ty_trm_fv) |
1245
18310dff4e3a
Made the fv-supp proof much more straightforward.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1244
diff
changeset
|
56 |
apply(simp_all) |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
57 |
apply(simp_all add: supp_eqs) |
1245
18310dff4e3a
Made the fv-supp proof much more straightforward.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1244
diff
changeset
|
58 |
apply(simp_all add: supp_Abs) |
18310dff4e3a
Made the fv-supp proof much more straightforward.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1244
diff
changeset
|
59 |
done |
994
333c24bd595d
More in the LF example in the new nominal way, all is clear until support.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
993
diff
changeset
|
60 |
|
1234 | 61 |
lemma supp_rkind_rty_rtrm: |
1348
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
62 |
"supp Type = {}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
63 |
"supp (KPi A x K) = supp A \<union> (supp K - {atom x})" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
64 |
"supp (TConst i) = {atom i}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
65 |
"supp (TApp A M) = supp A \<union> supp M" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
66 |
"supp (TPi A x B) = supp A \<union> (supp B - {atom x})" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
67 |
"supp (Const i) = {atom i}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
68 |
"supp (Var x) = {atom x}" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
69 |
"supp (App M N) = supp M \<union> supp N" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
70 |
"supp (Lam A x M) = supp A \<union> (supp M - {atom x})" |
2e2a3cd58f64
Ported LF to the parser interface.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
1344
diff
changeset
|
71 |
apply (simp_all add: supp_fv kind_ty_trm_fv) |
994
333c24bd595d
More in the LF example in the new nominal way, all is clear until support.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
993
diff
changeset
|
72 |
|
985
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
end |
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
|
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
75 |
|
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
|
ef8a2b0b237a
Ported existing part of LF to new permutations and alphas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |