Skip to content

Commit 90656d6

Browse files
committed
Fix simp rules for tvsubst
1 parent 2269cde commit 90656d6

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Tools/mrbnf_sugar.ML

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,29 @@ fun build_set_for _ aT x (TFree (s, _)) = if s = fst (dest_TFree aT) then SOME (
184184
end
185185
) (mr_bnf_of lthy false C);
186186

187+
fun message quiet_mode s = if quiet_mode then () else writeln s;
188+
fun clean_message ctxt quiet_mode s =
189+
if Config.get ctxt quick_and_dirty then () else message quiet_mode s;
190+
187191
fun create_binder_datatype co (spec : spec) lthy =
188192
let
189193
val fp_kind = if co then MRBNF_Util.Greatest_FP else MRBNF_Util.Least_FP;
194+
val quiet_mode = false;
195+
196+
val _ = clean_message lthy quiet_mode " Creating quotient type ...";
197+
190198
val ((res, fp_pre_T, mrsbnf, absinfo), lthy) = create_binder_type fp_kind spec lthy;
191199
val mrbnf = hd (MRSBNF_Def.mrbnfs_of_mrsbnf mrsbnf);
192200
val bmv = MRSBNF_Def.bmv_monad_of_mrsbnf mrsbnf;
193201

194202
val (vvsubst_res_opt, lthy) = if co then (NONE, lthy) else (* TODO: Automate renaming for codatatypes *)
195203
let
204+
val _ = clean_message lthy quiet_mode " Creating recursor locale ...";
205+
196206
val (recursor_result, lthy) = MRBNF_Recursor.create_binding_recursor I res lthy;
197207

208+
val _ = clean_message lthy quiet_mode " Creating renaming function and proving MRBNF axioms ...";
209+
198210
val ([(rec_mrbnf, vvsubst_res)], lthy) = MRBNF_VVSubst.mrbnf_of_quotient_fixpoint [#map_b spec] I res (#QREC_fixed recursor_result) lthy;
199211
val lthy = MRBNF_Def.register_mrbnf_raw (fst (dest_Type (#T (hd (#quotient_fps res))))) rec_mrbnf lthy;
200212
in (SOME {
@@ -220,6 +232,8 @@ fun create_binder_datatype co (spec : spec) lthy =
220232

221233
val (_, lthy) = Local_Theory.begin_nested lthy;
222234

235+
val _ = clean_message lthy quiet_mode " Defining high-level constructors and lifting theorems ...";
236+
223237
val (ctors, (_, lthy)) = fold_map (fn ((name, syn), Ts) => fn (i, lthy) =>
224238
let
225239
val Ts' = map (Term.typ_subst_atomic replace) Ts;
@@ -1126,6 +1140,8 @@ fun create_binder_datatype co (spec : spec) lthy =
11261140
val rec_mrbnf = #rec_mrbnf (the vvsubst_res_opt);
11271141
val vvsubst_res = #vvsubst_res (the vvsubst_res_opt);
11281142

1143+
val _ = clean_message lthy quiet_mode " Creating substition function ...";
1144+
11291145
val (tvsubst_res, lthy) = TVSubst.create_tvsubst_of_mrsbnf (Binding.prefix_name "tv") res mrsbnf
11301146
rec_mrbnf (#vvsubst_ctor vvsubst_res) (#vvsubst_permute vvsubst_res) (#pset_ctors (#vvsubst_res (the vvsubst_res_opt))) (#tvsubst_b spec)
11311147
(#etas tvsubst_model) (#QREC_fixed recursor_result) lthy;
@@ -1139,7 +1155,6 @@ fun create_binder_datatype co (spec : spec) lthy =
11391155
MRSBNF_Def.bmv_monad_of_mrsbnf (#mrsbnf tvsubst_res)
11401156
) lthy;
11411157

1142-
11431158
val tvsubst_simps =
11441159
let
11451160
val T = range_type (fastype_of quotient_ctor);
@@ -1215,6 +1230,7 @@ fun create_binder_datatype co (spec : spec) lthy =
12151230
)),
12161231
K (Local_Defs.unfold0_tac ctxt (@{thms comp_def map_sum.simps map_prod_simp sum.inject}
12171232
@ map MRBNF_Def.map_id_of_mrbnf fp_nesting_mrbnfs
1233+
@ map MRBNF_Def.map_id0_of_mrbnf fp_nesting_mrbnfs
12181234
@ BMV_Monad_Def.unfolds_of_bmv_monad (MRSBNF_Def.bmv_monad_of_mrsbnf mrsbnf)
12191235
@ BMV_Monad_Def.defs_of_bmv_monad (MRSBNF_Def.bmv_monad_of_mrsbnf mrsbnf)
12201236
@ map (BNF_Def.map_id_of_bnf o snd) bnfs

Tools/tvsubst.ML

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,8 +2222,6 @@ fun create_tvsubst_of_mrsbnf qualify fp_res mrsbnf rec_mrbnf vvsubst_ctor map_pe
22222222
}]
22232223
} [] (*TODO: Put definitions here *) lthy;
22242224

2225-
val _ = @{print} rec_bmv
2226-
22272225
val isInj_Map = if null plives then [] else map (Option.map (fn def =>
22282226
let
22292227
val t = Free ("t", #T quot);

tests/Regression_Tests.thy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ binder_datatype ('tv, 'ev, 'rv) type_scheme3 =
5454
TAll "(X::'tv) list" \<sigma>::"('tv, 'ev, 'rv) type_scheme3" binds X in \<sigma>
5555
| ERAll "(\<epsilon>::'ev) list" "(\<rho>::'rv) list" T::"('tv, 'ev, 'rv) type2" binds \<epsilon> \<rho> in T
5656

57-
(*
5857
binder_datatype ('v, 'tv, 'ev, 'rv) expr =
5958
Var 'v
6059
| Int int
@@ -65,7 +64,6 @@ binder_datatype ('v, 'tv, 'ev, 'rv) expr =
6564
| Assert "('ev, 'rv) constraint" "('v, 'tv, 'ev, 'rv) expr"
6665
| Let x::'v "('v, 'tv, 'ev, 'rv) expr" e::"('v, 'tv, 'ev, 'rv) expr" binds x in e
6766
| RApp "('v, 'tv, 'ev, 'rv) expr" "'rv list" "('v, 'tv, 'ev, 'rv) expr"
68-
*)
6967

7068
(* #86 *)
7169
binder_datatype 'a "term" =

0 commit comments

Comments
 (0)