X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fbinaries%2Fmatex%2Fengine.ml;h=324d114a949302b28788952074f9962714b80871;hb=eeeaecfafd5ddffa54a41356104fbc60369e5d73;hp=2fffd264ce1e416d1b1f324ea3ccf7fa0e2b21f8;hpb=c992745a40b4ac8b6c5285bf9c5eff26c423f236;p=helm.git diff --git a/matita/components/binaries/matex/engine.ml b/matita/components/binaries/matex/engine.ml index 2fffd264c..324d114a9 100644 --- a/matita/components/binaries/matex/engine.ml +++ b/matita/components/binaries/matex/engine.ml @@ -26,6 +26,7 @@ module K = Kernel module T = TeX module O = TeXOutput module A = Anticipate +module M = Meta module N = Alpha type status = { @@ -43,8 +44,8 @@ let internal s = let malformed s = X.error ("engine: malformed term: " ^ s) -let missing s = - X.log ("engine: missing macro for " ^ s) +let missing s l = + X.log (P.sprintf "engine: missing macro for %s (%u)" s l) (* generic term processing *) @@ -63,7 +64,9 @@ let mk_ptr st name = let get_macro s l = let rec aux = function - | [] -> "", 0 + | [] -> + if !G.log_missing then missing s l; + "", 0 | (r, m, a, x) :: _ when r = s && a = l -> m, x | _ :: tl -> aux tl in @@ -72,13 +75,14 @@ let get_macro s l = let get_head = function | C.Const c :: ts -> let s, _ = K.resolve_reference c in - let macro, x = get_macro s (L.length ts) in - if macro <> "" then - let ts1, ts2 = X.split_at x ts in - Some (macro, s, ts1, ts2) - else begin - if !G.log_missing then missing s; - None + let l = L.length ts in + let macro, x = get_macro s l in + begin match macro with + | "" + | "APPL" -> None + | _ -> + let ts1, ts2 = X.split_at x ts in + Some (macro, s, ts1, ts2) end | _ -> None @@ -128,7 +132,11 @@ let rec proc_term st is = function proc_sort st is s | C.Const c -> let s, name = K.resolve_reference c in - T.Macro "GREF" :: T.arg (mk_gname name) :: T.free s :: is + let macro, _ = get_macro s 0 in + if macro = "" || macro = "APPL" then + T.Macro "GREF" :: T.arg (mk_gname name) :: T.free s :: is + else + T.Macro macro :: T.free s :: is | C.Match (w, u, v, ts) -> let is_w = proc_term st [] (C.Const w) in let is_u = proc_term st [] u in @@ -243,6 +251,7 @@ let proc_item item s ss t = note :: T.Macro "begin" :: T.arg item :: T.arg (mk_gname s) :: T.free ss :: proc_term st is tt let proc_top_proof s ss t = + if !G.no_proofs then [] else let st = init ss in let t0 = A.process_top_term s t in (* anticipation *) let tt = N.process_top_term s t0 in (* alpha-conversion *) @@ -258,10 +267,14 @@ let open_out_tex s = open_out (F.concat !G.out_dir fname) let proc_pair s ss u = function - | None -> + | None -> + let text_u = + if K.not_prop1 [] u then proc_item "assumption" + else proc_item "axiom" + in let name = X.rev_map_concat X.id "." "type" ss in let och = open_out_tex name in - O.out_text och (proc_item "axiom" s name u); + O.out_text och (text_u s name u); close_out och | Some t -> let text_u, text_t =