let print_problem label ({freshno; div; conv; ps; deltas} as p) =
Console.print_hline ();
- prerr_endline ("\n||||| Displaying problem: " ^ label ^ " |||||");
- let nl = "\n| " in
- let deltas = String.concat nl (List.map (fun r -> String.concat " <> " (List.map (fun (i,_) -> string_of_int i) !r)) deltas) in
+ prerr_string ("\n(* DISPLAY PROBLEM (" ^ label ^ ") - ");
+ let nl = "\n" in
+ let deltas = String.concat (nl^" ") (List.map (fun r -> String.concat " <> " (List.map (fun (i,_) -> string_of_int i) !r)) deltas) in
let l = Array.to_list (Array.init (freshno + 1) string_of_var) in
- nl ^ "measure="^string_of_measure(problem_measure p)^" freshno = " ^ string_of_int freshno
- ^ nl ^ "\b> DISCRIMINATING SETS (deltas)"
- ^ nl ^ deltas ^ (if deltas = "" then "" else nl)
- ^ "\b> DIVERGENT" ^ nl
- ^ "*: " ^ (match div with None -> "*" | Some div -> print ~l (div :> nf)) ^ "\n| "
- ^ "\b> CONVERGENT" ^ nl
- ^ String.concat "\n| " (List.map (fun t -> "_: " ^ (if t = `N (-1) then "_" else print ~l (t :> nf))) conv) ^
- (if conv = [] then "" else "\n| ")
- ^ "\b> NUMERIC" ^ nl
- ^ String.concat "\n| " (List.mapi (fun i t -> string_of_int i ^ ": " ^ print ~l (t :> nf)) ps)
- ^ nl
+ "measure="^string_of_measure(problem_measure p) (* ^ " freshno = " ^ string_of_int freshno*)
+ ^ nl ^ " Discriminating sets (deltas):"
+ ^ nl ^ " " ^ deltas ^ (if deltas = " " then "" else nl) ^ "*)" ^ nl
+ ^" (* DIVERGENT *)" ^ nl
+ ^" "^ (match div with None -> "None" | Some div -> "(Some\""^ print ~l (div :> nf) ^"\" ") ^ nl
+ ^" (* CONVERGENT *) [" ^ nl
+ ^ String.concat "\n " (List.map (fun t -> "(* _: *) " ^ (if t = `N (-1) then "" else "\""^ print ~l (t :> nf) ^"\";")) conv) ^
+ (if conv = [] then "" else nl)
+ ^ "] (* NUMERIC *) [" ^ nl ^ " "
+ ^ String.concat "\n " (List.mapi (fun i t -> " (* "^ string_of_int i ^" *) \"" ^ print ~l (t :> nf) ^ "\";") ps)
+ ^ nl ^ "] [\"*\"];;" ^ nl
;;
open Util.Vars
open Pure
+(* debug options *)
+let debug_display_arities = false;;
+
(************ Syntax ************************************)
(* Normal forms*)
| #nf as t -> string_of_term_w_pars l t
and string_of_term_no_pars_lam l = function
| `Lam(_,t) -> let name = string_of_var (List.length l) in
- "λ" ^ name ^ ". " ^ (string_of_term_no_pars_lam (name::l) t)
+ "λ" ^ name ^ ". " ^ (string_of_term_no_pars_lam (name::l) t)
| _ as t -> string_of_term_no_pars l t
and string_of_term_no_pars l : nf -> string = function
| `Lam _ as t -> string_of_term_no_pars_lam l t