1911
+ − 1
theory SingleLet
2024
+ − 2
imports "../NewParser"
1596
+ − 3
begin
+ − 4
+ − 5
atom_decl name
+ − 6
2400
+ − 7
declare [[STEPS = 20]]
2294
+ − 8
2410
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
2336
+ − 10
nominal_datatype trm =
1911
+ − 11
Var "name"
+ − 12
| App "trm" "trm"
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 13
| Lam x::"name" t::"trm" bind x in t
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 14
| Let a::"assg" t::"trm" bind (set) "bn a" in t
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 15
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind (set) x in y t t1 t2
2296
+ − 16
| Bar x::"name" y::"name" t::"trm" bind y x in t x y
2316
+ − 17
| Baz x::"name" t1::"trm" t2::"trm" bind x in t1, bind x in t2
1911
+ − 18
and assg =
2320
+ − 19
As "name" x::"name" t::"trm" bind x in t
1596
+ − 20
binder
1911
+ − 21
bn::"assg \<Rightarrow> atom set"
1596
+ − 22
where
2320
+ − 23
"bn (As x y t) = {atom x}"
1911
+ − 24
2410
2bbdb9c427b5
improved runtime slightly, by constructing an explicit size measure for the function definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 25
2409
+ − 26
ML {* Function.prove_termination *}
+ − 27
+ − 28
text {* can lift *}
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 29
2397
+ − 30
thm distinct
+ − 31
thm trm_raw_assg_raw.inducts
2407
+ − 32
thm trm_raw.exhaust
+ − 33
thm assg_raw.exhaust
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 34
thm fv_defs
2384
+ − 35
thm perm_simps
+ − 36
thm perm_laws
2397
+ − 37
thm trm_raw_assg_raw.size(9 - 16)
2398
+ − 38
thm eq_iff
+ − 39
thm eq_iff_simps
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 40
thm bn_defs
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 41
thm fv_eqvt
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 42
thm bn_eqvt
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 43
thm size_eqvt
2405
+ − 44
2430
+ − 45
ML {* lift_thm *}
+ − 46
+ − 47
2398
+ − 48
ML {*
2430
+ − 49
val _ = timeit (fn () => map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms distinct})
+ − 50
*}
+ − 51
+ − 52
ML {*
+ − 53
val thms_i = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms trm_raw_assg_raw.inducts}
+ − 54
*}
+ − 55
+ − 56
ML {*
+ − 57
val thms_i = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms trm_raw.exhaust}
+ − 58
*}
+ − 59
+ − 60
ML {*
+ − 61
val thms_i = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms assg_raw.exhaust}
2407
+ − 62
*}
+ − 63
2398
+ − 64
ML {*
2430
+ − 65
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms fv_defs}
2428
+ − 66
*}
+ − 67
+ − 68
ML {*
2430
+ − 69
val thms_i = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms trm_raw_assg_raw.size(9 - 16)}
2398
+ − 70
*}
+ − 71
2402
+ − 72
ML {*
2430
+ − 73
val thms_p = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms perm_simps}
2428
+ − 74
*}
+ − 75
+ − 76
ML {*
2430
+ − 77
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms perm_laws}
+ − 78
*}
+ − 79
+ − 80
ML {*
+ − 81
val simps = @{thms alphas permute_prod.simps prod_fv.simps prod_alpha_def prod_rel.simps
+ − 82
prod.cases}
2402
+ − 83
*}
2397
+ − 84
2405
+ − 85
ML {*
2430
+ − 86
val thms_e = map (lift_thm @{context} [@{typ trm}, @{typ assg}] simps) @{thms eq_iff}
2405
+ − 87
*}
2397
+ − 88
2405
+ − 89
ML {*
2430
+ − 90
val thms_e = map (lift_thm @{context} [@{typ trm}, @{typ assg}] simps) @{thms eq_iff_simps}
2405
+ − 91
*}
2361
+ − 92
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 93
ML {*
2430
+ − 94
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms bn_defs}
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 95
*}
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 96
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 97
ML {*
2430
+ − 98
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms bn_eqvt}
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 99
*}
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 100
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 101
ML {*
2430
+ − 102
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms fv_eqvt}
+ − 103
*}
+ − 104
+ − 105
ML {*
+ − 106
val thms_f = map (lift_thm @{context} [@{typ trm}, @{typ assg}] []) @{thms size_eqvt}
2406
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 107
*}
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 109
428d9cb9a243
can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 110
2361
+ − 111
lemma supp_fv:
+ − 112
"supp t = fv_trm t"
+ − 113
"supp b = fv_bn b"
+ − 114
apply(induct t and b rule: i1)
+ − 115
apply(simp_all add: f1)
+ − 116
apply(simp_all add: supp_def)
2365
+ − 117
apply(simp_all add: b1)
+ − 118
sorry
+ − 119
+ − 120
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm"
+ − 121
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg"
+ − 122
+ − 123
lemma y:
+ − 124
"perm_bn_trm p (Var x) = (Var x)"
+ − 125
"perm_bn_trm p (App t1 t2) = (App t1 t2)"
+ − 126
"perm_bn_trm p ("
+ − 127
+ − 128
2361
+ − 129
2336
+ − 130
typ trm
+ − 131
typ assg
+ − 132
1911
+ − 133
thm trm_assg.fv
+ − 134
thm trm_assg.supp
2024
+ − 135
thm trm_assg.eq_iff
1911
+ − 136
thm trm_assg.bn
+ − 137
thm trm_assg.perm
+ − 138
thm trm_assg.induct
+ − 139
thm trm_assg.inducts
+ − 140
thm trm_assg.distinct
+ − 141
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *}
2024
+ − 142
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 143
(* TEMPORARY
2024
+ − 144
thm trm_assg.fv[simplified trm_assg.supp(1-2)]
2288
3b83960f9544
new fv/fv_bn function (supp breaks now); exported raw perms and raw funs into separate ML-files
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 145
*)
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 146
1596
+ − 147
end
+ − 148
+ − 149
+ − 150