2 ref (fun ~context ~subst ~metasenv t -> "Please, set a pp callback")
5 let set_ppterm f = ppterm := f;;
7 let ppterm ?(context=[]) ?(subst=[]) ?(metasenv=[]) t =
8 !ppterm ~context ~subst ~metasenv t
14 let trivial_pp_term ~context ~subst ~metasenv =
15 let rec aux ctx = function
17 (try List.nth ctx (m-1)
18 with Failure _ -> " -" ^ string_of_int (m - List.length context))
19 | C.Const r -> R.string_of_reference r
20 | C.Prod (name,s,t) -> "(\Pi "^name^":"^aux ctx s^"."^aux (name::ctx) t^")"
21 | C.Lambda (name,s,t) ->
22 "(\lambda "^name^":"^aux ctx s^"."^aux (name::ctx) t^")"
23 | C.LetIn (name,ty,t,b) ->
24 "(let "^name^":"^aux ctx ty^":="^aux ctx t^" in "^aux (name::ctx) b^")"
25 | C.Match (_,oty,t,pl) ->
26 " match " ^ aux ctx t ^ " return " ^ aux ctx oty ^ "[" ^
27 String.concat "|" (List.map (aux ctx) pl) ^ "]"
28 | C.Appl l -> "("^String.concat " " (List.map (aux ctx) l) ^")"
30 | C.Meta (n,_) -> "?"^string_of_int n
31 | C.Sort C.Prop -> "Prop"
32 | C.Sort C.CProp -> "CProp"
33 | C.Sort (C.Type n) -> "Type"^string_of_int n
35 aux (List.map fst context)
39 | (u,_,_,_,NCic.Fixpoint (b, fl, _)) ->
40 "let rec "^NUri.string_of_uri u^"\n"^
41 String.concat "\nand "
42 (List.map (fun (_,name,n,ty,bo) ->
43 name ^ " on " ^ string_of_int n ^ " : " ^ ppterm ty ^ " :=\n"^