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 *)
293 (match skip_initial_lambdas_internal with
295 | Some (`Later _) -> true
296 | Some (`Now _) -> false)
297 && conclude.Con.conclude_method = "Intros+LetTac"
299 let name = get_name name in
303 (match conclude.Con.conclude_conclusion with
304 None -> B.Text([],"NO EXPECTED!!!")
305 | Some c -> term2pres c)
307 [make_concl "we need to prove" expected;
310 B.Object ([], P.Mi ([],name));
317 conclude_aux ?skip_initial_lambdas_internal conclude in
319 if conclude.Con.conclude_method = "Intros+LetTac"
320 || conclude.Con.conclude_method = "ByInduction"
321 || conclude.Con.conclude_method = "TD_Conversion"
324 else if omit_conclusion then
325 B.H([], [B.b_kw "done" ; B.Text([],".") ])
327 ((if not is_top_down || omit_dot then [make_concl "we proved"
328 concl; B.Text([],if not is_top_down then "(previous)" else "")]
329 else [B.b_kw "done"]) @ if not omit_dot then [B.Text([],".")] else [])
331 B.V ([], prequel @ [conclude_body; ann_concl])
332 | _ -> conclude_aux ?skip_initial_lambdas_internal conclude
335 B.indent (B.H ([Some "helm", "xref", conclude.Con.conclude_id],
338 B.H ([Some "helm", "xref", conclude.Con.conclude_id],[tconclude_body])
340 and conclude_aux ?skip_initial_lambdas_internal conclude =
341 if conclude.Con.conclude_method = "TD_Conversion" then
343 (match conclude.Con.conclude_conclusion with
344 None -> B.Text([],"NO EXPECTED!!!")
345 | Some c -> term2pres c) in
347 (match conclude.Con.conclude_args with
348 [Con.ArgProof p] -> p
349 | _ -> assert false) in
351 (match subproof.Con.proof_conclude.Con.conclude_conclusion with
352 None -> B.Text([],"NO SYNTH!!!")
353 | Some c -> (term2pres c)) in
356 [make_concl "we need to prove" expected;
357 make_concl "or equivalently" synth;
359 proof2pres true subproof false])
360 else if conclude.Con.conclude_method = "BU_Conversion" then
362 else if conclude.Con.conclude_method = "Exact" then
364 (match conclude.Con.conclude_args with
365 [Con.Term (b,t)] -> assert (not b);term2pres t
367 (match p.Con.premise_binder with
368 | None -> assert false; (* unnamed hypothesis ??? *)
369 | Some s -> B.Text([],s))
370 | err -> assert false) in
371 (match conclude.Con.conclude_conclusion with
373 B.b_h [] [B.b_kw "by"; B.b_space; arg]
375 B.b_h [] [B.b_kw "by"; B.b_space; arg]
377 else if conclude.Con.conclude_method = "Intros+LetTac" then
378 (match conclude.Con.conclude_args with
380 (match conclude.Con.conclude_args with
382 proof2pres ?skip_initial_lambdas_internal true p false
387 (match conclude.Con.conclude_conclusion with
388 None -> B.Text([],"NO Conclusion!!!")
389 | Some c -> term2pres c) in
390 (match conclude.Con.conclude_args with
393 ([None,"align","baseline 1"; None,"equalrows","false";
394 None,"columnalign","left"],
395 [B.H([],[B.Object([],proof2pres p false)]);
397 (make_concl "we proved 1" conclusion))])]);
400 else if (conclude.Con.conclude_method = "Case") then
402 else if (conclude.Con.conclude_method = "ByInduction") then
404 else if (conclude.Con.conclude_method = "Exists") then
406 else if (conclude.Con.conclude_method = "AndInd") then
408 else if (conclude.Con.conclude_method = "FalseInd") then
410 else if (conclude.Con.conclude_method = "Rewrite") then
411 let justif1,justif2 =
412 (match (List.nth conclude.Con.conclude_args 6) with
413 Con.ArgProof p -> justification term2pres p
414 | _ -> assert false) in
416 (match List.nth conclude.Con.conclude_args 2 with
417 Con.Term (_,t) -> term2pres t
418 | _ -> assert false) in
420 (match List.nth conclude.Con.conclude_args 5 with
421 Con.Term (_,t) -> term2pres t
422 | _ -> assert false) in
428 B.b_space; (B.b_kw "with");
430 B.b_space; justif1])::
431 match justif2 with None -> [] | Some j -> [B.indent j])
432 *) B.V([], [justif1 ; B.H([],[B.b_kw "we proved (" ; term2 ; B.b_kw "=" ; term1; B.b_kw ") (previous)."]); B.b_kw "by _"])
433 else if conclude.Con.conclude_method = "Eq_chain" then
434 let justification p =
436 if skip_initial_lambdas <> None (* cheating *) then
440 let j1,j2 = justification term2pres p in
441 j1 :: B.b_space :: (match j2 with Some j -> [j] | None -> [])
446 | (Con.ArgProof p)::(Con.Term (_,t))::tl ->
447 B.HOV(RenderingAttrs.indent_attributes `BoxML,([B.b_kw
448 "=";B.b_space;term2pres t;B.b_space]@justification p@
449 (if tl <> [] then [B.Text ([],".")] else [])))::(aux tl)
453 match List.hd conclude.Con.conclude_args with
454 | Con.Term (_,t) -> t
457 B.HOV([],[B.b_kw "conclude";B.b_space;term2pres hd; (* B.b_space; *)
458 B.V ([],aux (List.tl conclude.Con.conclude_args))])
459 else if conclude.Con.conclude_method = "Apply" then
461 make_args_for_apply term2pres conclude.Con.conclude_args in
465 B.Text([],"(")::pres_args@[B.Text([],")")])
468 B.b_kw ("Apply method" ^ conclude.Con.conclude_method ^ " to");
469 (B.indent (B.V ([], args2pres conclude.Con.conclude_args)))])
471 and args2pres l = List.map arg2pres l
475 Con.Aux n -> B.b_kw ("aux " ^ n)
476 | Con.Premise prem -> B.b_kw "premise"
477 | Con.Lemma lemma -> B.b_kw "lemma"
478 | Con.Term (_,t) -> term2pres t
479 | Con.ArgProof p -> proof2pres true p false
480 | Con.ArgMethod s -> B.b_kw "method"
483 let proof_conclusion =
484 (match conclude.Con.conclude_conclusion with
485 None -> B.b_kw "No conclusion???"
486 | Some t -> term2pres t) in
487 let arg,args_for_cases =
488 (match conclude.Con.conclude_args with
489 Con.Aux(_)::Con.Aux(_)::Con.Term(_)::arg::tl ->
491 | _ -> assert false) in
495 Con.Aux n -> B.b_kw "an aux???"
496 | Con.Premise prem ->
497 (match prem.Con.premise_binder with
498 None -> B.b_kw "the previous result"
499 | Some n -> B.Object ([], P.Mi([],n)))
500 | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name))
503 | Con.ArgProof p -> B.b_kw "a proof???"
504 | Con.ArgMethod s -> B.b_kw "a method???")
506 (make_concl "we proceed by cases on" case_arg) in
508 (make_concl "to prove" proof_conclusion) in
509 B.V ([], case_on::to_prove::(make_cases args_for_cases))
511 and byinduction conclude =
512 let proof_conclusion =
513 (match conclude.Con.conclude_conclusion with
514 None -> B.b_kw "No conclusion???"
515 | Some t -> term2pres t) in
516 let inductive_arg,args_for_cases =
517 (match conclude.Con.conclude_args with
519 let l1,l2 = split (int_of_string n) tl in
520 let last_pos = (List.length l2)-1 in
521 List.nth l2 last_pos,l1
522 | _ -> assert false) in
525 (match inductive_arg with
526 Con.Aux n -> B.b_kw "an aux???"
527 | Con.Premise prem ->
528 (match prem.Con.premise_binder with
529 None -> B.b_kw "the previous result"
530 | Some n -> B.Object ([], P.Mi([],n)))
531 | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name))
534 | Con.ArgProof p -> B.b_kw "a proof???"
535 | Con.ArgMethod s -> B.b_kw "a method???") in
536 (make_concl "we proceed by induction on" arg) in
538 (make_concl "to prove" proof_conclusion) in
539 B.V ([], induction_on::to_prove:: B.Text([],".")::(make_cases args_for_cases))
541 and make_cases l = List.map make_case l
547 (match p.Con.proof_name with
548 None -> B.b_kw "no name for case!!"
549 | Some n -> B.Object ([], P.Mi([],n))) in
553 `Hypothesis h -> h.Con.dec_inductive
554 | _ -> false) p.Con.proof_context in
562 let name = get_name h.Con.dec_name in
565 B.Object ([], P.Mi ([],name));
567 (term2pres h.Con.dec_type);
569 | _ -> assert false (*[B.Text ([],"???")]*)) in
573 (B.b_kw "case"::B.b_space::name::pattern_aux)@
577 (match p.Con.proof_conclude.Con.conclude_conclusion with
578 None -> B.b_kw "No conclusion!!!"
579 | Some t -> term2pres t) in
580 let asubconcl = B.indent (make_concl "the thesis becomes" subconcl) in
581 let induction_hypothesis =
585 let text = B.indent (B.b_kw "by induction hypothesis we know") in
590 (match h.Con.dec_name with
594 [term2pres h.Con.dec_type;
597 B.Object ([], P.Mi ([],name));
600 | _ -> assert false in
601 let hyps = List.map make_hyp indhyps in
604 acontext2pres_old p.Con.proof_apply_context true in *)
606 conclude2pres true p.Con.proof_name p.Con.proof_conclude true true false in
609 match p.Con.proof_apply_context with
610 [] -> p.Con.proof_conclude.Con.conclude_id
611 | {Con.proof_id = id}::_ -> id
613 B.Action([None,"type","toggle"],
614 [ B.indent (add_xref acontext_id (B.b_kw "Proof"));
616 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
617 p.Con.proof_apply_context body true
618 (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion")
620 B.V ([], pattern::induction_hypothesis@[asubconcl;B.Text([],".");presacontext])
623 and falseind conclude =
624 let proof_conclusion =
625 (match conclude.Con.conclude_conclusion with
626 None -> B.b_kw "No conclusion???"
627 | Some t -> term2pres t) in
629 (match conclude.Con.conclude_args with
630 [Con.Aux(n);_;case_arg] -> case_arg
633 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
637 Con.Aux n -> assert false
638 | Con.Premise prem ->
639 (match prem.Con.premise_binder with
640 None -> [B.b_kw "Contradiction, hence"]
642 [ B.Object ([],P.Mi([],n)); B.skip;
643 B.b_kw "is contradictory, hence"])
645 [ B.Object ([], P.Mi([],lemma.Con.lemma_name)); B.skip;
646 B.b_kw "is contradictory, hence" ]
647 | _ -> assert false) in
648 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
649 make_row arg proof_conclusion
651 and andind conclude =
653 (match conclude.Con.conclude_args with
654 [Con.Aux(n);_;Con.ArgProof proof;case_arg] -> proof,case_arg
657 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
661 Con.Aux n -> assert false
662 | Con.Premise prem ->
663 (match prem.Con.premise_binder with
665 | Some n -> [(B.b_kw "by"); B.b_space; B.Object([], P.Mi([],n))])
667 [(B.b_kw "by");B.skip;
668 B.Object([], P.Mi([],lemma.Con.lemma_name))]
669 | _ -> assert false) in
670 match proof.Con.proof_context with
671 `Hypothesis hyp1::`Hypothesis hyp2::tl ->
675 B.Object ([], P.Mi([],get_name hyp1.Con.dec_name));
678 term2pres hyp1.Con.dec_type]) in
682 B.Object ([], P.Mi([],get_name hyp2.Con.dec_name));
685 term2pres hyp2.Con.dec_type]) in
686 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
687 let body= conclude2pres false proof.Con.proof_name proof.Con.proof_conclude false true false in
689 acontext2pres false proof.Con.proof_apply_context body false false
693 [B.H ([],arg@[B.skip; B.b_kw "we have"]);
700 and exists conclude =
702 (match conclude.Con.conclude_args with
703 [Con.Aux(n);_;Con.ArgProof proof;_] -> proof
706 List.map (ContentPp.parg 0) conclude.Con.conclude_args;
708 match proof.Con.proof_context with
709 `Declaration decl::`Hypothesis hyp::tl
710 | `Hypothesis decl::`Hypothesis hyp::tl ->
715 B.Object ([], P.Mi([],get_name decl.Con.dec_name));
716 B.Text([],":"); term2pres decl.Con.dec_type]) in
719 [(B.b_kw "such that");
722 B.Object ([], P.Mi([],get_name hyp.Con.dec_name));
725 term2pres hyp.Con.dec_type]) in
726 (* let body = proof2pres {proof with Con.proof_context = tl} false in *)
727 let body= conclude2pres false proof.Con.proof_name proof.Con.proof_conclude false true false in
729 acontext2pres false proof.Con.proof_apply_context body false false
740 ?skip_initial_lambdas_internal:
741 (match skip_initial_lambdas with
742 None -> Some (`Later 0) (* we already printed theorem: *)
743 | Some n -> Some (`Later n))
750 let conjecture2pres term2pres (id, n, context, ty) =
752 (B.b_hv [Some "helm", "xref", id]
754 B.b_h [] [B.b_text [] "{...}"; B.b_space];
759 [ B.b_object (p_mi [] "_") ;
760 B.b_object (p_mo [] ":?") ;
761 B.b_object (p_mi [] "_")]
762 | Some (`Declaration d)
763 | Some (`Hypothesis d) ->
764 let { Content.dec_name =
765 dec_name ; Content.dec_type = ty } = d
775 | Some (`Definition d) ->
777 { Content.def_name = def_name ;
778 Content.def_term = bo } = d
781 [ B.b_object (p_mi []
785 B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign");
788 let proof_name = p.Content.proof_name in
790 [ B.b_object (p_mi []
791 (match proof_name with
794 B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign");
795 proof2pres true term2pres p])
796 (List.rev context)) ] ::
798 [ B.b_text [] (Utf8Macro.unicode_of_tex "\\vdash");
799 B.b_object (p_mi [] (string_of_int n)) ;
803 let metasenv2pres term2pres = function
806 (* Conjectures are in their own table to make *)
807 (* diffing the DOM trees easier. *)
809 ((B.b_kw ("Conjectures:" ^
810 (let _ = incr counter; in (string_of_int !counter)))) ::
811 (List.map (conjecture2pres term2pres) metasenv'))]
813 let params2pres params =
815 B.b_text [Some "xlink", "href", UriManager.string_of_uri uri]
816 (UriManager.name_of_uri uri)
818 let rec spatiate = function
821 | hd :: tl -> hd :: B.b_text [] ", " :: spatiate tl
826 let params = spatiate (List.map param2pres p) in
828 B.b_h [] (B.b_text [] "[" :: params @ [ B.b_text [] "]" ])]
830 let recursion_kind2pres params kind =
833 | `Recursive _ -> "Recursive definition"
834 | `CoRecursive -> "CoRecursive definition"
835 | `Inductive _ -> "Inductive definition"
836 | `CoInductive _ -> "CoInductive definition"
838 B.b_h [] (B.b_kw kind :: params2pres params)
840 let inductive2pres term2pres ind =
841 let constructor2pres decl =
843 B.b_text [] ("| " ^ get_name decl.Content.dec_name ^ ":");
845 term2pres decl.Content.dec_type
850 B.b_kw (ind.Content.inductive_name ^ " of arity");
852 term2pres ind.Content.inductive_type ]
853 :: List.map constructor2pres ind.Content.inductive_constructors)
855 let joint_def2pres term2pres def =
857 | `Inductive ind -> inductive2pres term2pres ind
858 | _ -> assert false (* ZACK or raise ToDo? *)
861 ?skip_initial_lambdas ?(skip_thm_and_qed=false) term2pres
862 (id,params,metasenv,obj)
865 | `Def (Content.Const, thesis, `Proof p) ->
866 let name = get_name p.Content.proof_name in
867 let proof = proof2pres true term2pres ?skip_initial_lambdas p in
868 if skip_thm_and_qed then
872 [Some "helm","xref","id"]
873 ([ B.b_h [] (B.b_kw ("theorem " ^ name) ::
874 params2pres params @ [B.b_kw ":"]);
875 B.indent (term2pres thesis) ; B.b_kw "." ] @
876 metasenv2pres term2pres metasenv @
877 [proof ; B.b_kw "qed."])
878 | `Def (_, ty, `Definition body) ->
879 let name = get_name body.Content.def_name in
881 [Some "helm","xref","id"]
883 (B.b_kw ("definition " ^ name) :: params2pres params @ [B.b_kw ":"]);
884 B.indent (term2pres ty)] @
885 metasenv2pres term2pres metasenv @
887 B.indent (term2pres body.Content.def_term);
889 | `Decl (_, `Declaration decl)
890 | `Decl (_, `Hypothesis decl) ->
891 let name = get_name decl.Content.dec_name in
893 [Some "helm","xref","id"]
894 ([B.b_h [] (B.b_kw ("Axiom " ^ name) :: params2pres params);
896 B.indent (term2pres decl.Content.dec_type)] @
897 metasenv2pres term2pres metasenv)
900 (recursion_kind2pres params joint.Content.joint_kind
901 :: List.map (joint_def2pres term2pres) joint.Content.joint_defs)
905 ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_inner_sorts
907 content2pres ?skip_initial_lambdas ?skip_thm_and_qed
908 (fun ?(prec=90) annterm ->
909 let ast, ids_to_uris =
910 TermAcicContent.ast_of_acic ids_to_inner_sorts annterm
912 CicNotationPres.box_of_mpres
913 (CicNotationPres.render ids_to_uris ~prec
914 (TermContentPres.pp_ast ast)))