- "(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) ^ "]"
- | C.Appl l -> "("^String.concat " " (List.map (aux ctx) l) ^")"
- | C.Implicit _ -> "?"
- | C.Meta (n,_) -> "?"^string_of_int n
- | C.Sort C.Prop -> "Prop"
- | C.Sort C.CProp -> "CProp"
- | C.Sort (C.Type n) -> "Type"^string_of_int n
+ if not toplevel then F.fprintf f "(";
+ F.fprintf f "@[<hov 1>";
+ F.fprintf f "let %s:@;" name;
+ aux ~toplevel:true ctx ty;
+ F.fprintf f "@;≝ ";
+ aux ~toplevel:true ctx t;
+ F.fprintf f "@;in@;";
+ (aux ~toplevel:true (name::ctx) b);
+ F.fprintf f "@]";
+ if not toplevel then F.fprintf f ")";
+ | C.Match (r,oty,t,pl) ->
+ F.fprintf f "@[<hov>match ";
+ aux ~toplevel:true ctx t;
+ F.fprintf f "@;return ";
+ aux ~toplevel:true ctx oty;
+ F.fprintf f "@; @[<v>[ ";
+ if pl <> [] then
+ begin
+ F.fprintf f "@[<hov 2>%s ⇒@;"
+ (try r2s inside_fix (R.mk_constructor 1 r)
+ with R.IllFormedReference _ -> "#ERROR#");
+ aux ~toplevel:true ctx (List.hd pl);
+ F.fprintf f "@]";
+ ignore(List.fold_left
+ (fun i t ->
+ F.fprintf f "@;| @[<hov 2>%s ⇒@;"
+ (try r2s inside_fix (R.mk_constructor i r)
+ with R.IllFormedReference _ -> "#ERROR#");
+ aux ~toplevel:true ctx t;
+ F.fprintf f "@]";
+ i+1)
+ 2 (List.tl pl));
+ end;
+ F.fprintf f "]@] @]";
+ | C.Appl l ->
+ F.fprintf f "@[<hov 2>";
+ if not toplevel then F.fprintf f "(";
+ aux ctx (List.hd l);
+ List.iter (fun x -> F.fprintf f "@;";aux ctx x) (List.tl l);
+ if not toplevel then F.fprintf f ")";
+ F.fprintf f "@]"
+ | C.Implicit annot ->
+ F.fprintf f "?%s" (string_of_implicit_annotation annot)
+ | C.Meta (n,lc) when List.mem_assoc n subst ->
+ let _,_,t,_ = List.assoc n subst in
+ aux ctx (NCicSubstitution.subst_meta lc t)
+ | C.Meta (n,(shift,C.Irl len)) ->
+ F.fprintf f "?%d(%d,%d)" n shift len
+ | C.Meta (n,(shift,C.Ctx l)) ->
+ F.fprintf f "?%d(%d,[" n shift;
+ if List.length l > 0 then
+ begin
+ aux ctx (NCicSubstitution.lift shift (List.hd l));
+ List.iter (fun x -> F.fprintf f ",";aux ctx x)
+ (List.map (NCicSubstitution.lift shift) (List.tl l));
+ end;
+ F.fprintf f "])"
+ | C.Sort C.Prop -> F.fprintf f "Prop"
+ | C.Sort (C.Type []) -> F.fprintf f "Type0"
+ | C.Sort (C.Type [false, u]) -> F.fprintf f "%s" (NUri.name_of_uri u)
+ | C.Sort (C.Type [true, u]) -> F.fprintf f "S(%s)" (NUri.name_of_uri u)
+ | C.Sort (C.Type l) ->
+ F.fprintf f "Max(";
+ aux ctx (C.Sort (C.Type [List.hd l]));
+ List.iter (fun x -> F.fprintf f ",";aux ctx (C.Sort (C.Type [x])))
+ (List.tl l);
+ F.fprintf f ")"