]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/components/content/notationPp.ml
exportation of lambdadelta 1 with flavoured let recs
[helm.git] / matita / components / content / notationPp.ml
index d19bce283749a94017a4ac12672c80a1945c3cfc..369a0fa281ac05e610f56d130b8cd477b4755724 100644 (file)
@@ -275,8 +275,13 @@ let pp_fields pp_term fields =
       pp_term ty)
     fields)
 
+let string_of_source = function
+   | `Provided  -> ""
+   | `Implied   -> "implied "
+   | `Generated -> "generated "
+
 let pp_obj pp_term = function
- | Ast.Inductive (params, types) ->
+ | Ast.Inductive (params, types, source) ->
     let pp_constructors constructors =
       String.concat "\n"
         (List.map (fun (name, typ) -> sprintf "| %s: %s" name (pp_term typ))
@@ -290,23 +295,26 @@ let pp_obj pp_term = function
     | [] -> assert false
     | (name, inductive, typ, constructors) :: tl ->
         let fst_typ_pp =
-          sprintf "%sinductive %s%s: %s \\def\n%s"
+          sprintf "%s%sinductive %s%s: %s \\def\n%s"
+            (string_of_source source)
             (if inductive then "" else "co") name (pp_params pp_term params)
             (pp_term typ) (pp_constructors constructors)
         in
         fst_typ_pp ^ String.concat "" (List.map pp_type tl))
- | Ast.Theorem (name, typ, body,(_,flavour,_)) ->
-    sprintf "%s %s:\n %s\n%s"
+ | Ast.Theorem (name, typ, body,(source, flavour, _)) ->
+    sprintf "%s%s %s:\n %s\n%s"
+      (string_of_source source)
       (NCicPp.string_of_flavour flavour)
       name
       (pp_term typ)
       (match body with
       | None -> ""
       | Some body -> "\\def\n " ^ pp_term body)
- | Ast.Record (params,name,ty,fields) ->
+ | Ast.Record (params,name,ty,fields, source) ->
+    string_of_source source ^
     "record " ^ name ^ " " ^ pp_params pp_term params ^ ": " ^ pp_term ty ^ 
     " \\def {" ^ pp_fields pp_term fields ^ "\n}"
- | Ast.LetRec (kind, definitions, _) ->
+ | Ast.LetRec (kind, definitions, (source, flavour, _)) ->
     let rec get_guard i = function
        | []                   -> assert false (* Ast.Implicit `JustOne *)
        | [term, _] when i = 1 -> term
@@ -324,8 +332,10 @@ let pp_obj pp_term = function
          (pp_term (get_guard i params))
          (pp_term typ) (pp_term body)
     in
-    sprintf "let %s %s"
+    sprintf "%s%s %s %s"
+      (string_of_source source)
       (match kind with `Inductive -> "rec" | `CoInductive -> "corec")
+      (NCicPp.string_of_flavour flavour)
       (String.concat " and " (List.map map definitions))
 
 let rec pp_value (status: #NCic.status) = function