From cbd3ca06d7b0c8ea32cfc15b7206a940259e479e Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Thu, 11 Jun 2009 13:57:41 +0000 Subject: [PATCH] content2pres for the new cic fixed --- .../components/content_pres/content2pres.ml | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/helm/software/components/content_pres/content2pres.ml b/helm/software/components/content_pres/content2pres.ml index 282cfe26e..6dee8f040 100644 --- a/helm/software/components/content_pres/content2pres.ml +++ b/helm/software/components/content_pres/content2pres.ml @@ -963,7 +963,7 @@ let content2pres0 let name = get_name decl.Content.dec_name in B.b_v [Some "helm","xref","id"] - ([B.b_h [] (B.b_kw ("Axiom " ^ name) :: params2pres params); + ([B.b_h [] (B.b_kw ("axiom " ^ name) :: params2pres params); B.b_kw "Type:"; B.indent (term2pres decl.Content.dec_type)] @ metasenv2pres term2pres metasenv) @@ -986,6 +986,50 @@ let content2pres ~lookup_uri:(CicNotationPres.lookup_uri ids_to_uris) ~prec (TermContentPres.pp_ast ast))) +let ncontent2pres0 + ?skip_initial_lambdas ?(skip_thm_and_qed=false) term2pres + (id,params,metasenv,obj) += + match obj with + | `Def (Content.Const, thesis, `Proof p) -> + let name = get_name p.Content.proof_name in + let proof = proof2pres true term2pres ?skip_initial_lambdas p in + if skip_thm_and_qed then + proof + else + B.b_v + [Some "helm","xref","id"] + ([ B.b_h [] (B.b_kw ("ntheorem " ^ name) :: + params2pres params @ [B.b_kw ":"]); + B.H ([],[B.indent (term2pres thesis) ; B.b_kw "." ])] @ + metasenv2pres term2pres metasenv @ + [proof ; B.b_kw "qed."]) + | `Def (_, ty, `Definition body) -> + let name = get_name body.Content.def_name in + B.b_v + [Some "helm","xref","id"] + ([B.b_h [] + (B.b_kw ("ndefinition " ^ name) :: params2pres params @ [B.b_kw ":"]); + B.indent (term2pres ty)] @ + metasenv2pres term2pres metasenv @ + [B.b_kw ":="; + B.indent (term2pres body.Content.def_term); + B.b_kw "."]) + | `Decl (_, `Declaration decl) + | `Decl (_, `Hypothesis decl) -> + let name = get_name decl.Content.dec_name in + B.b_v + [Some "helm","xref","id"] + ([B.b_h [] (B.b_kw ("naxiom " ^ name) :: params2pres params); + B.b_kw "Type:"; + B.indent (term2pres decl.Content.dec_type)] @ + metasenv2pres term2pres metasenv) + | `Joint joint -> + B.b_v [] + (recursion_kind2pres params joint.Content.joint_kind + :: List.map (joint_def2pres term2pres) joint.Content.joint_defs) + | _ -> raise ToDo + let ncontent2pres ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_nrefs = let lookup_uri id = try @@ -993,7 +1037,7 @@ let ncontent2pres ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_nrefs = Some (NReference.string_of_reference nref) with Not_found -> None in - content2pres0 ?skip_initial_lambdas ?skip_thm_and_qed + ncontent2pres0 ?skip_initial_lambdas ?skip_thm_and_qed (fun ?(prec=90) ast -> CicNotationPres.box_of_mpres (CicNotationPres.render ~lookup_uri ~prec (TermContentPres.pp_ast ast))) -- 2.39.2