]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/tacticAstPp.ml
Improvements in matitatop: instead of doing exit -1 it enters the toploop
[helm.git] / helm / ocaml / cic_transformations / tacticAstPp.ml
index 33b5e8ade73c04e40d161f74f8fb4c72b66f9dd4..86c7185ecf1308d75e1f34707059c1cc77f3fc1f 100644 (file)
@@ -37,6 +37,8 @@ let pp_term_cic term = CicPp.ppterm term
 
 let pp_idents idents = "[" ^ String.concat "; " idents ^ "]"
 
+let pp_terms_ast terms = String.concat ", " (List.map pp_term_ast terms)
+
 let pp_reduction_kind = function
   | `Reduce -> "reduce"
   | `Simpl -> "simplify"
@@ -80,8 +82,12 @@ let rec pp_tactic = function
   | ElimType (_, term) -> "elim type " ^ pp_term_ast term
   | Exact (_, term) -> "exact " ^ pp_term_ast term
   | Exists _ -> "exists"
-  | Fold (_, kind, pattern) ->
-      sprintf "fold %s %s" (pp_reduction_kind kind) (pp_pattern pattern)
+  | Fold (_, kind, term, pattern) ->
+      sprintf "fold %s %s %s" (pp_reduction_kind kind)
+       (pp_term_ast term) (pp_pattern pattern)
+  | FwdSimpl (_, hyp, idents) -> 
+      sprintf "fwd %s%s" hyp 
+        (match idents with [] -> "" | idents -> " " ^ pp_idents idents)
   | Generalize (_, pattern, ident) ->
      sprintf "generalize %s%s" (pp_pattern pattern)
       (match ident with None -> "" | Some id -> " as " ^ id)
@@ -95,6 +101,12 @@ let rec pp_tactic = function
       sprintf "intros%s%s"
         (match num with None -> "" | Some num -> " " ^ string_of_int num)
         (match idents with [] -> "" | idents -> " " ^ pp_idents idents)
+  | LApply (_, level_opt, terms, term, ident_opt) -> 
+      sprintf "lapply %s%s%s%s" 
+        (match level_opt with None -> "" | Some i -> " depth = " ^ string_of_int i ^ " ")  
+        (pp_term_ast term) 
+        (match terms with [] -> "" | _ -> " to " ^ pp_terms_ast terms)
+        (match ident_opt with None -> "" | Some ident -> " using " ^ ident)
   | Left _ -> "left"
   | LetIn (_, term, ident) -> sprintf "let %s in %s" (pp_term_ast term) ident
   | Reduce (_, kind, pat) ->
@@ -104,18 +116,14 @@ let rec pp_tactic = function
       sprintf "replace %s with %s" (pp_pattern pattern) (pp_term_ast t)
   | Rewrite (_, pos, t, pattern) -> 
       sprintf "rewrite %s %s %s" 
-        (if pos = `Left then "left" else "right") (pp_term_ast t)
+        (if pos = `LeftToRight then ">" else "<")
+        (pp_term_ast t)
         (pp_pattern pattern)
   | Right _ -> "right"
   | Ring _ -> "ring"
   | Split _ -> "split"
   | Symmetry _ -> "symmetry"
   | Transitivity (_, term) -> "transitivity " ^ pp_term_ast term
-  | FwdSimpl (_, term) -> sprintf "fwd %s" (pp_term_ast term)
-  | LApply (_, term_opt, term, ident) -> 
-      sprintf "lapply %s%s%s" (pp_term_ast term) 
-        (match term_opt with None -> "" | Some t -> " to " ^ pp_term_ast t)
-        (match ident with None -> "" | Some id -> " using " ^ id)
 
 let pp_flavour = function
   | `Definition -> "Definition"