1 (* Copyright (C) 2003-2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 (***************************************************************************)
30 (* Andrea Asperti <asperti@cs.unibo.it> *)
33 (***************************************************************************)
37 module P = Mpresentation
41 let p_mtr a b = Mpresentation.Mtr(a,b)
42 let p_mtd a b = Mpresentation.Mtd(a,b)
43 let p_mtable a b = Mpresentation.Mtable(a,b)
44 let p_mtext a b = Mpresentation.Mtext(a,b)
45 let p_mi a b = Mpresentation.Mi(a,b)
46 let p_mo a b = Mpresentation.Mo(a,b)
47 let p_mrow a b = Mpresentation.Mrow(a,b)
48 let p_mphantom a b = Mpresentation.Mphantom(a,b)
53 split (n-1) (List.tl l) in
56 let get_xref = function
58 | `Hypothesis d -> d.Con.dec_id
59 | `Proof p -> p.Con.proof_id
60 | `Definition d -> d.Con.def_id
61 | `Joint jo -> jo.Con.joint_id
64 RenderingAttrs.spacing_attributes `BoxML
65 @ RenderingAttrs.indent_attributes `BoxML
67 let make_row items concl =
68 B.b_hv hv_attrs (items @ [ concl ])
71 B.b_v attrs [B.b_h [] items; B.b_indent concl]
73 B.b_h attrs (items@[B.b_space; concl]) *)
75 let make_concl ?(attrs=[]) verb concl =
76 B.b_hv (hv_attrs @ attrs) [ B.b_kw verb; concl ]
79 B.b_v attrs [ B.b_kw verb; B.b_indent concl]
81 B.b_h attrs [ B.b_kw verb; B.b_space; concl ] *)
83 let make_args_for_apply term2pres args =
84 let make_arg_for_apply is_first arg row =
87 Con.Aux n -> assert false
90 (match prem.Con.premise_binder with
93 (B.b_object (P.Mi ([], name)))::row
96 Some "helm", "xref", lemma.Con.lemma_id;
97 Some "xlink", "href", lemma.Con.lemma_uri ]
99 (B.b_object (P.Mi(lemma_attrs,lemma.Con.lemma_name)))::row
101 if is_first || (not b) then
103 else (B.b_object (P.Mi([],"?")))::row
106 (B.b_object (P.Mi([],"?")))::row
108 if is_first then res else B.skip::res
112 make_arg_for_apply true hd
113 (List.fold_right (make_arg_for_apply false) tl [])
116 let get_name = function
120 let add_xref id = function
121 | B.Text (attrs, t) -> B.Text (((Some "helm", "xref", id) :: attrs), t)
122 | _ -> assert false (* TODO, add_xref is meaningful for all boxes *)
124 let rec justification term2pres p =
125 if ((p.Con.proof_conclude.Con.conclude_method = "Exact") or
126 ((p.Con.proof_context = []) &
127 (p.Con.proof_apply_context = []) &
128 (p.Con.proof_conclude.Con.conclude_method = "Apply"))) then
130 make_args_for_apply term2pres p.Con.proof_conclude.Con.conclude_args in
132 (B.b_kw "by")::B.b_space::
133 B.Text([],"(")::pres_args@[B.Text([],")")]), None
135 Some (B.b_toggle [B.b_kw "proof";proof2pres true term2pres p])
137 and proof2pres ?skip_initial_lambdas is_top_down term2pres p =
138 let rec proof2pres ?skip_initial_lambdas_internal is_top_down p omit_dot =
143 | `Hypothesis _ -> true
145 ((List.filter is_decl p.Con.proof_context) != []) in
146 let omit_conclusion = (not indent) && (p.Con.proof_context != []) in
148 (match p.Con.proof_conclude.Con.conclude_conclusion with
150 | Some t -> Some (term2pres t)) in
154 ?skip_initial_lambdas_internal:
155 (match skip_initial_lambdas_internal with
156 Some (`Later s) -> Some (`Now s)
159 p.Con.proof_name p.Con.proof_conclude indent omit_conclusion
163 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
164 p.Con.proof_apply_context
166 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
169 (match skip_initial_lambdas_internal with
170 Some (`Now n) -> snd (HExtlib.split_nth n p.Con.proof_context)
171 | _ -> p.Con.proof_context)
174 match p.Con.proof_name with
182 make_concl ~attrs:[ Some "helm", "xref", p.Con.proof_id ]
184 B.b_toggle [ B.H ([], [concl; B.skip ; B.Text([],"(");
185 B.Object ([], P.Mi ([],name));
186 B.Text([],")") ]) ; body ]
190 and context2pres c continuation =
191 (* we generate a subtable for each context element, for selection
193 The table generated by the head-element does not have an xref;
194 the whole context-proof is already selectable *)
200 (fun ce continuation ->
201 let xref = get_xref ce in
202 B.V([Some "helm", "xref", xref ],
203 [B.H([Some "helm", "xref", "ce_"^xref],
204 [ce2pres_in_proof_context_element ce]);
205 continuation])) tl continuation in
206 let hd_xref= get_xref hd in
208 [B.H([Some "helm", "xref", "ce_"^hd_xref],
209 [ce2pres_in_proof_context_element hd]);
212 and ce2pres_in_joint_context_element = function
213 | `Inductive _ -> assert false (* TODO *)
214 | (`Declaration _) as x -> ce2pres x
215 | (`Hypothesis _) as x -> ce2pres x
216 | (`Proof _) as x -> ce2pres x
217 | (`Definition _) as x -> ce2pres x
219 and ce2pres_in_proof_context_element = function
221 B.H ([],(List.map ce2pres_in_joint_context_element ho.Content.joint_defs))
222 | (`Declaration _) as x -> ce2pres x
223 | (`Hypothesis _) as x -> ce2pres x
224 | (`Proof _) as x -> ce2pres x
225 | (`Definition _) as x -> ce2pres x
230 let ty = term2pres d.Con.dec_type in
234 B.Object ([], P.Mi([],get_name d.Con.dec_name));
239 let ty = term2pres h.Con.dec_type in
246 B.Object ([], P.Mi ([],get_name h.Con.dec_name));
250 proof2pres false p false
252 let term = term2pres d.Con.def_term in
254 [ B.b_kw "let"; B.b_space;
255 B.Object ([], P.Mi([],get_name d.Con.def_name));
256 B.Text([],Utf8Macro.unicode_of_tex "\\def");
259 and acontext2pres is_top_down ac continuation indent in_bu_conversion =
261 (fun p continuation ->
264 B.indent (proof2pres is_top_down p in_bu_conversion)
266 proof2pres is_top_down p in_bu_conversion
268 B.V([Some "helm","xref",p.Con.proof_id],
269 [B.H([Some "helm","xref","ace_"^p.Con.proof_id],[hd]);
270 continuation])) ac continuation
272 and conclude2pres ?skip_initial_lambdas_internal is_top_down name conclude indent omit_conclusion omit_dot =
274 match conclude.Con.conclude_conclusion with
275 Some t (*when not omit_conclusion or
276 (* CSC: I ignore the omit_conclusion flag in this case. *)
277 (* CSC: Is this the correct behaviour? In the stylesheets *)
278 (* CSC: we simply generated nothing (i.e. the output type *)
279 (* CSC: of the function should become an option. *)
280 conclude.Con.conclude_method = "BU_Conversion" *) ->
281 let concl = term2pres t in
282 if conclude.Con.conclude_method = "BU_Conversion" then
284 (make_concl "that is equivalent to" concl ::
285 if is_top_down then [B.b_space ; B.b_kw "done";
286 B.Text([],".")] else [])
287 else if conclude.Con.conclude_method = "FalseInd" then
288 (* false ind is in charge to add the conclusion *)
294 conclude.Con.conclude_method = "Intros+LetTac"
296 let name = get_name name in
300 (match conclude.Con.conclude_conclusion with
301 None -> B.Text([],"NO EXPECTED!!!")
302 | Some c -> term2pres c)
304 [make_concl "we need to prove" expected;
307 B.Object ([], P.Mi ([],name));
314 conclude_aux ?skip_initial_lambdas_internal conclude in
316 if conclude.Con.conclude_method = "Intros+LetTac"
317 || conclude.Con.conclude_method = "ByInduction"
318 || conclude.Con.conclude_method = "TD_Conversion"
321 else if omit_conclusion then
322 B.H([], [B.b_kw "done" ; B.Text([],".") ])
324 ((if not is_top_down || omit_dot then [make_concl "we proved"
325 concl; B.Text([],if not is_top_down then "(previous)" else "")]
326 else [B.b_kw "done"]) @ if not omit_dot then [B.Text([],".")] else [])
328 B.V ([], prequel @ [conclude_body; ann_concl])
329 | _ -> conclude_aux ?skip_initial_lambdas_internal conclude
332 B.indent (B.H ([Some "helm", "xref", conclude.Con.conclude_id],
335 B.H ([Some "helm", "xref", conclude.Con.conclude_id],[tconclude_body])
337 and conclude_aux ?skip_initial_lambdas_internal conclude =
338 if conclude.Con.conclude_method = "TD_Conversion" then
340 (match conclude.Con.conclude_conclusion with
341 None -> B.Text([],"NO EXPECTED!!!")
342 | Some c -> term2pres c) in
344 (match conclude.Con.conclude_args with
345 [Con.ArgProof p] -> p
346 | _ -> assert false) in
348 (match subproof.Con.proof_conclude.Con.conclude_conclusion with
349 None -> B.Text([],"NO SYNTH!!!")
350 | Some c -> (term2pres c)) in
353 [make_concl "we need to prove" expected;
354 make_concl "or equivalently" synth;
356 proof2pres true subproof false])
357 else if conclude.Con.conclude_method = "BU_Conversion" then
359 else if conclude.Con.conclude_method = "Exact" then
361 (match conclude.Con.conclude_args with
362 [Con.Term (b,t)] -> assert (not b);term2pres t
364 (match p.Con.premise_binder with
365 | None -> assert false; (* unnamed hypothesis ??? *)
366 | Some s -> B.Text([],s))
367 | err -> assert false) in
368 (match conclude.Con.conclude_conclusion with
370 B.b_h [] [B.b_kw "by"; B.b_space; arg]
372 B.b_h [] [B.b_kw "by"; B.b_space; arg]
374 else if conclude.Con.conclude_method = "Intros+LetTac" then
375 (match conclude.Con.conclude_args with
377 (match conclude.Con.conclude_args with
379 proof2pres ?skip_initial_lambdas_internal true p false
384 (match conclude.Con.conclude_conclusion with
385 None -> B.Text([],"NO Conclusion!!!")
386 | Some c -> term2pres c) in
387 (match conclude.Con.conclude_args with
390 ([None,"align","baseline 1"; None,"equalrows","false";
391 None,"columnalign","left"],
392 [B.H([],[B.Object([],proof2pres p false)]);
394 (make_concl "we proved 1" conclusion))])]);
397 else if (conclude.Con.conclude_method = "Case") then
399 else if (conclude.Con.conclude_method = "ByInduction") then
401 else if (conclude.Con.conclude_method = "Exists") then
403 else if (conclude.Con.conclude_method = "AndInd") then
405 else if (conclude.Con.conclude_method = "FalseInd") then
407 else if (conclude.Con.conclude_method = "Rewrite") then
408 let justif1,justif2 =
409 (match (List.nth conclude.Con.conclude_args 6) with
410 Con.ArgProof p -> justification term2pres p
411 | _ -> assert false) in
413 (match List.nth conclude.Con.conclude_args 2 with
414 Con.Term (_,t) -> term2pres t
415 | _ -> assert false) in
417 (match List.nth conclude.Con.conclude_args 5 with
418 Con.Term (_,t) -> term2pres t
419 | _ -> assert false) in
425 B.b_space; (B.b_kw "with");
427 B.b_space; justif1])::
428 match justif2 with None -> [] | Some j -> [B.indent j])
429 *) B.V([], [justif1 ; B.H([],[B.b_kw "we proved (" ; term2 ; B.b_kw "=" ; term1; B.b_kw ") (previous)."]); B.b_kw "by _"])
430 else if conclude.Con.conclude_method = "Eq_chain" then
431 let justification p =
433 if skip_initial_lambdas <> None (* cheating *) then
437 let j1,j2 = justification term2pres p in
438 j1 :: B.b_space :: (match j2 with Some j -> [j] | None -> [])
443 | (Con.ArgProof p)::(Con.Term (_,t))::tl ->
444 B.HOV(RenderingAttrs.indent_attributes `BoxML,([B.b_kw
445 "=";B.b_space;term2pres t;B.b_space]@justification p@
446 (if tl <> [] then [B.Text ([],".")] else [])))::(aux tl)
450 match List.hd conclude.Con.conclude_args with
451 | Con.Term (_,t) -> t
454 B.HOV([],[B.b_kw "conclude";B.b_space;term2pres hd; (* B.b_space; *)
455 B.V ([],aux (List.tl conclude.Con.conclude_args))])
456 else if conclude.Con.conclude_method = "Apply" then
458 make_args_for_apply term2pres conclude.Con.conclude_args in
462 B.Text([],"(")::pres_args@[B.Text([],")")])
465 B.b_kw ("Apply method" ^ conclude.Con.conclude_method ^ " to");
466 (B.indent (B.V ([], args2pres conclude.Con.conclude_args)))])
468 and args2pres l = List.map arg2pres l
472 Con.Aux n -> B.b_kw ("aux " ^ n)
473 | Con.Premise prem -> B.b_kw "premise"
474 | Con.Lemma lemma -> B.b_kw "lemma"
475 | Con.Term (_,t) -> term2pres t
476 | Con.ArgProof p -> proof2pres true p false
477 | Con.ArgMethod s -> B.b_kw "method"
480 let proof_conclusion =
481 (match conclude.Con.conclude_conclusion with
482 None -> B.b_kw "No conclusion???"
483 | Some t -> term2pres t) in
484 let arg,args_for_cases =
485 (match conclude.Con.conclude_args with
486 Con.Aux(_)::Con.Aux(_)::Con.Term(_)::arg::tl ->
488 | _ -> assert false) in
492 Con.Aux n -> B.b_kw "an aux???"
493 | Con.Premise prem ->
494 (match prem.Con.premise_binder with
495 None -> B.b_kw "the previous result"
496 | Some n -> B.Object ([], P.Mi([],n)))
497 | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name))
500 | Con.ArgProof p -> B.b_kw "a proof???"
501 | Con.ArgMethod s -> B.b_kw "a method???")
503 (make_concl "we proceed by cases on" case_arg) in
505 (make_concl "to prove" proof_conclusion) in
506 B.V ([], case_on::to_prove::(make_cases args_for_cases))
508 and byinduction conclude =
509 let proof_conclusion =
510 (match conclude.Con.conclude_conclusion with
511 None -> B.b_kw "No conclusion???"
512 | Some t -> term2pres t) in
513 let inductive_arg,args_for_cases =
514 (match conclude.Con.conclude_args with
516 let l1,l2 = split (int_of_string n) tl in
517 let last_pos = (List.length l2)-1 in
518 List.nth l2 last_pos,l1
519 | _ -> assert false) in
522 (match inductive_arg with
523 Con.Aux n -> B.b_kw "an aux???"
524 | Con.Premise prem ->
525 (match prem.Con.premise_binder with
526 None -> B.b_kw "the previous result"
527 | Some n -> B.Object ([], P.Mi([],n)))
528 | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name))
531 | Con.ArgProof p -> B.b_kw "a proof???"
532 | Con.ArgMethod s -> B.b_kw "a method???") in
533 (make_concl "we proceed by induction on" arg) in
535 (make_concl "to prove" proof_conclusion) in
536 B.V ([], induction_on::to_prove:: B.Text([],".")::(make_cases args_for_cases))
538 and make_cases l = List.map make_case l
544 (match p.Con.proof_name with
545 None -> B.b_kw "no name for case!!"
546 | Some n -> B.Object ([], P.Mi([],n))) in
550 `Hypothesis h -> h.Con.dec_inductive
551 | _ -> false) p.Con.proof_context in
559 let name = get_name h.Con.dec_name in
562 B.Object ([], P.Mi ([],name));
564 (term2pres h.Con.dec_type);
566 | _ -> assert false (*[B.Text ([],"???")]*)) in
570 (B.b_kw "case"::B.b_space::name::pattern_aux)@
574 (match p.Con.proof_conclude.Con.conclude_conclusion with
575 None -> B.b_kw "No conclusion!!!"
576 | Some t -> term2pres t) in
577 let asubconcl = B.indent (make_concl "the thesis becomes" subconcl) in
578 let induction_hypothesis =
582 let text = B.indent (B.b_kw "by induction hypothesis we know") in
587 (match h.Con.dec_name with
591 [term2pres h.Con.dec_type;
594 B.Object ([], P.Mi ([],name));
597 | _ -> assert false in
598 let hyps = List.map make_hyp indhyps in
601 acontext2pres_old p.Con.proof_apply_context true in *)
603 conclude2pres true p.Con.proof_name p.Con.proof_conclude true true false in
606 match p.Con.proof_apply_context with
607 [] -> p.Con.proof_conclude.Con.conclude_id
608 | {Con.proof_id = id}::_ -> id
610 B.Action([None,"type","toggle"],
611 [ B.indent (add_xref acontext_id (B.b_kw "Proof"));
613 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
614 p.Con.proof_apply_context body true
615 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
617 B.V ([], pattern::induction_hypothesis@[asubconcl;B.Text([],".");presacontext])
620 and falseind conclude =
621 let proof_conclusion =
622 (match conclude.Con.conclude_conclusion with
623 None -> B.b_kw "No conclusion???"
624 | Some t -> term2pres t) in
626 (match conclude.Con.conclude_args with
627 [Con.Aux(n);_;case_arg] -> case_arg
630 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
634 Con.Aux n -> assert false
635 | Con.Premise prem ->
636 (match prem.Con.premise_binder with
637 None -> [B.b_kw "Contradiction, hence"]
639 [ B.Object ([],P.Mi([],n)); B.skip;
640 B.b_kw "is contradictory, hence"])
642 [ B.Object ([], P.Mi([],lemma.Con.lemma_name)); B.skip;
643 B.b_kw "is contradictory, hence" ]
644 | _ -> assert false) in
645 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
646 make_row arg proof_conclusion
648 and andind conclude =
650 (match conclude.Con.conclude_args with
651 [Con.Aux(n);_;Con.ArgProof proof;case_arg] -> proof,case_arg
654 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
658 Con.Aux n -> assert false
659 | Con.Premise prem ->
660 (match prem.Con.premise_binder with
662 | Some n -> [(B.b_kw "by"); B.b_space; B.Object([], P.Mi([],n))])
664 [(B.b_kw "by");B.skip;
665 B.Object([], P.Mi([],lemma.Con.lemma_name))]
666 | _ -> assert false) in
667 match proof.Con.proof_context with
668 `Hypothesis hyp1::`Hypothesis hyp2::tl ->
672 B.Object ([], P.Mi([],get_name hyp1.Con.dec_name));
675 term2pres hyp1.Con.dec_type]) in
679 B.Object ([], P.Mi([],get_name hyp2.Con.dec_name));
682 term2pres hyp2.Con.dec_type]) in
683 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
684 let body= conclude2pres false proof.Con.proof_name proof.Con.proof_conclude false true false in
686 acontext2pres false proof.Con.proof_apply_context body false false
690 [B.H ([],arg@[B.skip; B.b_kw "we have"]);
697 and exists conclude =
699 (match conclude.Con.conclude_args with
700 [Con.Aux(n);_;Con.ArgProof proof;_] -> proof
703 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
705 match proof.Con.proof_context with
706 `Declaration decl::`Hypothesis hyp::tl
707 | `Hypothesis decl::`Hypothesis hyp::tl ->
712 B.Object ([], P.Mi([],get_name decl.Con.dec_name));
713 B.Text([],":"); term2pres decl.Con.dec_type]) in
716 [(B.b_kw "such that");
719 B.Object ([], P.Mi([],get_name hyp.Con.dec_name));
722 term2pres hyp.Con.dec_type]) in
723 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
724 let body= conclude2pres false proof.Con.proof_name proof.Con.proof_conclude false true false in
726 acontext2pres false proof.Con.proof_apply_context body false false
737 ?skip_initial_lambdas_internal:
738 (match skip_initial_lambdas with
739 None -> Some (`Later 0) (* we already printed theorem: *)
740 | Some n -> Some (`Later n))
747 let conjecture2pres term2pres (id, n, context, ty) =
749 (B.b_hv [Some "helm", "xref", id]
751 B.b_h [] [B.b_text [] "{...}"; B.b_space];
756 [ B.b_object (p_mi [] "_") ;
757 B.b_object (p_mo [] ":?") ;
758 B.b_object (p_mi [] "_")]
759 | Some (`Declaration d)
760 | Some (`Hypothesis d) ->
761 let { Content.dec_name =
762 dec_name ; Content.dec_type = ty } = d
772 | Some (`Definition d) ->
774 { Content.def_name = def_name ;
775 Content.def_term = bo } = d
778 [ B.b_object (p_mi []
782 B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign");
785 let proof_name = p.Content.proof_name in
787 [ B.b_object (p_mi []
788 (match proof_name with
791 B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign");
792 proof2pres true term2pres p])
793 (List.rev context)) ] ::
795 [ B.b_text [] (Utf8Macro.unicode_of_tex "\\vdash");
796 B.b_object (p_mi [] (string_of_int n)) ;
800 let metasenv2pres term2pres = function
803 (* Conjectures are in their own table to make *)
804 (* diffing the DOM trees easier. *)
806 ((B.b_kw ("Conjectures:" ^
807 (let _ = incr counter; in (string_of_int !counter)))) ::
808 (List.map (conjecture2pres term2pres) metasenv'))]
810 let params2pres params =
812 B.b_text [Some "xlink", "href", UriManager.string_of_uri uri]
813 (UriManager.name_of_uri uri)
815 let rec spatiate = function
818 | hd :: tl -> hd :: B.b_text [] ", " :: spatiate tl
823 let params = spatiate (List.map param2pres p) in
825 B.b_h [] (B.b_text [] "[" :: params @ [ B.b_text [] "]" ])]
827 let recursion_kind2pres params kind =
830 | `Recursive _ -> "Recursive definition"
831 | `CoRecursive -> "CoRecursive definition"
832 | `Inductive _ -> "Inductive definition"
833 | `CoInductive _ -> "CoInductive definition"
835 B.b_h [] (B.b_kw kind :: params2pres params)
837 let inductive2pres term2pres ind =
838 let constructor2pres decl =
840 B.b_text [] ("| " ^ get_name decl.Content.dec_name ^ ":");
842 term2pres decl.Content.dec_type
847 B.b_kw (ind.Content.inductive_name ^ " of arity");
849 term2pres ind.Content.inductive_type ]
850 :: List.map constructor2pres ind.Content.inductive_constructors)
852 let joint_def2pres term2pres def =
854 | `Inductive ind -> inductive2pres term2pres ind
855 | _ -> assert false (* ZACK or raise ToDo? *)
858 ?skip_initial_lambdas ?(skip_thm_and_qed=false) term2pres
859 (id,params,metasenv,obj)
862 | `Def (Content.Const, thesis, `Proof p) ->
863 let name = get_name p.Content.proof_name in
864 let proof = proof2pres true term2pres ?skip_initial_lambdas p in
865 if skip_thm_and_qed then
869 [Some "helm","xref","id"]
870 ([ B.b_h [] (B.b_kw ("theorem " ^ name) ::
871 params2pres params @ [B.b_kw ":"]);
872 B.indent (term2pres thesis) ; B.b_kw "." ] @
873 metasenv2pres term2pres metasenv @
874 [proof ; B.b_kw "qed."])
875 | `Def (_, ty, `Definition body) ->
876 let name = get_name body.Content.def_name in
878 [Some "helm","xref","id"]
880 (B.b_kw ("definition " ^ name) :: params2pres params @ [B.b_kw ":"]);
881 B.indent (term2pres ty)] @
882 metasenv2pres term2pres metasenv @
884 B.indent (term2pres body.Content.def_term);
886 | `Decl (_, `Declaration decl)
887 | `Decl (_, `Hypothesis decl) ->
888 let name = get_name decl.Content.dec_name in
890 [Some "helm","xref","id"]
891 ([B.b_h [] (B.b_kw ("Axiom " ^ name) :: params2pres params);
893 B.indent (term2pres decl.Content.dec_type)] @
894 metasenv2pres term2pres metasenv)
897 (recursion_kind2pres params joint.Content.joint_kind
898 :: List.map (joint_def2pres term2pres) joint.Content.joint_defs)
902 ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_inner_sorts
904 content2pres ?skip_initial_lambdas ?skip_thm_and_qed
905 (fun ?(prec=90) annterm ->
906 let ast, ids_to_uris =
907 TermAcicContent.ast_of_acic ids_to_inner_sorts annterm
909 CicNotationPres.box_of_mpres
910 (CicNotationPres.render ids_to_uris ~prec
911 (TermContentPres.pp_ast ast)))