]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/tacticAstPp.ml
added records pp, ast and fixed a bug in match with only one branch
[helm.git] / helm / ocaml / cic_transformations / tacticAstPp.ml
index 822618eb4a18d0c70616086f287ccb21d4f438fb..a5c0478acc65b9e2b24e6ef3f795285b5c05be63 100644 (file)
@@ -42,7 +42,7 @@ let pp_reduction_kind = function
   | `Simpl -> "simplify"
   | `Whd -> "whd"
   | `Normalize -> "normalize"
-
+  
 let rec pp_tactic = function
   | Absurd (_, term) -> "absurd" ^ pp_term_ast term
   | Apply (_, term) -> "apply " ^ pp_term_ast term
@@ -149,19 +149,24 @@ let pp_alias = function
   | Number_alias (instance,desc) ->
       sprintf "alias num (instance %d) = \"%s\"" instance desc
   
+let pp_params = function
+  | [] -> ""
+  | params ->
+      " " ^
+      String.concat " "
+        (List.map
+          (fun (name, typ) -> sprintf "(%s:%s)" name (pp_term_ast typ))
+          params)
+      
+let pp_fields fields =
+  (if fields <> [] then "\n" else "") ^ 
+  String.concat ";\n" 
+    (List.map (fun (name,ty) -> " " ^ name ^ ": " ^ pp_term_ast ty) fields)
+        
 let pp_command = function
   | Qed _ -> "qed"
   | Set (_, name, value) -> sprintf "Set \"%s\" \"%s\"" name value
   | Inductive (_, params, types) ->
-      let pp_params = function
-        | [] -> ""
-        | params ->
-            " " ^
-            String.concat " "
-              (List.map
-                (fun (name, typ) -> sprintf "(%s:%s)" name (pp_term_ast typ))
-                params)
-      in
       let pp_constructors constructors =
         String.concat "\n"
           (List.map (fun (name, typ) -> sprintf "| %s: %s" name (pp_term_ast typ))
@@ -190,6 +195,10 @@ let pp_command = function
         | Some body -> "\\def " ^ pp_term_ast body)
   | Coercion (_,_) -> "Coercion IMPLEMENT ME!!!!!"
   | Alias (_,s) -> pp_alias s
+  | Record (_,params,name,ty,fields) ->
+      "record " ^ name ^ " " ^ pp_params params ^ " \\def {" ^
+      pp_fields fields ^ "}"
+      
 
 let rec pp_tactical = function
   | Tactic (_, tac) -> pp_tactic tac