X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fgrafite%2FgrafiteAstPp.ml;h=a4a5788d9fbb4c1a637cb95259f5f4618137c5dc;hb=489639a3c319d0349a9c864fd0eeaf659daa3d3f;hp=c4eacfb5a36d18940f4b04050339e0ffe8e4a484;hpb=f8392f63fab2a0b901f83cbf8c23e7b3c1dbd6ce;p=helm.git diff --git a/matita/components/grafite/grafiteAstPp.ml b/matita/components/grafite/grafiteAstPp.ml index c4eacfb5a..a4a5788d9 100644 --- a/matita/components/grafite/grafiteAstPp.ml +++ b/matita/components/grafite/grafiteAstPp.ml @@ -51,6 +51,19 @@ let pp_tactic_pattern status ~map_unicode_to_tex (what, hyp, goal) = in Printf.sprintf "%sin %s%s" what_text hyp_text goal_text +let pp_auto_params params status = + match params with + | (None,flags) -> String.concat " " (List.map (fun a,b -> a ^ "=" ^ b) flags) + | (Some l,flags) -> (String.concat "," (List.map (NotationPp.pp_term status) l)) ^ + String.concat " " (List.map (fun a,b -> a ^ "=" ^ b) flags) +;; + +let pp_just status just = + match just with + `Term term -> "exact " ^ NotationPp.pp_term status term + | `Auto params -> pp_auto_params params status +;; + let rec pp_ntactic status ~map_unicode_to_tex = let pp_tactic_pattern = pp_tactic_pattern ~map_unicode_to_tex in function @@ -83,7 +96,7 @@ let rec pp_ntactic status ~map_unicode_to_tex = | NIntro (_,n) -> "#" ^ n | NIntros (_,l) -> "#" ^ String.concat " " l | NInversion (_,what,where) -> "ninversion " ^ NotationPp.pp_term status what ^ - assert false ^ " " ^ assert false + "...to be implemented..." ^ " " ^ "...to be implemented..." | NLApply (_,t) -> "lapply " ^ NotationPp.pp_term status t | NRewrite (_,dir,n,where) -> "nrewrite " ^ (match dir with `LeftToRight -> ">" | `RightToLeft -> "<") ^ @@ -107,6 +120,59 @@ let rec pp_ntactic status ~map_unicode_to_tex = | NBlock (_,l) -> "(" ^ String.concat " " (List.map (pp_ntactic status ~map_unicode_to_tex) l)^ ")" | NRepeat (_,t) -> "nrepeat " ^ pp_ntactic status ~map_unicode_to_tex t + | Assume (_, ident, term, term1) -> "assume" ^ ident ^ ":" ^ NotationPp.pp_term status term ^ + (match term1 with None -> " " | Some t1 -> " that is eqivalent to " ^ NotationPp.pp_term status t1) + | Suppose (_,term,ident,term1) -> "suppose" ^ NotationPp.pp_term status term ^ "(" ^ ident ^ ")" ^ (match + term1 with None -> " " | Some t -> " that is equivalent to " ^ NotationPp.pp_term status t) + | By_just_we_proved (_, just, term1, ident, term2) -> pp_just status just ^ "we proved" ^ + NotationPp.pp_term status term1 ^ (match ident with None -> "" | Some ident -> "(" ^ident^ ")") ^ (match + term2 with None -> " " | Some term2 -> " that is equivalent to " ^ NotationPp.pp_term status term2) + | We_need_to_prove (_,term,ident,term1) -> "we need to prove" ^ NotationPp.pp_term status term ^ + (match ident with None -> " " | Some id -> "(" ^ id ^ ")") ^ (match term1 with None -> " " | Some t1 + -> "or equivalently" ^ NotationPp.pp_term status t1) + | Bydone (_, just) -> pp_just status just ^ "done" + | ExistsElim (_, just, ident, term, term1, ident1) -> pp_just status just ^ "let " ^ ident ^ ":" + ^ NotationPp.pp_term status term ^ "such that " ^ NotationPp.pp_term status term1 ^ "(" ^ ident1 ^ ")" + | AndElim (_, just, term1, ident1, term2, ident2) -> pp_just status just ^ "we have " ^ + NotationPp.pp_term status term1 ^ " (" ^ ident1 ^ ") " ^ "and " ^ NotationPp.pp_term status term2 + ^ " (" ^ ident2 ^ ")" + | Thesisbecomes (_, term1, term2) -> "the thesis becomes " ^ NotationPp.pp_term status term1 ^ (match + term2 with None -> " " | Some term2 -> NotationPp.pp_term status term2) + | RewritingStep (_, rhs, just, cont) -> + "=" ^ + NotationPp.pp_term status rhs ^ + (match just with + | `Auto params -> pp_auto_params params status + | `Term t -> " exact " ^ NotationPp.pp_term status t + | `Proof -> " proof" + | `SolveWith t -> " using " ^ NotationPp.pp_term status t) + ^ (if cont then " done" else "") +(* + | RewritingStep (_, term, term1, term2, cont) -> + (match term with + | None -> " " + | Some (None,term) -> "conclude " ^ NotationPp.pp_term status term + | Some (Some name,term) -> + "obtain (" ^ name ^ ") " ^ NotationPp.pp_term status term) + ^ "=" ^ + NotationPp.pp_term status term1 ^ + (match term2 with + | `Auto params -> pp_auto_params params status + | `Term term2 -> " exact " ^ NotationPp.pp_term status term2 + | `Proof -> " proof" + | `SolveWith term -> " using " ^ NotationPp.pp_term status term) + ^ (if cont then " done" else "") +*) + | Obtain (_,id,t1) -> "obtain (" ^ id ^ ")" ^ NotationPp.pp_term status t1 + | Conclude (_,t1) -> "conclude " ^ NotationPp.pp_term status t1 + | We_proceed_by_cases_on (_, term, term1) -> "we proceed by cases on" ^ NotationPp.pp_term status term ^ "to prove" ^ NotationPp.pp_term status term1 + | We_proceed_by_induction_on (_, term, term1) -> "we proceed by induction on" ^ NotationPp.pp_term status term ^ "to prove" ^ NotationPp.pp_term status term1 + | Byinduction (_, term, ident) -> "by induction hypothesis we know" ^ NotationPp.pp_term status term ^ "(" ^ ident ^ ")" + | Case (_, id, args) -> + "case" ^ id ^ + String.concat " " + (List.map (function (id,term) -> "(" ^ id ^ ": " ^ NotationPp.pp_term status term ^ ")") + args) ;; let pp_nmacro status = function @@ -168,8 +234,11 @@ let pp_ncommand status = function | NInverter (_,_,_,_,_) | NUnivConstraint (_) -> "not supported" | NCoercion (_) -> "not supported" - | NObj (_,obj) -> NotationPp.pp_obj (NotationPp.pp_term status) obj - | NQed (_) -> "qed" + | NObj (_,obj,index) -> + (if not index then "-" else "") ^ + NotationPp.pp_obj (NotationPp.pp_term status) obj + | NQed (_,true) -> "qed" + | NQed (_,false) -> "qed-" | NCopy (_,name,uri,map) -> "copy " ^ name ^ " from " ^ NUri.string_of_uri uri ^ " with " ^ String.concat " and "