let is_big_general countterm p =
let maxsize = Cexpr2pres.maxsize in
- let module Con = Cic2content in
+ let module Con = Content in
let rec countp current_size p =
if current_size > maxsize then current_size
else
if current_size > maxsize then maxsize
else
(match e with
- Con.Declaration d ->
+ `Declaration d ->
(match d.Con.dec_name with
Some s -> current_size + 4 + (String.length s)
| None -> prerr_endline "NO NAME!!"; assert false)
- | Con.Hypothesis h ->
+ | `Hypothesis h ->
(match h.Con.dec_name with
Some s -> current_size + 4 + (String.length s)
| None -> prerr_endline "NO NAME!!"; assert false)
- | Con.Proof p -> countp current_size p
- | Con.Definition d ->
+ | `Proof p -> countp current_size p
+ | `Definition d ->
(match d.Con.def_name with
Some s ->
let c1 = (current_size + 4 + (String.length s)) in
(countterm c1 d.Con.def_term)
| None ->
prerr_endline "NO NAME!!"; assert false)
- | Con.Joint ho -> maxsize + 1) (* we assume is big *)
+ | `Joint ho -> maxsize + 1) (* we assume is big *)
and
countapplycontext current_size ac =
List.fold_left countp current_size ac
;;
let make_args_for_apply term2pres args =
- let module Con = Cic2content in
+ let module Con = Content in
let module P = Mpresentation in
let rec make_arg_for_apply is_first arg row =
(match arg with
| _ -> assert false;;
let rec justification term2pres p =
- let module Con = Cic2content in
+ let module Con = Content in
let module P = Mpresentation in
if ((p.Con.proof_conclude.Con.conclude_method = "Exact") or
((p.Con.proof_context = []) &
and proof2pres term2pres p =
let rec proof2pres p =
- let module Con = Cic2content in
+ let module Con = Content in
let module P = Mpresentation in
let indent =
let is_decl e =
(match e with
- Con.Declaration _
- | Con.Hypothesis _ -> true
+ `Declaration _
+ | `Hypothesis _ -> true
| _ -> false) in
((List.filter is_decl p.Con.proof_context) != []) in
let concl =
None -> P.Mtext([],"NO PROOF!!!")
| Some c -> c) in
let action =
- P.Maction([None,"actiontype","toggle"],
+ P.Maction([None,"actiontype","toggle" ;
+ None,"selection","1"],
[(make_concl "proof of" ac);
body]) in
P.Mtable ([None,"align","baseline 1"; None,"equalrows","false";
and ce2pres =
let module P = Mpresentation in
- let module Con = Cic2content in
+ let module Con = Content in
function
- Con.Declaration d ->
+ `Declaration d ->
(match d.Con.dec_name with
Some s ->
let ty = term2pres d.Con.dec_type in
ty])
| None ->
prerr_endline "NO NAME!!"; assert false)
- | Con.Hypothesis h ->
+ | `Hypothesis h ->
(match h.Con.dec_name with
Some s ->
let ty = term2pres h.Con.dec_type in
ty])
| None ->
prerr_endline "NO NAME!!"; assert false)
- | Con.Proof p -> proof2pres p
- | Con.Definition d ->
+ | `Proof p -> proof2pres p
+ | `Definition d ->
(match d.Con.def_name with
Some s ->
let term = term2pres d.Con.def_term in
term])
| None ->
prerr_endline "NO NAME!!"; assert false)
- | Con.Joint ho ->
+ | `Joint ho ->
P.Mtext ([],"jointdef")
and acontext2pres ac continuation indent =
[P.Mtd ([], conclude_aux conclude)])
and conclude_aux conclude =
- let module Con = Cic2content in
+ let module Con = Content in
let module P = Mpresentation in
if conclude.Con.conclude_method = "TD_Conversion" then
let expected =
and arg2pres =
let module P = Mpresentation in
- let module Con = Cic2content in
+ let module Con = Content in
function
Con.Aux n ->
- P.Mtext ([],"aux " ^ string_of_int n)
+ P.Mtext ([],"aux " ^ n)
| Con.Premise prem ->
P.Mtext ([],"premise")
| Con.Term t ->
and byinduction conclude =
let module P = Mpresentation in
- let module Con = Cic2content in
+ let module Con = Content in
let proof_conclusion =
(match conclude.Con.conclude_conclusion with
None -> P.Mtext([],"No conclusion???")
let inductive_arg,args_for_cases =
(match conclude.Con.conclude_args with
Con.Aux(n)::_::tl ->
- let l1,l2 = split n tl in
+ let l1,l2 = split (int_of_string n) tl in
let last_pos = (List.length l2)-1 in
List.nth l2 last_pos,l1
| _ -> assert false) in
and make_case =
let module P = Mpresentation in
- let module Con = Cic2content in
+ let module Con = Content in
function
Con.ArgProof p ->
let name =
let indhyps,args =
List.partition
(function
- Con.Hypothesis h -> h.Con.dec_inductive
+ `Hypothesis h -> h.Con.dec_inductive
| _ -> false) p.Con.proof_context in
let pattern_aux =
List.fold_right
(fun e p ->
let dec =
(match e with
- Con.Declaration h
- | Con.Hypothesis h ->
+ `Declaration h
+ | `Hypothesis h ->
let name =
(match h.Con.dec_name with
None -> "NO NAME???"
(P.Mtext([],"by induction hypothesis we know:")))]) in
let make_hyp =
function
- Con.Hypothesis h ->
+ `Hypothesis h ->
let name =
(match h.Con.dec_name with
None -> "no name"
proof2pres p
;;
-(*
-let content2pres =
- proof2pres
- (function p -> Cexpr2pres.cexpr2pres_charcount (Content_expressions.acic2cexpr p))
-;; *)
-
+exception ToDo;;
+let content2pres term2pres (id,params,metasenv,obj) =
+ let module K = Content in
+ let module P = Mpresentation in
+ match obj with
+ `Def (K.Const,thesis,`Proof p) ->
+ P.Mtable
+ [None,"align","baseline 1";
+ None,"equalrows","false";
+ None,"columnalign","left";
+ None,"helm:xref","id"]
+ ([P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ [P.Mtext []
+ ("UNFINISHED PROOF" ^ id ^"(" ^
+ String.concat " ; " (List.map UriManager.string_of_uri params)^
+ ")")])] ;
+ P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ [P.Mtext [] "THESIS:"])] ;
+ P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ [P.Mphantom []
+ (P.Mtext [] "__") ;
+ term2pres thesis])]] @
+ (match metasenv with
+ None -> []
+ | Some metasenv' ->
+ [P.Mtr []
+ [P.Mtd []
+ (* Conjectures are in their own table to make *)
+ (* diffing the DOM trees easier. *)
+ (P.Mtable
+ [None,"align","baseline 1";
+ None,"equalrows","false";
+ None,"columnalign","left"]
+ ((P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ [P.Mtext [] "CONJECTURES:"])])::
+ List.map
+ (function
+ (id,n,context,ty) ->
+ P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ (List.map
+ (function
+ (_,None) ->
+ P.Mrow []
+ [ P.Mi [] "_" ;
+ P.Mo [] ":?" ;
+ P.Mi [] "_"]
+ | (_,Some (`Declaration d))
+ | (_,Some (`Hypothesis d)) ->
+ let
+ { K.dec_name = dec_name ;
+ K.dec_type = ty } = d
+ in
+ P.Mrow []
+ [ P.Mi []
+ (match dec_name with
+ None -> "_"
+ | Some n -> n) ;
+ P.Mo [] ":" ;
+ term2pres ty]
+ | (_,Some (`Definition d)) ->
+ let
+ { K.def_name = def_name ;
+ K.def_term = bo } = d
+ in
+ P.Mrow []
+ [ P.Mi []
+ (match def_name with
+ None -> "_"
+ | Some n -> n) ;
+ P.Mo [] ":=" ;
+ term2pres bo]
+ | (_,Some (`Proof p)) ->
+ let proof_name = p.K.proof_name in
+ P.Mrow []
+ [ P.Mi []
+ (match proof_name with
+ None -> "_"
+ | Some n -> n) ;
+ P.Mo [] ":=" ;
+ proof2pres term2pres p]
+ ) context @
+ [ P.Mo [] "|-" ] @
+ [ P.Mi [] (string_of_int n) ;
+ P.Mo [] ":" ;
+ term2pres ty ]
+ ))
+ ]
+ ) metasenv'
+ ))]]
+ ) @
+ [P.Mtr []
+ [P.Mtd []
+ (P.Mrow []
+ [proof2pres term2pres p])]])
+ | _ -> raise ToDo
+;;
+let content2pres ~ids_to_inner_sorts =
+ content2pres
+ (function p ->
+ (Cexpr2pres.cexpr2pres_charcount
+ (Content_expressions.acic2cexpr ids_to_inner_sorts p)))
+;;