27 serialize: (string * string) list -> string list -> sign -> sterm list -> string } |
27 serialize: (string * string) list -> string list -> sign -> sterm list -> string } |
28 type replay_data = { |
28 type replay_data = { |
29 context: Proof.context, |
29 context: Proof.context, |
30 typs: typ Symtab.table, |
30 typs: typ Symtab.table, |
31 terms: term Symtab.table, |
31 terms: term Symtab.table, |
|
32 ll_defs: term list, |
32 rewrite_rules: thm list, |
33 rewrite_rules: thm list, |
33 assms: (int * thm) list } |
34 assms: (int * thm) list } |
34 |
35 |
35 (*translation*) |
36 (*translation*) |
36 val add_config: SMT2_Util.class * (Proof.context -> config) -> Context.generic -> Context.generic |
37 val add_config: SMT2_Util.class * (Proof.context -> config) -> Context.generic -> Context.generic |
70 |
71 |
71 type replay_data = { |
72 type replay_data = { |
72 context: Proof.context, |
73 context: Proof.context, |
73 typs: typ Symtab.table, |
74 typs: typ Symtab.table, |
74 terms: term Symtab.table, |
75 terms: term Symtab.table, |
|
76 ll_defs: term list, |
75 rewrite_rules: thm list, |
77 rewrite_rules: thm list, |
76 assms: (int * thm) list } |
78 assms: (int * thm) list } |
77 |
79 |
78 |
80 |
79 (* translation context *) |
81 (* translation context *) |
116 logic = logic, |
118 logic = logic, |
117 sorts = Typtab.fold (fn (_, (n, true)) => cons n | _ => I) typs [], |
119 sorts = Typtab.fold (fn (_, (n, true)) => cons n | _ => I) typs [], |
118 dtyps = dtyps, |
120 dtyps = dtyps, |
119 funcs = Termtab.fold (fn (_, (n, SOME ss)) => cons (n,ss) | _ => I) terms []} |
121 funcs = Termtab.fold (fn (_, (n, SOME ss)) => cons (n,ss) | _ => I) terms []} |
120 |
122 |
121 fun replay_data_of ctxt rules assms (_, typs, terms) = |
123 fun replay_data_of ctxt ll_defs rules assms (_, typs, terms) = |
122 let |
124 let |
123 fun add_typ (T, (n, _)) = Symtab.update (n, T) |
125 fun add_typ (T, (n, _)) = Symtab.update (n, T) |
124 val typs' = Typtab.fold add_typ typs Symtab.empty |
126 val typs' = Typtab.fold add_typ typs Symtab.empty |
125 |
127 |
126 fun add_fun (t, (n, _)) = Symtab.update (n, t) |
128 fun add_fun (t, (n, _)) = Symtab.update (n, t) |
127 val terms' = Termtab.fold add_fun terms Symtab.empty |
129 val terms' = Termtab.fold add_fun terms Symtab.empty |
128 in |
130 in |
129 {context=ctxt, typs=typs', terms=terms', rewrite_rules=rules, assms=assms} |
131 {context = ctxt, typs = typs', terms = terms', ll_defs = ll_defs, rewrite_rules = rules, |
|
132 assms = assms} |
130 end |
133 end |
131 |
134 |
132 |
135 |
133 (* preprocessing *) |
136 (* preprocessing *) |
134 |
137 |
497 |> SMT2_Util.mk_symb_list @{typ pattern} o single |
500 |> SMT2_Util.mk_symb_list @{typ pattern} o single |
498 |> SMT2_Util.mk_symb_list @{typ "pattern symb_list"} o single |
501 |> SMT2_Util.mk_symb_list @{typ "pattern symb_list"} o single |
499 |> (fn t => @{const trigger} $ t $ eq) |
502 |> (fn t => @{const trigger} $ t $ eq) |
500 | mk_trigger t = t |
503 | mk_trigger t = t |
501 |
504 |
502 val (ctxt2, ts3) = |
505 val (ctxt2, (ts3, ll_defs)) = |
503 ts2 |
506 ts2 |
504 |> eta_expand ctxt1 funcs |
507 |> eta_expand ctxt1 funcs |
505 |> rpair ctxt1 |
508 |> rpair ctxt1 |
506 |-> Lambda_Lifting.lift_lambdas NONE is_binder |
509 |-> Lambda_Lifting.lift_lambdas NONE is_binder |
507 |-> (fn (ts', defs) => fn ctxt' => |
510 |-> (fn (ts', ll_defs) => fn ctxt' => |
508 ts' @ map mk_trigger defs |
511 (ctxt', (intro_explicit_application ctxt' funcs (map mk_trigger ll_defs @ ts'), ll_defs))) |
509 |> intro_explicit_application ctxt' funcs |
|
510 |> pair ctxt') |
|
511 |
512 |
512 val ((rewrite_rules, builtin), ts4) = folify ctxt2 ts3 |
513 val ((rewrite_rules, builtin), ts4) = folify ctxt2 ts3 |
513 |>> apfst (cons fun_app_eq) |
514 |>> apfst (cons fun_app_eq) |
514 in |
515 in |
515 (ts4, tr_context) |
516 (ts4, tr_context) |
516 |-> intermediate logic dtyps (builtin SMT2_Builtin.dest_builtin) ctxt2 |
517 |-> intermediate logic dtyps (builtin SMT2_Builtin.dest_builtin) ctxt2 |
517 |>> uncurry (serialize smt_options comments) |
518 |>> uncurry (serialize smt_options comments) |
518 ||> replay_data_of ctxt2 rewrite_rules ithms |
519 ||> replay_data_of ctxt2 ll_defs rewrite_rules ithms |
519 end |
520 end |
520 |
521 |
521 end; |
522 end; |