]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/grafiteAstPp.ml
incomplete snapshot ....
[helm.git] / helm / ocaml / cic_notation / grafiteAstPp.ml
index 6af1efd714406afea6c87e2bf0d37af966b402ae..6a8e79bc10722535c8dff3df30ab016144ace9fe 100644 (file)
@@ -27,6 +27,8 @@ open Printf
 
 open GrafiteAst
 
+module Ast = CicNotationPt
+
 let tactical_terminator = "."
 let tactic_terminator = tactical_terminator
 let command_terminator = tactical_terminator
@@ -39,10 +41,12 @@ 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
+  | `Normalize -> "normalize"
   | `Reduce -> "reduce"
   | `Simpl -> "simplify"
+  | `Unfold (Some t) -> "unfold " ^ pp_term_ast t
+  | `Unfold None -> "unfold"
   | `Whd -> "whd"
-  | `Normalize -> "normalize"
  
   
 let pp_pattern (t, hyp, goal) = 
@@ -237,7 +241,7 @@ let pp_obj = function
     pp_fields fields ^ "}"
 
 let pp_argument_pattern = function
-  | CicNotationPt.IdentArg (eta_depth, name) ->
+  | Ast.IdentArg (eta_depth, name) ->
       let eta_buf = Buffer.create 5 in
       for i = 1 to eta_depth do
         Buffer.add_string eta_buf "\\eta."
@@ -245,10 +249,10 @@ let pp_argument_pattern = function
       sprintf "%s%s" (Buffer.contents eta_buf) name
 
 let rec pp_cic_appl_pattern = function
-  | CicNotationPt.UriPattern uri -> UriManager.string_of_uri uri
-  | CicNotationPt.VarPattern name -> name
-  | CicNotationPt.ImplicitPattern -> "_"
-  | CicNotationPt.ApplPattern aps ->
+  | Ast.UriPattern uri -> UriManager.string_of_uri uri
+  | Ast.VarPattern name -> name
+  | Ast.ImplicitPattern -> "_"
+  | Ast.ApplPattern aps ->
       sprintf "(%s)" (String.concat " " (List.map pp_cic_appl_pattern aps))
 
 let pp_l1_pattern = CicNotationPp.pp_term
@@ -261,6 +265,11 @@ let pp_associativity = function
 
 let pp_precedence i = sprintf "with precedence %d" i
 
+let pp_dir_opt = function
+  | None -> ""
+  | Some `LeftToRight -> "> "
+  | Some `RightToLeft -> "< "
+
 let pp_command = function
   | Include (_,path) -> "include " ^ path
   | Qed _ -> "qed"
@@ -277,8 +286,9 @@ let pp_command = function
         dsc symbol
         (String.concat " " (List.map pp_argument_pattern arg_patterns))
         (pp_cic_appl_pattern cic_appl_pattern)
-  | Notation (_, l1_pattern, assoc, prec, l2_pattern) ->
-      sprintf "notation \"%s\" %s %s for %s"
+  | Notation (_, dir_opt, l1_pattern, assoc, prec, l2_pattern) ->
+      sprintf "notation %s\"%s\" %s %s for %s"
+        (pp_dir_opt dir_opt)
         (pp_l1_pattern l1_pattern)
         (pp_associativity assoc)
         (pp_precedence prec)
@@ -331,3 +341,8 @@ let pp_cic_command = function
   | Notation _
   | Obj _ -> assert false (* not implemented *)
 
+let pp_dependency = function
+  | IncludeDep str -> "include \"" ^ str ^ "\""
+  | BaseuriDep str -> "set \"baseuri\" \"" ^ str ^ "\""
+  | UriDep uri -> "uri \"" ^ UriManager.string_of_uri uri ^ "\""
+