equal
deleted
inserted
replaced
9 val proofT: typ |
9 val proofT: typ |
10 val add_proof_syntax: theory -> theory |
10 val add_proof_syntax: theory -> theory |
11 val proof_of_term: theory -> bool -> term -> Proofterm.proof |
11 val proof_of_term: theory -> bool -> term -> Proofterm.proof |
12 val term_of_proof: Proofterm.proof -> term |
12 val term_of_proof: Proofterm.proof -> term |
13 val cterm_of_proof: theory -> Proofterm.proof -> cterm * (cterm -> Proofterm.proof) |
13 val cterm_of_proof: theory -> Proofterm.proof -> cterm * (cterm -> Proofterm.proof) |
14 val strip_sorts_consttypes: Proof.context -> Proof.context |
|
15 val read_term: theory -> bool -> typ -> string -> term |
14 val read_term: theory -> bool -> typ -> string -> term |
16 val read_proof: theory -> bool -> bool -> string -> Proofterm.proof |
15 val read_proof: theory -> bool -> bool -> string -> Proofterm.proof |
17 val proof_syntax: Proofterm.proof -> theory -> theory |
16 val proof_syntax: Proofterm.proof -> theory -> theory |
18 val proof_of: bool -> thm -> Proofterm.proof |
17 val proof_of: bool -> thm -> Proofterm.proof |
19 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
18 val pretty_proof: Proof.context -> Proofterm.proof -> Pretty.T |
199 (map (Long_Name.append "axm") axm_names @ map (Long_Name.append "thm") thm_names); |
198 (map (Long_Name.append "axm") axm_names @ map (Long_Name.append "thm") thm_names); |
200 in |
199 in |
201 (cterm_of thy' (term_of_proof prf), proof_of_term thy true o Thm.term_of) |
200 (cterm_of thy' (term_of_proof prf), proof_of_term thy true o Thm.term_of) |
202 end; |
201 end; |
203 |
202 |
204 fun strip_sorts_consttypes ctxt = |
|
205 let val {constants = (_, tab), ...} = Consts.dest (Proof_Context.consts_of ctxt) |
|
206 in Symtab.fold (fn (s, (T, _)) => |
|
207 Proof_Context.add_const_constraint (s, SOME (Type.strip_sorts T))) |
|
208 tab ctxt |
|
209 end; |
|
210 |
|
211 fun read_term thy topsort = |
203 fun read_term thy topsort = |
212 let |
204 let |
213 val thm_names = filter_out (fn s => s = "") (map fst (Global_Theory.all_thms_of thy)); |
205 val thm_names = filter_out (fn s => s = "") (map fst (Global_Theory.all_thms_of thy)); |
214 val axm_names = map fst (Theory.all_axioms_of thy); |
206 val axm_names = map fst (Theory.all_axioms_of thy); |
215 val ctxt = thy |
207 val ctxt = thy |
217 |> add_proof_atom_consts |
209 |> add_proof_atom_consts |
218 (map (Long_Name.append "axm") axm_names @ map (Long_Name.append "thm") thm_names) |
210 (map (Long_Name.append "axm") axm_names @ map (Long_Name.append "thm") thm_names) |
219 |> Proof_Context.init_global |
211 |> Proof_Context.init_global |
220 |> Proof_Context.allow_dummies |
212 |> Proof_Context.allow_dummies |
221 |> Proof_Context.set_mode Proof_Context.mode_schematic |
213 |> Proof_Context.set_mode Proof_Context.mode_schematic |
222 |> (if topsort then |
214 |> topsort ? (Config.put Type_Infer_Context.const_sorts false #> Proof_Context.set_defsort []); |
223 strip_sorts_consttypes #> |
|
224 Proof_Context.set_defsort [] |
|
225 else I); |
|
226 in |
215 in |
227 fn ty => fn s => |
216 fn ty => fn s => |
228 (if ty = propT then Syntax.parse_prop else Syntax.parse_term) ctxt s |
217 (if ty = propT then Syntax.parse_prop else Syntax.parse_term) ctxt s |
229 |> Type.constraint ty |> Syntax.check_term ctxt |
218 |> Type.constraint ty |> Syntax.check_term ctxt |
230 end; |
219 end; |