]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_kernel/nCicPp.ml
today it seems that the substituted should be lifted by k-1+lift_args and not k+lift_...
[helm.git] / helm / software / components / ng_kernel / nCicPp.ml
index 27c7fc97ef837fc06275a3b4060d6e9eeb43fb5e..7af5d17a6f6e1e7a950184575784601ca0a700c6 100644 (file)
@@ -14,16 +14,17 @@ module R = NReference
 let trivial_pp_term ~context ~subst ~metasenv = 
   let rec aux ctx = function
    | C.Rel m ->
-       (try List.nth ctx m
-       with Not_found -> " -" ^ string_of_int (m - List.length context))
+       (try List.nth ctx (m-1)
+       with Failure _ -> " -" ^ string_of_int (m - List.length context))
    | C.Const r -> R.string_of_reference r
-   | C.Prod (name,s,t) -> " \Pi "^name^":"^aux ctx s^"."^aux (name::ctx) t
-   | C.Lambda (name,s,t) -> " \lambda "^name^":"^aux ctx s^"."^aux (name::ctx) t
+   | C.Prod (name,s,t) -> "(\Pi "^name^":"^aux ctx s^"."^aux (name::ctx) t^")"
+   | C.Lambda (name,s,t) -> 
+      "(\lambda "^name^":"^aux ctx s^"."^aux (name::ctx) t^")"
    | C.LetIn (name,ty,t,b) -> 
-        " let "^name^":"^aux ctx ty^":="^aux ctx t^" in "^aux (name::ctx) b
+      "(let "^name^":"^aux ctx ty^":="^aux ctx t^" in "^aux (name::ctx) b^")"
    | C.Match (_,oty,t,pl) ->
-        " match " ^ aux ctx t ^ " return " ^ aux ctx oty ^ "[" ^
-        String.concat "|" (List.map (aux ctx) pl) ^ "]"
+      " match " ^ aux ctx t ^ " return " ^ aux ctx oty ^ "[" ^
+      String.concat "|" (List.map (aux ctx) pl) ^ "]"
    | C.Appl l -> "("^String.concat " " (List.map (aux ctx) l) ^")"
    | C.Implicit _ -> "?"
    | C.Meta (n,_) -> "?"^string_of_int n
@@ -32,4 +33,17 @@ let trivial_pp_term ~context ~subst ~metasenv =
    | C.Sort (C.Type n) -> "Type"^string_of_int n
   in 
    aux (List.map fst context)
+;;
+
+let ppobj = function
+  | (u,_,_,_,NCic.Fixpoint (b, fl, _)) -> 
+       "let rec "^NUri.string_of_uri u^"\n"^
+       String.concat "\nand "
+        (List.map (fun (_,name,n,ty,bo) ->
+          name ^ " on " ^ string_of_int n ^ " : " ^ ppterm ty ^ " :=\n"^
+          ppterm bo) fl)
+  | _ -> "todo"
+;;
+
+