]> matita.cs.unibo.it Git - fireball-separation.git/commitdiff
New FASTER! SIMPLER! algorithm
authoracondolu <andrea.condoluci@unibo.it>
Wed, 26 Jul 2017 09:07:15 +0000 (11:07 +0200)
committeracondolu <andrea.condoluci@unibo.it>
Tue, 29 May 2018 14:41:08 +0000 (16:41 +0200)
- Works without bombs and pacmans
- No metrics

62 files changed:
ocaml/Makefile [deleted file]
ocaml/andrea3.mli [deleted file]
ocaml/andrea4'.ml [deleted file]
ocaml/andrea4.ml [deleted file]
ocaml/andrea6.ml [deleted file]
ocaml/andrea7.ml [deleted file]
ocaml/andrea8.ml [deleted file]
ocaml/console.ml [deleted file]
ocaml/console.mli [deleted file]
ocaml/lambda4.ml [deleted file]
ocaml/lambda4.mli [deleted file]
ocaml/listx.ml [deleted file]
ocaml/listx.mli [deleted file]
ocaml/logs/fail.txt [deleted file]
ocaml/measure.ml [deleted file]
ocaml/num.ml [deleted file]
ocaml/num.mli [deleted file]
ocaml/num.mli.ar [deleted file]
ocaml/parser.ml [deleted file]
ocaml/parser.mli [deleted file]
ocaml/problems.ml [deleted file]
ocaml/problems.mli [deleted file]
ocaml/problems/3col [deleted file]
ocaml/problems/bugs [deleted file]
ocaml/problems/m [deleted file]
ocaml/problems/n [deleted file]
ocaml/problems/o [deleted file]
ocaml/problems/p [deleted file]
ocaml/problems/q [deleted file]
ocaml/problems/solved [deleted file]
ocaml/problems/w [deleted file]
ocaml/ptest.ml [deleted file]
ocaml/pure.ml [deleted file]
ocaml/pure.mli [deleted file]
ocaml/run [deleted file]
ocaml/sat.ml [deleted file]
ocaml/sat.mli [deleted file]
ocaml/test.ml [deleted file]
ocaml/tmp.ml [deleted file]
ocaml/util.ml [deleted file]
ocaml/util.mli [deleted file]
ocaml_new/.depend [new file with mode: 0644]
ocaml_new/Makefile [new file with mode: 0644]
ocaml_new/console.ml [new file with mode: 0644]
ocaml_new/console.mli [new file with mode: 0644]
ocaml_new/lambda4.ml [new file with mode: 0644]
ocaml_new/lambda4.mli [new file with mode: 0644]
ocaml_new/listx.ml [new file with mode: 0644]
ocaml_new/listx.mli [new file with mode: 0644]
ocaml_new/num.ml [new file with mode: 0644]
ocaml_new/num.mli [new file with mode: 0644]
ocaml_new/parser.ml [new file with mode: 0644]
ocaml_new/parser.mli [new file with mode: 0644]
ocaml_new/problems.ml [new file with mode: 0644]
ocaml_new/problems.mli [new file with mode: 0644]
ocaml_new/problems/1 [new file with mode: 0644]
ocaml_new/pure.ml [new file with mode: 0644]
ocaml_new/pure.mli [new file with mode: 0644]
ocaml_new/run [new file with mode: 0644]
ocaml_new/test.ml [new file with mode: 0644]
ocaml_new/util.ml [new file with mode: 0644]
ocaml_new/util.mli [new file with mode: 0644]

diff --git a/ocaml/Makefile b/ocaml/Makefile
deleted file mode 100644 (file)
index b662428..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-OCAMLC = ocamlopt -g -rectypes
-LIB = unix.cmxa str.cmxa
-UTILS = util.cmx console.cmx listx.cmx pure.cmx num.cmx parser.cmx
-
-all: a.out test4.out
-
-run: test4.out
-       bash run
-
-a.out: $(UTILS) lambda4.cmx problems.cmx
-       $(OCAMLC) -o a.out $(LIB) $^
-
-sat.out: $(UTILS) lambda4.cmx sat.ml
-       $(OCAMLC) -o sat.out $(LIB) $^
-#
-test4.out: $(UTILS) lambda4.cmx test.ml
-       $(OCAMLC) -o test4.out $(LIB) $^
-
-andrea.out: $(UTILS) andrea8.ml
-       $(OCAMLC) -o andrea.out $(LIB) $(UTILS) andrea8.ml
-
-%.cmi: %.mli
-       $(OCAMLC) -c $<
-
-%.cmx: %.ml %.cmi
-       $(OCAMLC) -c $<
-
-clean:
-       rm -f *.cm* *.out *.o .depend log
-
-.depend: *.ml *.mli
-       ocamldep *.ml *.mli > .depend
-
-include .depend
-
-.PHONY: clean all run
diff --git a/ocaml/andrea3.mli b/ocaml/andrea3.mli
deleted file mode 100644 (file)
index 8ec0c9f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-val do_everything: string list -> int\r
diff --git a/ocaml/andrea4'.ml b/ocaml/andrea4'.ml
deleted file mode 100644 (file)
index f734cca..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-type var = (* unique name *) int * (int * term) option * (*level*) int\r
-and term =\r
-  | Tvar of var\r
-  | Tapp of term * term\r
-  | Tlam of int * term\r
-;;\r
-\r
-let zero = Tvar 1010;;\r
-let dummy = Tvar 333;;\r
-\r
-\r
-(* mk_app & subst implementano la beta *)\r
-let rec mk_app t1 t2 = match t1 with\r
-  | Tlam(v, t1') -> subst v t2 t1'\r
-  | _ -> Tapp(t1, t2, false)\r
-and subst v tv =\r
-  let rec aux = function\r
-  | Tapp(t1, t2, _) -> mk_app (aux t1) (aux t2)\r
-  | Tvar v' as t -> if v = v' then tv else t\r
-  | Tlam(v', t') as t -> if v = v' then t else Tlam(v', aux t')\r
-  in aux\r
-;;\r
-\r
-(* PARSING AND PRINTING *)\r
-\r
-let parse =\r
-  let rec minus1 = function\r
-    | Tvar n -> Tvar (n-1)\r
-    | Tapp(t1, t2, b) -> Tapp(minus1 t1, minus1 t2, b)\r
-    | Tlam(n, t) -> Tlam(n-1, minus1 t)\r
-  (* in let open Parser *)\r
-  in let rec myterm_of_term = function\r
-    | Parser.Var n -> Tvar n\r
-    | Parser.App(t1, t2) -> (*Tapp(myterm_of_term t1, myterm_of_term t2) WARNING! BETA DOWN HERE! *)\r
-                            mk_app (myterm_of_term t1) (myterm_of_term t2)\r
-    | Parser.Lam(t) -> minus1 (Tlam(0, myterm_of_term t))\r
-  in fun strs -> (\r
-    let (tms, free) = Parser.parse_many strs\r
-    in List.map myterm_of_term tms\r
-    )\r
-;;\r
-\r
-(* PRETTY PRINTING *)\r
-open Console;;\r
-\r
-let fancy_of_term t =\r
-let rec string_of_term =\r
-  let free = ["a"; "b"; "c"; "d"; "e"; "f"; "g"] in\r
-  let bound = ["x"; "y"; "z"; "w"; "q"; "x1"; "x2"] in\r
-  let string_of_int' n = if n >= 0 then "free" ^ string_of_int n else "bound" ^ string_of_int n  in\r
-  let rec string_of_var t =\r
-    if Tvar t = dummy then "_" else if Tvar t = zero then "ZZ" else match t with\r
-    | n -> string_of_int' n\r
-  and string_of_term_w_pars = function\r
-    | Tvar v -> string_of_var v\r
-    | Tapp(t1, t2, _) -> "(" ^ (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2) ^ ")"\r
-    | Tlam(_,_) as t -> "(" ^ (string_of_term_no_pars_lam t) ^ ")"\r
-  and string_of_term_no_pars_app = function\r
-    | Tapp(t1, t2,_) -> (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2)\r
-    | _ as t -> string_of_term_w_pars t\r
-  and string_of_term_no_pars_lam = function\r
-    | Tlam(v, t) -> "λ" ^ (string_of_int' v) ^ ". " ^ (string_of_term_no_pars_lam t)\r
-    | _ as t -> string_of_term_no_pars t\r
-  and string_of_term_no_pars = function\r
-    | Tlam(_, _) as t -> string_of_term_no_pars_lam t\r
-    | _ as t -> string_of_term_no_pars_app t\r
-  in string_of_term_no_pars\r
-in let rec html_of_term =\r
-  let free = ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"] in\r
-  let bound = ["x"; "y"; "z"; "w"; "q"] in\r
-  let string_of_int' n = if n >= 0 then List.nth free (n) else List.nth bound (-n-1) in\r
-  let rec string_of_var t =\r
-    if Tvar t = dummy then "&num;" else if Tvar t = zero then "Z" else string_of_int' t\r
-  and string_of_term_w_pars = function\r
-    | Tvar v -> string_of_var v\r
-    | Tapp(t1, t2,_) -> "(" ^ (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2) ^ ")"\r
-    | Tlam(_,_) as t -> "(" ^ (string_of_term_no_pars_lam t) ^ ")"\r
-  and string_of_term_no_pars_app = function\r
-    | Tapp(t1, t2,_) -> (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2)\r
-    | _ as t -> string_of_term_w_pars t\r
-  and string_of_term_no_pars_lam = function\r
-    | Tlam(v, t) -> "&lambda;" ^ (string_of_int' v) ^ ". " ^ (string_of_term_no_pars_lam t)\r
-    | _ as t -> string_of_term_no_pars t\r
-  and string_of_term_no_pars = function\r
-    | Tlam(_, _) as t -> string_of_term_no_pars_lam t\r
-    | _ as t -> string_of_term_no_pars_app t\r
-  in string_of_term_no_pars\r
-in\r
-  string_of_term t / "html_of_term t"\r
-;;\r
-\r
-let fancy_of_nf t: Console.fancyobj =\r
-let rec print ?(l=[]) =\r
- function\r
-    `Var n -> Util.Vars.print_name l n\r
-  | `N n -> string_of_int n\r
-  | `Match(t,bs_lift,bs,args) ->\r
-     "([" ^ print ~l (t :> Num.nf) ^\r
-     " ? " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ print ~l (Num.lift bs_lift t)) !bs) ^ "] " ^\r
-     String.concat " " (List.map (print ~l) args) ^ ")"\r
-  | `I(n,args) -> "(" ^ Util.Vars.print_name l n ^ " " ^ String.concat " " (Listx.to_list (Listx.map (print ~l) args)) ^ ")"\r
-  | `Lam(_,nf) ->\r
-     let name = Util.Vars.string_of_var (List.length l) in\r
-     "" ^ name ^ "." ^ print ~l:(name::l) (nf : Num.nf)\r
-\r
-(* in let rec print_html ?(l=[]) =\r
- function\r
-    `Var n -> Lambda3.print_name l n\r
-  | `N n -> string_of_int n\r
-  | `Match(t,bs_lift,bs,args) ->\r
-     "(<b>match</b> " ^ print_html ~l (t :> Lambda3.nf) ^\r
-     " <b>with</b> " ^ String.concat " <b>|</b> " (List.map (fun (n,t) -> string_of_int n ^ " <b>&rArr;</b> " ^ print_html ~l (Lambda3.lift bs_lift t)) !bs) ^ "..." (* Attenzion non sto stampando gli argomenti applicati! Perche' non ce ne sono mai *)\r
-  | `I(n,args) -> "(" ^ Lambda3.print_name l n ^ " " ^ String.concat " " (Listx.to_list (Listx.map (print_html ~l) args)) ^ ")"\r
-  | `Lam nf ->\r
-     let name = Lambda3.string_of_var (List.length l) in\r
-     "&lambda;" ^ name ^ ". " ^ print_html ~l:(name::l) (nf : Lambda3.nf) *)\r
-in\r
-  print t / print t\r
-;;\r
-\r
-let print_term t = print_endline (fancy_of_term t :> Console.fancyobj);;\r
-(*  *)\r
-\r
-\r
-let varcount = ref 11;;\r
-\r
-let freshvar () = (\r
-  varcount := (!varcount + 1);\r
-  !varcount\r
-);;\r
-\r
-\r
-\r
-(* magic ["x (x x x)"; "x (y. y x)"; "x x (y. y y (x x y))"] ;; *)\r
-(* magic ["((x x) (x. x))";"x x"];; *)\r
-\r
-let alive (_, _, n) = n;;\r
-let rec setalive c = function\r
-  | Tvar(a,b,_) as v -> if v <> zero && v <> dummy then Tvar(a,b,c) else v\r
-  | Tapp(a,b) -> Tapp(setalive c a, setalive c b)\r
-  | Tlam(n, t) -> Tlam(n, setalive c t)\r
-;;\r
-\r
-let mk_vars t lev =\r
-  let rec aux n =\r
-    if n = 0\r
-    then []\r
-    else Tvar(0, Some(n, t), lev) :: (aux (n-1))\r
-  in aux\r
-;;\r
-\r
-let mk_apps t ts = List.fold_right (fun x y -> mk_app y x) (List.rev ts) t;; (* which FOLD? FIXME *)\r
-\r
-\r
-let compute_special_k tms =\r
-  let rec aux k t = match t with\r
-    | Tvar _ -> 0\r
-    | Tapp(t1,t2) -> Pervasives.max (aux 0 t1) (aux 0 t2)\r
-    | Tlam(v,t) -> Pervasives.max (k+1) (aux (k + 1) t)\r
-  in List.fold_left (fun b a -> Pervasives.max (aux 0 a) b) 0 tms\r
-;;\r
-\r
-let compute_special_h tms =\r
-  let rec eat_lam = function\r
-    | Tlam(_,t) -> eat_lam t\r
-    | _ as t -> t\r
-  in\r
-  let rec aux t = match t with\r
-    | Tvar _ -> 0\r
-    | Tapp(t1,t2) -> Pervasives.max (aux t1) (aux t2)\r
-    | Tlam(v,t) -> 1 + (aux (eat_lam t))\r
-  in 1 + List.fold_left (fun b a -> Pervasives.max (aux a) b) 0 tms\r
-;;\r
-\r
-(* funzione di traduzione brutta & cattiva *)\r
-let translate k =\r
-  let rec aux = function\r
-  | Tlam _ -> assert false\r
-  | Tvar _ as v -> v\r
-  | Tapp(t1, t2) ->\r
-    let v = hd t1 in\r
-    let a = alive v in\r
-    let t1' = aux t1 in\r
-    let t2' = if a = 0\r
-      then t2\r
-      else mk_apps t2 ((List.rev (mk_vars t1' (a-1) k)) @ [zero])\r
-    in Tapp(t1', aux t2')\r
-  in aux\r
-;;\r
-\r
-(* sostituisce gli argomenti dummy (delle variabili morte) con 'dummy' *)\r
-let rec dummize = function\r
-  | Tlam _ -> assert false\r
-  | Tvar (a,Some(b,t), c) -> Tvar(a, Some (b, dummize t), c)\r
-  | Tvar _ as v -> v\r
-  | Tapp(t1, t2) ->\r
-    if alive (hd t1) = 0\r
-    then Tapp(dummize t1, dummy)\r
-    else Tapp(dummize t1, dummize t2)\r
-;;\r
-\r
-(* lista di sottotermini applicativi *)\r
-let rec subterms = function\r
-  | Tlam _ -> assert false\r
-  | Tvar _ as v -> [v]\r
-  | Tapp(t1, t2) -> Tapp(t1, t2) :: ((subterms t1) @ (subterms t2))\r
-;;\r
-\r
-(* filtra dai sottotermini le variabili *)\r
-let rec vars subs = List.filter (function Tvar _ -> true | _ -> false) subs;;\r
-\r
-\r
-let rec stupid_uniq = function\r
-  | [] -> []\r
-  | x::xs -> if List.mem x xs then (stupid_uniq xs) else x::(stupid_uniq xs)\r
-;;\r
-let stupid_compare a b =\r
-  let rec size = function\r
-    | Tvar(_,None,_) -> 0\r
-    | Tvar(_,Some(_,t),_) -> 1 + size t\r
-    | Tapp(t1,t2) -> 1 + size t1 + size t2\r
-    | Tlam _ -> assert false\r
-  in compare (size a) (size b)\r
-;;\r
-let stupid_sort_uniq l = stupid_uniq (List.sort stupid_compare l);;\r
-\r
-(* crea i match ricorsivamente.\r
-  - k e' lo special-K\r
-  - subs e' l'insieme dei sottotermini\r
-  TODO: riscrivere la funzione per evitare/ottimizzare la ricorsione\r
- *)\r
-let crea_match k subs (acc : (term * Lambda3.nf) list) : term -> Lambda3.nf =\r
-  let req t = try List.assoc t acc with Not_found -> `Var 9999 in\r
-  let aux t1 = (\r
-  if t1 = dummy then `Var 99999 else\r
-  (* let _ = print_term t1 in *)\r
-  let cont = List.filter (fun t2 -> List.mem (Tapp(t1,t2)) subs) subs\r
-  in if cont = [] then\r
-    try `N (Lambda3.index_of t1 subs) with Not_found -> `Var 999 (* variabile dummy qui *) else\r
-  let a = alive (hd t1) in\r
-    if a = 0 then `Lam (req (Tapp(t1, dummy)))\r
-    else (\r
-      let vars = (List.rev (mk_vars t1 (a-1) k)) @ [zero]\r
-      (* in let _ = print_endline (String.concat " " (List.map string_of_term vars))\r
-      in let _ = print_term (mk_apps dummy vars) *)\r
-      in let vars = List.map req vars\r
-      in let vars = List.map (Lambda3.lift 1) vars (* forse lift non necessario *)\r
-      in let vars = Listx.from_list vars\r
-      in let body = `I(0, vars)\r
-      in let branches = List.map (fun t2 -> (Lambda3.index_of t2 subs, req (Tapp(t1, t2)))) cont\r
-      in let bs = ref(branches)\r
-      in let lift = 1\r
-      in let args = []\r
-      in `Lam (`Match(body, lift, bs, args))\r
-    )\r
-  ) in aux\r
-;;\r
-\r
-let mk_zeros k =\r
-  let rec aux n prev =\r
-    if n = 0 then [zero]\r
-    else let prev = aux (n-1) prev in let x = mk_app (List.hd prev) dummy in x :: prev\r
-  in aux (k+1) []\r
-;;\r
-\r
-let is_scott_n t n =\r
-  let open Lambda3 in let open Pure in\r
-  let rec aux n = function\r
-  | L (L (A (V 1, L (V 0)))) -> n = 0\r
-  | L (L (A (V 0, t))) -> aux (n-1) t\r
-  | _ -> assert false\r
-  in aux n t\r
-;;\r
-\r
-(* do the magic *)\r
-let magic strings k h = (\r
-  let tms = parse strings\r
-  in let tms = List.map (fun x -> Tapp(x, zero)) tms\r
-  in let tms' = List.map (setalive h) tms\r
-  in let tms' = List.map (translate k) tms'\r
-  in let tms' = List.map dummize tms'\r
-  (* in let bullet = ">" / "&bullet;" *)\r
-  (* in let progress s = print_endline (bullet ^^ fancy_of_string s) *)\r
-  in let progress = print_h1\r
-  in let _ = progress "traduzione completata"\r
-  (* in let _ = List.map print_term tms' *)\r
-  in let _ = progress "ordino i sottotermini"\r
-  in let subs = List.concat (List.map subterms tms')\r
-  in let subs = stupid_sort_uniq subs\r
-  (* metti gli zeri in testa, perche' vanno calcolati per primi *)\r
-  in let zeros = mk_zeros k\r
-  in let subs = (List.filter (fun t -> not (List.mem t zeros)) subs) @ (List.rev zeros)\r
-  in let _ = progress ("sottotermini generati: " ^ string_of_int (List.length subs))\r
-  in let vars = vars subs\r
-  (* in let _ = List.iter print_term subs *)\r
-  (* in let _ = 0/0 *)\r
-  in let fv = List.filter (function Tvar(_, None, _) as v -> v <> dummy | _ -> false) vars\r
-  (* in let _ = print_string ("> free vars: " ^ String.concat ", " (List.map (string_of_term) fv)) *)\r
-  in let _ = progress "sto creando i match"\r
-  (* in let sigma = List.map (fun x -> x, crea_match k subs x) fv *)\r
-  in let f t acc = let res = crea_match k subs acc t in (t,res)::acc\r
-  in let acc = List.fold_right f subs []\r
-  in let sigma = List.filter (fun (t,res) -> List.mem t fv) acc\r
-  in let _ = progress "match creati"\r
-  in let _ = List.iter (fun (x,y) -> print_endline (fancy_of_term x ^^ (" : " / " &#8614; ") ^^ fancy_of_nf y)) sigma\r
-\r
-  in let _ = progress "controllo di purezza";\r
-  in let open Lambda3\r
-  in let ps, _ = Lambda3.parse' strings\r
-  in let ps = List.map (fun x -> Lambda3.mk_app x (`Var 1010)) ps\r
-  in let ps = List.map (fun t -> ToScott.t_of_nf (t :> nf)) ps\r
-  in let sigma = List.map (\r
-    function (Tvar(n,_,_), inst) -> n, ToScott.t_of_nf inst | _ -> assert false\r
-    ) sigma\r
-  in let ps =\r
-    List.fold_left (fun ps (x,inst) -> List.map (Pure.subst false x inst) ps) ps sigma\r
-  in let _ = List.iteri (fun i n ->\r
-    (* print_string_endline ((string_of_int i) ^ ":: " ^ (Pure.print (Pure.whd n))); *)\r
-    (* assert (Pure.whd n = Scott.mk_n (Lambda3.index_of (List.nth tms' i) subs))) ps *)\r
-    assert (is_scott_n (Pure.whd n) (Lambda3.index_of (List.nth tms' i) subs))) ps\r
-  in let _ = progress "fatto." in ()\r
-);;\r
-\r
-let do_everything tms =\r
-let tms' = parse tms in\r
-let k = compute_special_k tms' in\r
-let h = compute_special_h tms' in\r
-(* let _ = print_string_endline (string_of_int h) in *)\r
-magic tms k h\r
-;;\r
-\r
-let _ =\r
-  let tms = ["a a"; "a b"; "b a"; "b (x. y.x y a)"] in\r
-  (* 1 2 *)\r
-  (* let tms = ["x c" ; "b (x c d e)"; "b"] in *)\r
-  (* 0 1 *)\r
-  (* let tms = ["x x x"] in *)\r
-  let tms' = parse tms in\r
-  let k = compute_special_k tms' in\r
-  let h = compute_special_h tms' in\r
-  (* let _ = print_string_endline (string_of_int h) in *)\r
-  magic tms k h\r
-;;\r
-\r
-(* type var' = (* unique name *) int * (int * term') option * (*dead*) bool option\r
-and term' =\r
-  | Tvar' of var'\r
-  | Tapp' of term' * term' * (* active *) bool\r
-  | Tlam' of int * term'\r
-;;\r
-\r
-let rec iter mustapply =\r
-  let aux = function\r
-  | Tvar'(n, Some(m,t), b) -> Tvar(n, Some(m, aux t), b)\r
-  | Tvar' _ as v -> v\r
-  | Tapp'(t1, t2, b) -> if b &&\r
-  in aux\r
-;; *)\r
diff --git a/ocaml/andrea4.ml b/ocaml/andrea4.ml
deleted file mode 100644 (file)
index 4b7e448..0000000
+++ /dev/null
@@ -1,637 +0,0 @@
-(* type var = (* unique name *) int * (int * term) option * (*level*) int *)\r
-type term =\r
-  | Tvar of int\r
-  | Tapp of term * term * bool\r
-  | Tlam of int * term\r
-;;\r
-\r
-let zero = Tvar 1010;;\r
-let dummy = Tvar 333;;\r
-\r
-\r
-(* mk_app & subst implementano la beta *)\r
-let rec mk_app t1 t2 = match t1 with\r
-  | Tlam(v, t1') -> subst v t2 t1'\r
-  | _ -> Tapp(t1, t2, false)\r
-and subst v tv =\r
-  let rec aux = function\r
-  | Tapp(t1, t2, _) -> mk_app (aux t1) (aux t2)\r
-  | Tvar v' as t -> if v = v' then tv else t\r
-  | Tlam(v', t') as t -> if v = v' then t else Tlam(v', aux t')\r
-  in aux\r
-;;\r
-\r
-(* PARSING AND PRINTING *)\r
-\r
-let parse =\r
-  let rec minus1 = function\r
-    | Tvar n -> Tvar (n-1)\r
-    | Tapp(t1, t2, b) -> Tapp(minus1 t1, minus1 t2, b)\r
-    | Tlam(n, t) -> Tlam(n-1, minus1 t)\r
-  (* in let open Parser *)\r
-  in let rec myterm_of_term = function\r
-    | Parser.Var n -> Tvar n\r
-    | Parser.App(t1, t2) -> (*Tapp(myterm_of_term t1, myterm_of_term t2) WARNING! BETA DOWN HERE! *)\r
-                            mk_app (myterm_of_term t1) (myterm_of_term t2)\r
-    | Parser.Lam(t) -> minus1 (Tlam(0, myterm_of_term t))\r
-  in fun strs -> (\r
-    let (tms, free) = Parser.parse_many strs\r
-    in List.map myterm_of_term tms\r
-    )\r
-;;\r
-\r
-(* PRETTY PRINTING *)\r
-open Console;;\r
-\r
-let fancy_of_term t =\r
-let rec string_of_term =\r
-  let free = ["a"; "b"; "c"; "d"; "e"; "f"; "g"] in\r
-  let bound = ["x"; "y"; "z"; "w"; "q"; "x1"; "x2"] in\r
-  let string_of_int' n = if n >= 0 then "free" ^ string_of_int n else "bound" ^ string_of_int n  in\r
-  let rec string_of_var t =\r
-    if Tvar t = dummy then "_" else if Tvar t = zero then "ZZ" else match t with\r
-    | n -> string_of_int' n\r
-  and string_of_term_w_pars = function\r
-    | Tvar v -> string_of_var v\r
-    | Tapp(t1, t2, _) -> "(" ^ (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2) ^ ")"\r
-    | Tlam(_,_) as t -> "(" ^ (string_of_term_no_pars_lam t) ^ ")"\r
-  and string_of_term_no_pars_app = function\r
-    | Tapp(t1, t2,_) -> (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2)\r
-    | _ as t -> string_of_term_w_pars t\r
-  and string_of_term_no_pars_lam = function\r
-    | Tlam(v, t) -> "λ" ^ (string_of_int' v) ^ ". " ^ (string_of_term_no_pars_lam t)\r
-    | _ as t -> string_of_term_no_pars t\r
-  and string_of_term_no_pars = function\r
-    | Tlam(_, _) as t -> string_of_term_no_pars_lam t\r
-    | _ as t -> string_of_term_no_pars_app t\r
-  in string_of_term_no_pars\r
-in let rec html_of_term =\r
-  let free = ["a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"] in\r
-  let bound = ["x"; "y"; "z"; "w"; "q"] in\r
-  let string_of_int' n = if n >= 0 then List.nth free (n) else List.nth bound (-n-1) in\r
-  let rec string_of_var t =\r
-    if Tvar t = dummy then "&num;" else if Tvar t = zero then "Z" else string_of_int' t\r
-  and string_of_term_w_pars = function\r
-    | Tvar v -> string_of_var v\r
-    | Tapp(t1, t2,_) -> "(" ^ (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2) ^ ")"\r
-    | Tlam(_,_) as t -> "(" ^ (string_of_term_no_pars_lam t) ^ ")"\r
-  and string_of_term_no_pars_app = function\r
-    | Tapp(t1, t2,_) -> (string_of_term_no_pars_app t1) ^ " " ^ (string_of_term_w_pars t2)\r
-    | _ as t -> string_of_term_w_pars t\r
-  and string_of_term_no_pars_lam = function\r
-    | Tlam(v, t) -> "&lambda;" ^ (string_of_int' v) ^ ". " ^ (string_of_term_no_pars_lam t)\r
-    | _ as t -> string_of_term_no_pars t\r
-  and string_of_term_no_pars = function\r
-    | Tlam(_, _) as t -> string_of_term_no_pars_lam t\r
-    | _ as t -> string_of_term_no_pars_app t\r
-  in string_of_term_no_pars\r
-in\r
-  string_of_term t / "html_of_term t"\r
-;;\r
-\r
-let fancy_of_nf t: Console.fancyobj =\r
-let rec print ?(l=[]) =\r
- function\r
-    `Var n -> Util.Vars.print_name l n\r
-  | `N n -> string_of_int n\r
-  | `Match(t,bs_lift,bs,args) ->\r
-     "([" ^ print ~l (t :> Num.nf) ^\r
-     " ? " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ print ~l (Num.lift bs_lift t)) !bs) ^ "] " ^\r
-     String.concat " " (List.map (print ~l) args) ^ ")"\r
-  | `I(n,args) -> "(" ^ Util.Vars.print_name l n ^ " " ^ String.concat " " (Listx.to_list (Listx.map (print ~l) args)) ^ ")"\r
-  | `Lam(_,nf) ->\r
-     let name = Util.Vars.string_of_var (List.length l) in\r
-     "" ^ name ^ "." ^ print ~l:(name::l) (nf : Num.nf)\r
-\r
-(* in let rec print_html ?(l=[]) =\r
- function\r
-    `Var n -> Lambda3.print_name l n\r
-  | `N n -> string_of_int n\r
-  | `Match(t,bs_lift,bs,args) ->\r
-     "(<b>match</b> " ^ print_html ~l (t :> Lambda3.nf) ^\r
-     " <b>with</b> " ^ String.concat " <b>|</b> " (List.map (fun (n,t) -> string_of_int n ^ " <b>&rArr;</b> " ^ print_html ~l (Lambda3.lift bs_lift t)) !bs) ^ "..." (* Attenzion non sto stampando gli argomenti applicati! Perche' non ce ne sono mai *)\r
-  | `I(n,args) -> "(" ^ Lambda3.print_name l n ^ " " ^ String.concat " " (Listx.to_list (Listx.map (print_html ~l) args)) ^ ")"\r
-  | `Lam nf ->\r
-     let name = Lambda3.string_of_var (List.length l) in\r
-     "&lambda;" ^ name ^ ". " ^ print_html ~l:(name::l) (nf : Lambda3.nf) *)\r
-in\r
-  print t / print t\r
-;;\r
-\r
-let print_term t = print_endline (fancy_of_term t :> Console.fancyobj);;\r
-(*  *)\r
-\r
-\r
-let varcount = ref 11;;\r
-\r
-let freshvar () = (\r
-  varcount := (!varcount + 1);\r
-  !varcount\r
-);;\r
-\r
-let find_applicative =\r
-  let rec aux = function\r
-  | Tapp(t1, Tlam _, _) -> Some t1\r
-  | Tapp(t1, t2, _) ->\r
-    (match aux t1 with\r
-    | None -> aux t2\r
-    | _ as r -> r)\r
-  | _-> None\r
-  in let rec aux2 = function\r
-    | [] -> None\r
-    | x::xs -> (match aux x with\r
-      | None -> aux2 xs\r
-      | _ as result -> result\r
-    )\r
-  in aux2\r
-;;\r
-\r
-let mk_apps t ts = List.fold_right (fun x y -> mk_app y x) (List.rev ts) t;; (* which FOLD? FIXME *)\r
-\r
-let rec hd = function | Tvar _ as x -> x | Tapp(t, _, _) -> hd t | _ -> assert false;;\r
-\r
-let rec set_applied =\r
-  function\r
-  | Tvar _ as v -> v\r
-  | Tlam _ -> assert false\r
-  | Tapp(t1,t2,_) -> Tapp(set_applied t1, set_applied t2, true)\r
-;;\r
-\r
-let rec constant a n =\r
-  if n = 0 then [] else a:: (constant a (n-1))\r
-;;\r
-\r
-let rec mk_dummies k t =\r
-  set_applied (mk_apps t (constant dummy (k+1)))\r
-;;\r
-\r
-let rec make_lambda_zero k =\r
-  if k = 0 then mk_dummies (k+1) zero else Tlam(0, make_lambda_zero (k-1))\r
-;;\r
-\r
-let mk_vars n =\r
-  let rec aux n =\r
-    if n = 0\r
-    then []\r
-    else (Tvar (freshvar ())) :: (aux (n-1))\r
-  in aux n @ [make_lambda_zero (n+1)]\r
-;;\r
-\r
-let apply a vars =\r
-  let rec aux = function\r
-  | Tapp(t1, t2, b) ->\r
-    if t1 = a\r
-    then (assert (not b); Tapp(aux t1, mk_apps' t2 vars, true))\r
-    else Tapp(aux t1, aux t2, b)\r
-  | _ as t -> t\r
-  and mk_apps' t vars =\r
-    if t = zero\r
-    then mk_dummies (List.length vars - 1) t\r
-    else aux (mk_apps t vars)\r
-  in aux\r
-;;\r
-\r
-let round k (app_map, tms) =\r
-  match find_applicative tms with\r
-  | None -> raise Not_found\r
-  | Some a ->\r
-    let vars = mk_vars k in\r
-    let f = apply a vars in\r
-    let app_map = (a, vars) :: (List.map (fun (x,y) -> f x, y) app_map)\r
-    in (app_map, List.map f tms)\r
-;;\r
-\r
-let ends_with t1 t2 = match t1 with\r
-  | Tapp(_, t, _) -> t = t2\r
-  | _ -> false\r
-;;\r
-\r
-let rec last_round k (app_map, forbidden, t) =\r
-  let mk_apps' forbidden t vars =\r
-    if List.mem t forbidden\r
-    then mk_dummies (List.length vars - 1) t\r
-    else mk_apps t vars\r
-  (* in let rec already_applied = function\r
-    | Tapp(_, t) -> t = zero || t = dummy || hd t = zero\r
-    | _ -> false *)\r
-  in if ends_with t dummy then (app_map, forbidden, t) else (match t with\r
-  | Tapp(t1, t2, b) ->\r
-    if b\r
-    then\r
-      let app_map, forbidden, t1 = last_round k (app_map, forbidden, t1)\r
-      in let app_map, forbidden, t2 = last_round k (app_map, forbidden, t2)\r
-      in app_map, forbidden, Tapp(t1, t2, b)\r
-    else\r
-      let app_map, forbidden, t1 = last_round k (app_map, forbidden, t1)\r
-      in let app_map, forbidden, t2 =\r
-        try\r
-            let vars = List.assoc t1 app_map\r
-            in last_round k (app_map, forbidden, (mk_apps' forbidden t2 vars))\r
-          with Not_found ->\r
-            let vars = mk_vars k in\r
-            let app_map = (t1, vars) :: app_map in\r
-            last_round k (app_map, (vars @ forbidden), (mk_apps' forbidden t2 vars))\r
-      in app_map, forbidden, Tapp(t1, t2, true)\r
-  | _ as t -> app_map, forbidden, t\r
-  )\r
-;;\r
-\r
-let fixpoint f =\r
-  let rec aux x = try\r
-    let y = f x in aux y\r
-  with Not_found -> x\r
-  in aux\r
-;;\r
-\r
-(* lista di sottotermini applicativi *)\r
-let rec subterms = function\r
-  | Tlam _ -> assert false\r
-  | Tvar _ as v -> [v]\r
-  | Tapp(t1, t2, b) -> Tapp(t1, t2, b) :: ((subterms t1) @ (subterms t2))\r
-;;\r
-\r
-(* filtra dai sottotermini le variabili *)\r
-let rec vars subs = List.filter (function Tvar _ -> true | _ -> false) subs;;\r
-\r
-let stupid_sort_uniq map l =\r
-  let rec stupid_uniq = function\r
-    | [] -> []\r
-    | x::xs -> if List.mem x xs then (stupid_uniq xs) else x::(stupid_uniq xs)\r
-  in let stupid_compare a b =\r
-    let rec size = function\r
-      | Tvar n as v -> if v = zero then 0 else (\r
-        try\r
-          let t, _ = List.find (fun (_,vars) -> List.mem v vars) map\r
-          in 1 + size t\r
-        with Not_found -> 1 + n)\r
-      | Tapp(t1,t2,_) -> 1 + size t1 + size t2\r
-      | Tlam _ -> assert false\r
-    in compare (size a) (size b)\r
-  in stupid_uniq (List.sort stupid_compare l)\r
-;;\r
-\r
-(* crea i match ricorsivamente.\r
-  - k e' lo special-K\r
-  - subs e' l'insieme dei sottotermini\r
-  TODO: riscrivere la funzione per evitare/ottimizzare la ricorsione\r
- *)\r
-let crea_match subs map forbidden (acc : (term * Num.nf) list) : term -> Num.nf =\r
-  let req t = try List.assoc t acc with Not_found -> `Var 9999 in\r
-  let aux t1 = (\r
-  if t1 = dummy then `Var 99999 else\r
-  (* let _ = print_term t1 in *)\r
-  let cont = List.filter (fun t2 -> List.mem (Tapp(t1,t2,true)) subs) subs\r
-  in if cont = [] then\r
-    try `N (Util.index_of t1 subs) with Not_found -> `Var 999 (* variabile dummy qui *) else\r
-\r
-    if List.mem (hd t1) forbidden then `Lam (true,req (Tapp(t1, dummy, true)))\r
-    else (\r
-      let vars = List.assoc t1 map\r
-      (* in let _ = print_endline (String.concat " " (List.map string_of_term vars))\r
-      in let _ = print_term (mk_apps dummy vars) *)\r
-      in let vars = List.map req vars\r
-      in let vars = List.map (Num.lift 1) vars (* forse lift non necessario *)\r
-      in let vars = Listx.from_list vars\r
-      in let body = `I(0, vars)\r
-      in let branches = List.map (fun t2 -> (Util.index_of t2 subs, req (Tapp(t1, t2, true)))) cont\r
-      in let bs = ref(branches)\r
-      in let lift = 1\r
-      in let args = []\r
-      in `Lam (true, `Match(body, lift, bs, args))\r
-    )\r
-  ) in aux\r
-;;\r
-\r
-(* filtra dai sottotermini le variabili *)\r
-let rec vars subs = List.filter (function Tvar _ -> true | _ -> false) subs;;\r
-\r
-let mk_zeros k =\r
-  let rec aux n prev =\r
-    if n = 0 then [zero]\r
-    else let prev = aux (n-1) prev in let x = mk_app (List.hd prev) dummy in x :: prev\r
-  in aux (k+1) []\r
-;;\r
-\r
-let rec freevars = function\r
-  | Tvar _ as v -> [v]\r
-  | Tlam(v,t) -> List.filter (fun x-> x <> Tvar v) (freevars t)\r
-  | Tapp(t1,t2,_) -> (freevars t1) @ (freevars t2)\r
-;;\r
-\r
-open Pure;;\r
-\r
-let is_scott_n t n =\r
-  let open Lambda4 in let open Pure in\r
-  let rec aux n = function\r
-  | L (L (A (V 1, L (V 0)))) -> n = 0\r
-  | L (L (A (V 0, t))) -> aux (n-1) t\r
-  | _ -> assert false\r
-  in aux n t\r
-;;\r
-let is_scott =\r
-  let open Lambda4 in let open Pure in\r
-  let rec aux = function\r
-  | L (L (A (V 1, L (V 0)))) -> 0\r
-  | L (L (A (V 0, t))) -> 1 + aux t\r
-  | _ -> assert false\r
-  in aux\r
-;;\r
-\r
-let compute_special_k tms =\r
-  let rec aux k t = match t with\r
-    | Tvar _ -> 0\r
-    | Tapp(t1,t2,_) -> Pervasives.max (aux 0 t1) (aux 0 t2)\r
-    | Tlam(v,t) -> Pervasives.max (k+1) (aux (k + 1) t)\r
-  in List.fold_left (fun b a -> Pervasives.max (aux 0 a) b) 0 tms\r
-;;\r
-\r
-let magic strings =\r
-  let rec map_helper_3 a b f =\r
-    function\r
-    | [] -> a, b, []\r
-    | c::cs ->\r
-      let a, b, d = f (a, b, c) in\r
-      let a, b, ds = map_helper_3 a b f cs in\r
-      a, b, (d::ds)\r
-  in let _ = print_hline ()\r
-  in let tms = parse strings\r
-  in let k = compute_special_k tms\r
-  in let zero' = make_lambda_zero (k+1)\r
-  in let tms = List.map (fun x -> Tapp(x, zero', false)) tms\r
-  in let fv = Util.sort_uniq (List.concat (List.map freevars tms))\r
-  in let (map, tms') = fixpoint (round k) ([], tms)\r
-  (* in let _ = print_string_endline "map1 "; List.iter (fun (t,_) -> print_term t) map; print_string_endline "ok1" *)\r
-  in let _ = List.map print_term tms'\r
-\r
-  in let map1 = List.map fst map\r
-  in let map2 = List.map snd map\r
-  in let map_new, forbidden, map1' = map_helper_3 [] [zero] (last_round k) map1\r
-\r
-  in let map = map_new @ (List.combine map1' map2)\r
-  (* in let _ = print_string_endline "map2 "; List.iter (fun (t,_) -> print_term t) map; print_string_endline "ok2" *)\r
-  in let map, forbidden, tms' = map_helper_3 map forbidden (last_round k) tms'\r
-\r
-  in let _ = List.map print_term tms'\r
-  in let subs = List.concat (List.map subterms tms')\r
-  in let subs = stupid_sort_uniq map subs\r
-  (* metti gli zeri in testa, perche' vanno calcolati per primi *)\r
-  in let zeros = mk_zeros k\r
-  in let subs = (List.filter (fun t -> not (List.mem t zeros)) subs) @ (List.rev zeros)\r
-\r
-  (* in let _ = print_string_endline " subs"; List.iter print_term subs *)\r
-  (* in let _ = print_string_endline "map "; List.iter (fun (t,_) -> print_term t) map; print_string_endline "ok" *)\r
-\r
-  in let f t acc = let res = crea_match subs map forbidden acc t in (t,res)::acc\r
-  in let acc = List.fold_right f subs []\r
-\r
-  in let sigma = List.filter (fun (t,res) -> List.mem t fv) acc\r
-  in let _ = List.iter (fun (x,y) -> print_endline (fancy_of_term x ^^ (" : " / " &#8614; ") ^^ fancy_of_nf y)) sigma\r
-\r
-  in let _ = print_string_endline "controllo di purezza";\r
-  (* in let open Num *)\r
-  in let ps, _ = Num.parse' strings\r
-  in let ps = List.map (fun x -> Num.mk_app x (`Var 1010)) ps\r
-  in let ps = List.map (fun t -> Num.ToScott.t_of_nf (t :> Num.nf)) ps\r
-  in let sigma = List.map (\r
-    function (Tvar n , inst) -> n, Num.ToScott.t_of_nf inst | _ -> assert false\r
-    ) sigma\r
-  (* in let ps =\r
-    List.fold_left (fun ps (x,inst) -> List.map (Pure.subst false x inst) ps) ps sigma\r
-  in let _ = List.iteri (fun i n ->\r
-    print_string_endline ("X " ^ Pure.print (Pure.whd n));\r
-    (* assert (is_scott_n (Pure.whd n) (Lambda3.index_of (List.nth tms' i) subs)) *)\r
-    is_scott (Pure.whd n); ()\r
-    ) ps *)\r
-  in ()\r
-;;\r
-\r
-\r
-(* magic ["x (x x x)"; "x (y. y x)"; "x x (y. y y (x x y))"] ;; *)\r
-magic ["((x x) (x. x))";"x x"];;\r
-\r
-(*\r
-\r
-let alive (_, _, n) = n;;\r
-let rec setalive c = function\r
-  | Tvar(a,b,_) as v -> if v <> zero && v <> dummy then Tvar(a,b,c) else v\r
-  | Tapp(a,b) -> Tapp(setalive c a, setalive c b)\r
-  | Tlam(n, t) -> Tlam(n, setalive c t)\r
-;;\r
-\r
-let mk_vars t lev =\r
-  let rec aux n =\r
-    if n = 0\r
-    then []\r
-    else Tvar(0, Some(n, t), lev) :: (aux (n-1))\r
-  in aux\r
-;;\r
-\r
-let mk_apps t ts = List.fold_right (fun x y -> mk_app y x) (List.rev ts) t;; (* which FOLD? FIXME *)\r
-\r
-\r
-let compute_special_k tms =\r
-  let rec aux k t = match t with\r
-    | Tvar _ -> 0\r
-    | Tapp(t1,t2) -> Pervasives.max (aux 0 t1) (aux 0 t2)\r
-    | Tlam(v,t) -> Pervasives.max (k+1) (aux (k + 1) t)\r
-  in List.fold_left (fun b a -> Pervasives.max (aux 0 a) b) 0 tms\r
-;;\r
-\r
-let compute_special_h tms =\r
-  let rec eat_lam = function\r
-    | Tlam(_,t) -> eat_lam t\r
-    | _ as t -> t\r
-  in\r
-  let rec aux t = match t with\r
-    | Tvar _ -> 0\r
-    | Tapp(t1,t2) -> Pervasives.max (aux t1) (aux t2)\r
-    | Tlam(v,t) -> 1 + (aux (eat_lam t))\r
-  in 1 + List.fold_left (fun b a -> Pervasives.max (aux a) b) 0 tms\r
-;;\r
-\r
-(* funzione di traduzione brutta & cattiva *)\r
-let translate k =\r
-  let rec aux = function\r
-  | Tlam _ -> assert false\r
-  | Tvar _ as v -> v\r
-  | Tapp(t1, t2) ->\r
-    let v = hd t1 in\r
-    let a = alive v in\r
-    let t1' = aux t1 in\r
-    let t2' = if a = 0\r
-      then t2\r
-      else mk_apps t2 ((List.rev (mk_vars t1' (a-1) k)) @ [zero])\r
-    in Tapp(t1', aux t2')\r
-  in aux\r
-;;\r
-\r
-(* sostituisce gli argomenti dummy (delle variabili morte) con 'dummy' *)\r
-let rec dummize = function\r
-  | Tlam _ -> assert false\r
-  | Tvar (a,Some(b,t), c) -> Tvar(a, Some (b, dummize t), c)\r
-  | Tvar _ as v -> v\r
-  | Tapp(t1, t2) ->\r
-    if alive (hd t1) = 0\r
-    then Tapp(dummize t1, dummy)\r
-    else Tapp(dummize t1, dummize t2)\r
-;;\r
-\r
-(* lista di sottotermini applicativi *)\r
-let rec subterms = function\r
-  | Tlam _ -> assert false\r
-  | Tvar _ as v -> [v]\r
-  | Tapp(t1, t2) -> Tapp(t1, t2) :: ((subterms t1) @ (subterms t2))\r
-;;\r
-\r
-(* filtra dai sottotermini le variabili *)\r
-let rec vars subs = List.filter (function Tvar _ -> true | _ -> false) subs;;\r
-\r
-\r
-let rec stupid_uniq = function\r
-  | [] -> []\r
-  | x::xs -> if List.mem x xs then (stupid_uniq xs) else x::(stupid_uniq xs)\r
-;;\r
-let stupid_compare a b =\r
-  let rec size = function\r
-    | Tvar(_,None,_) -> 0\r
-    | Tvar(_,Some(_,t),_) -> 1 + size t\r
-    | Tapp(t1,t2) -> 1 + size t1 + size t2\r
-    | Tlam _ -> assert false\r
-  in compare (size a) (size b)\r
-;;\r
-let stupid_sort_uniq l = stupid_uniq (List.sort stupid_compare l);;\r
-\r
-(* crea i match ricorsivamente.\r
-  - k e' lo special-K\r
-  - subs e' l'insieme dei sottotermini\r
-  TODO: riscrivere la funzione per evitare/ottimizzare la ricorsione\r
- *)\r
-let crea_match k subs (acc : (term * Lambda3.nf) list) : term -> Lambda3.nf =\r
-  let req t = try List.assoc t acc with Not_found -> `Var 9999 in\r
-  let aux t1 = (\r
-  if t1 = dummy then `Var 99999 else\r
-  (* let _ = print_term t1 in *)\r
-  let cont = List.filter (fun t2 -> List.mem (Tapp(t1,t2)) subs) subs\r
-  in if cont = [] then\r
-    try `N (Lambda3.index_of t1 subs) with Not_found -> `Var 999 (* variabile dummy qui *) else\r
-  let a = alive (hd t1) in\r
-    if a = 0 then `Lam (req (Tapp(t1, dummy)))\r
-    else (\r
-      let vars = (List.rev (mk_vars t1 (a-1) k)) @ [zero]\r
-      (* in let _ = print_endline (String.concat " " (List.map string_of_term vars))\r
-      in let _ = print_term (mk_apps dummy vars) *)\r
-      in let vars = List.map req vars\r
-      in let vars = List.map (Lambda3.lift 1) vars (* forse lift non necessario *)\r
-      in let vars = Listx.from_list vars\r
-      in let body = `I(0, vars)\r
-      in let branches = List.map (fun t2 -> (Lambda3.index_of t2 subs, req (Tapp(t1, t2)))) cont\r
-      in let bs = ref(branches)\r
-      in let lift = 1\r
-      in let args = []\r
-      in `Lam (`Match(body, lift, bs, args))\r
-    )\r
-  ) in aux\r
-;;\r
-\r
-let mk_zeros k =\r
-  let rec aux n prev =\r
-    if n = 0 then [zero]\r
-    else let prev = aux (n-1) prev in let x = mk_app (List.hd prev) dummy in x :: prev\r
-  in aux (k+1) []\r
-;;\r
-\r
-let is_scott_n t n =\r
-  let open Lambda3 in let open Pure in\r
-  let rec aux n = function\r
-  | L (L (A (V 1, L (V 0)))) -> n = 0\r
-  | L (L (A (V 0, t))) -> aux (n-1) t\r
-  | _ -> assert false\r
-  in aux n t\r
-;;\r
-\r
-(* do the magic *)\r
-let magic strings k h = (\r
-  let tms = parse strings\r
-  in let tms = List.map (fun x -> Tapp(x, zero)) tms\r
-  in let tms' = List.map (setalive h) tms\r
-  in let tms' = List.map (translate k) tms'\r
-  in let tms' = List.map dummize tms'\r
-  (* in let bullet = ">" / "&bullet;" *)\r
-  (* in let progress s = print_endline (bullet ^^ fancy_of_string s) *)\r
-  in let progress = print_h1\r
-  in let _ = progress "traduzione completata"\r
-  (* in let _ = List.map print_term tms' *)\r
-  in let _ = progress "ordino i sottotermini"\r
-  in let subs = List.concat (List.map subterms tms')\r
-  in let subs = stupid_sort_uniq subs\r
-  (* metti gli zeri in testa, perche' vanno calcolati per primi *)\r
-  in let zeros = mk_zeros k\r
-  in let subs = (List.filter (fun t -> not (List.mem t zeros)) subs) @ (List.rev zeros)\r
-  in let _ = progress ("sottotermini generati: " ^ string_of_int (List.length subs))\r
-  in let vars = vars subs\r
-  (* in let _ = List.iter print_term subs *)\r
-  (* in let _ = 0/0 *)\r
-  in let fv = List.filter (function Tvar(_, None, _) as v -> v <> dummy | _ -> false) vars\r
-  (* in let _ = print_string ("> free vars: " ^ String.concat ", " (List.map (string_of_term) fv)) *)\r
-  in let _ = progress "sto creando i match"\r
-  (* in let sigma = List.map (fun x -> x, crea_match k subs x) fv *)\r
-  in let f t acc = let res = crea_match k subs acc t in (t,res)::acc\r
-  in let acc = List.fold_right f subs []\r
-  in let sigma = List.filter (fun (t,res) -> List.mem t fv) acc\r
-  in let _ = progress "match creati"\r
-  in let _ = List.iter (fun (x,y) -> print_endline (fancy_of_term x ^^ (" : " / " &#8614; ") ^^ fancy_of_nf y)) sigma\r
-\r
-  in let _ = progress "controllo di purezza";\r
-  in let open Lambda3\r
-  in let ps, _ = Lambda3.parse' strings\r
-  in let ps = List.map (fun x -> Lambda3.mk_app x (`Var 1010)) ps\r
-  in let ps = List.map (fun t -> ToScott.t_of_nf (t :> nf)) ps\r
-  in let sigma = List.map (\r
-    function (Tvar(n,_,_), inst) -> n, ToScott.t_of_nf inst | _ -> assert false\r
-    ) sigma\r
-  in let ps =\r
-    List.fold_left (fun ps (x,inst) -> List.map (Pure.subst false x inst) ps) ps sigma\r
-  in let _ = List.iteri (fun i n ->\r
-    (* print_string_endline ((string_of_int i) ^ ":: " ^ (Pure.print (Pure.whd n))); *)\r
-    (* assert (Pure.whd n = Scott.mk_n (Lambda3.index_of (List.nth tms' i) subs))) ps *)\r
-    assert (is_scott_n (Pure.whd n) (Lambda3.index_of (List.nth tms' i) subs))) ps\r
-  in let _ = progress "fatto." in ()\r
-);;\r
-\r
-let do_everything tms =\r
-let tms' = parse tms in\r
-let k = compute_special_k tms' in\r
-let h = compute_special_h tms' in\r
-(* let _ = print_string_endline (string_of_int h) in *)\r
-magic tms k h\r
-;;\r
-\r
-let _ =\r
-  let tms = ["a a"; "a b"; "b a"; "b (x. y.x y a)"] in\r
-  (* 1 2 *)\r
-  (* let tms = ["x c" ; "b (x c d e)"; "b"] in *)\r
-  (* 0 1 *)\r
-  (* let tms = ["x x x"] in *)\r
-  let tms' = parse tms in\r
-  let k = compute_special_k tms' in\r
-  let h = compute_special_h tms' in\r
-  (* let _ = print_string_endline (string_of_int h) in *)\r
-  magic tms k h\r
-;;\r
-\r
-(* type var' = (* unique name *) int * (int * term') option * (*dead*) bool option\r
-and term' =\r
-  | Tvar' of var'\r
-  | Tapp' of term' * term' * (* active *) bool\r
-  | Tlam' of int * term'\r
-;;\r
-\r
-let rec iter mustapply =\r
-  let aux = function\r
-  | Tvar'(n, Some(m,t), b) -> Tvar(n, Some(m, aux t), b)\r
-  | Tvar' _ as v -> v\r
-  | Tapp'(t1, t2, b) -> if b &&\r
-  in aux\r
-;; *)\r
-\r
-*)\r
diff --git a/ocaml/andrea6.ml b/ocaml/andrea6.ml
deleted file mode 100644 (file)
index 38346b0..0000000
+++ /dev/null
@@ -1,615 +0,0 @@
-let print_hline = Console.print_hline;;\r
-\r
-type var = int;;\r
-\r
-type t =\r
- | V of var\r
- | A of t * t\r
- | L of t\r
- | LM of\r
-    t list (* body of the match *)\r
-  * int (* explicit liftno *)\r
-  * int (* variable which originated this match (id) *)\r
- | B (* bottom *)\r
- | P (* pacman *)\r
-;;\r
-\r
-\r
-type problem = {\r
-   orig_freshno: int\r
- ; freshno : int\r
- ; div : t list\r
- ; conv : t list\r
- ; matches : (var (* variable originating this match *) * (bool (* term comes from div*) * (t (* term to discriminate *) * t (* continuation *))) list) list\r
- ; sigma : (var * t) list (* substitutions *)\r
-}\r
-\r
-let string_of_t p =\r
- let bound_vars = ["x"; "y"; "z"; "z1"; "z2"] in\r
- let rec aux level = function\r
- | V v -> if v >= level then "`" ^ string_of_int (v-level) else List.nth bound_vars (level - v-1)\r
- | A (t1,t2) -> "("^aux level t1^" "^aux level t2^")"\r
- | L t -> "(\\" ^ aux (level+1) (V 0) ^ ". " ^ aux (level+1) t ^ ")"\r
- | LM (ts,liftno,id) -> "[match orig="^aux 0 (V id)^"]"\r
- | B -> "BOT"\r
- | P -> "PAC"\r
- in aux 0\r
-;;\r
-\r
-let string_of_t p =\r
-  let bound_vars = ["x"; "y"; "z"; "w"; "q"; "x1"; "x2"] in\r
-  let rec string_of_term_w_pars level = function\r
-    | V v -> if v >= level then "`" ^ string_of_int (v-level) else List.nth bound_vars (level - v-1)\r
-    | A _ as t -> "(" ^ string_of_term_no_pars_app level t ^ ")"\r
-    | L _ as t -> "(" ^ string_of_term_no_pars_lam level t ^ ")"\r
-    | LM (ts,liftno,id) -> "[match orig="^ string_of_term_w_pars 0 (V id)^"]"\r
-    | B -> "BOT"\r
-    | P -> "PAC"\r
-  and string_of_term_no_pars_app level = function\r
-    | A(t1,t2) -> (string_of_term_no_pars_app level t1) ^ " " ^ (string_of_term_w_pars level t2)\r
-    | _ as t -> string_of_term_w_pars level t\r
-  and string_of_term_no_pars_lam level = function\r
-    | L t -> "λ" ^ string_of_term_w_pars (level+1) (V 0) ^ ". " ^ (string_of_term_no_pars_lam (level+1) t)\r
-    | _ as t -> string_of_term_no_pars level t\r
-  and string_of_term_no_pars level = function\r
-    | L _ as t -> string_of_term_no_pars_lam level t\r
-    | _ as t -> string_of_term_no_pars_app level t\r
-  in string_of_term_no_pars 0\r
-;;\r
-\r
-let string_of_problem p =\r
- let lines = [\r
-  "[DV] " ^ String.concat "\n     " (List.map (string_of_t p) p.div);\r
-  "[CV] " ^ String.concat "\n     " (List.map (string_of_t p) p.conv);\r
-  (* "" ; *)\r
- ] @ Util.concat_map (fun (v, lst) -> ("[<>] of "^(string_of_t p (V v))) :: List.map (fun (b,(t,c)) -> "   " ^ (if b then "*" else " ") ^ " " ^ string_of_t p t\r
- (* ^" -> " ^ string_of_t p c *)\r
- ) lst) p.matches @ [""] in\r
- String.concat "\n" lines\r
-;;\r
-\r
-let problem_fail p reason =\r
- print_endline "!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!";\r
- print_endline (string_of_problem p);\r
- failwith reason\r
-;;\r
-\r
-let freshvar ({freshno} as p) =\r
- {p with freshno=freshno+1}, freshno+1\r
-;;\r
-\r
-let add_to_match p id entry =\r
- let matches = try\r
-   let _ = List.assoc id p.matches in\r
-   List.map (fun (id',lst as x) -> if id <> id' then x else (id, entry::lst) ) p.matches\r
-  with\r
-  | Not_found -> (id,[entry]) :: p.matches in\r
- {p with matches}\r
-;;\r
-\r
-let var_occurs_in v =\r
- let rec aux level = function\r
- | V v' -> v + level = v'\r
- | A(t1,t2) -> (aux level t1) || (aux level t2)\r
- | L t -> aux (level+1) t\r
- | LM(ts,_,_) -> List.fold_left (fun a b -> a || aux (level+1) b) false ts\r
- | B -> false\r
- | P -> false\r
- in aux 0\r
-;;\r
-\r
-let rec is_inert =\r
- function\r
- | A(t,_) -> is_inert t\r
- | V _ -> true\r
- | L _ | LM _ | B | P -> false\r
-;;\r
-\r
-let is_var = function V _ -> true | _ -> false;;\r
-let is_lambda = function L _ -> true | _ -> false;;\r
-let is_pacman = function P -> true | _ -> false;;\r
-\r
-let rec subst isdiv level delift sub p =\r
- function\r
- | V v -> p, if v = level + fst sub then lift level (snd sub) else V (if delift && v > level then v-1 else v)\r
- | L t -> let p, t = subst isdiv (level + 1) delift sub p t in p, L t\r
- | A (t1,t2) ->\r
-  let p, t1 = subst isdiv level delift sub p t1 in\r
-  let p, t2 = subst isdiv level delift sub p t2 in\r
-  if t1 = B || t2 = B then p, B else\r
-  if level = 0 then mk_app isdiv p t1 t2 else p, A (t1, t2)\r
- | LM (ts, liftno, id) ->\r
-   let p, ts =\r
-    let rec aux p = function\r
-    | [] -> p, []\r
-    | t::ts ->\r
-     let p, ts = aux p ts in\r
-     let p, t = subst isdiv (level+1) delift sub p t in\r
-     p, t::ts in\r
-    aux p ts in\r
-   p, LM(ts, liftno, id)\r
- | B -> p, B\r
- | P -> p, P\r
-and mk_app isdiv p t1 t2 = let t1 = if t1 = P then L P else t1 in match t1 with\r
- | L t1 ->\r
- (* FIXME BUG HERE! *)\r
-  if is_inert t2 && (match t2 with V v -> v > p.orig_freshno | _ -> true ) && not (var_occurs_in 0 t1)\r
-   then (if isdiv then {p with div=p.div @ [t2]} else {p with conv=p.conv @ [t2]}), lift (-1) t1\r
-   else subst isdiv 0 true (0, t2) p t1\r
- | LM(ts,liftno,id) ->\r
-  let p, t = mk_apps isdiv p t2 (List.map (lift ~-1) ts) in\r
-  if t = B\r
-   then p, B\r
-   else\r
-    let p, cont = freshvar p in\r
-    let newvar = V cont in\r
-    let p = add_to_match p id (isdiv,(t,newvar)) in\r
-      p, newvar\r
- | B\r
- | _ when t2 = B -> p, B\r
- | t1 -> p, A (t1, t2)\r
-and mk_apps isdiv p t =\r
- function\r
- | [] -> p, t\r
- | t'::ts -> let p, t = mk_app isdiv p t t' in mk_apps isdiv p t ts\r
- and lift n =\r
-  let rec aux n' =\r
-   function\r
-   | V m -> V (if m >= n' then m + n else m)\r
-   | L t -> L (aux (n'+1) t)\r
-   | A (t1, t2) -> A (aux n' t1, aux n' t2)\r
-   | LM (ts, liftno, id) -> LM (List.map (aux (n'+1)) ts, n + liftno, id)\r
-   | B -> B\r
-   | P -> P\r
-  in aux 0\r
- ;;\r
-\r
-let subst isdiv = subst isdiv 0 false;;\r
-\r
-let mk_lambda t = L (lift 1 t) ;;\r
-\r
-let subst_many b sub =\r
- let rec aux p = function\r
- | [] -> p, []\r
- | t::tms ->\r
-  let p, t = subst b sub p t in\r
-  let p, tms = aux p tms in\r
-  p, t :: tms\r
- in aux\r
-;;\r
-\r
-let rec subst_in_matches sub p =\r
- function\r
- | [] -> p, []\r
- | (v, branches) :: ms->\r
-  let a, b = List.split branches in\r
-  let b, c = List.split b in\r
-  let p, b = subst_many false sub p b in\r
-  let p, c = subst_many false sub p c in\r
-  let b = List.combine b c in\r
-  let branches = List.combine a b in\r
-  let p, ms = subst_in_matches sub p ms in\r
-  p, (v, branches) :: ms\r
-;;\r
-\r
-let subst_in_problem (sub: var * t) (p: problem) =\r
-(* print_endline ("SUBST IN PROBLEM: " ^ string_of_t p (V (fst sub)) ^ " " ^ string_of_t p (snd sub)); *)\r
- let div, conv = p.div, p.conv in\r
- let p = {p with div=[]; conv=[]} in\r
- let p, div' = subst_many true sub p div in\r
- let p, conv' = subst_many false sub p conv in\r
- let p, matches = subst_in_matches sub p p.matches in\r
- let p = {p with div=div'@p.div; conv=conv'@p.conv; matches} in\r
- (* print_endline ("after sub: \n" ^ string_of_problem p); *)\r
- {p with sigma=sub::p.sigma}\r
-;;\r
-\r
-(* FIXME *)\r
-let unify_terms p t1 t2 =\r
- match t1 with\r
- | V v -> subst_in_problem (v, t2) p\r
- | _ -> problem_fail p "The collapse of a match came after too many steps :(";;\r
-\r
-let rec unify p =\r
- let rec give_duplicates =\r
-  let rec aux' t = function\r
-  | [] -> [], None\r
-  | (b',(t',c'))::ts -> if t = t' (* FIXME! eta-eq here *)then ts, Some (b',c') else (\r
-   let ts, res = aux' t ts in (b',(t',c'))::ts, res) in\r
-  let rec aux = function\r
-   | [] -> [], None\r
-   | (b,(t,c))::rest -> (\r
-    match aux' t rest with\r
-    | rest, None -> aux rest\r
-    | rest, Some (b',c') -> ((if not b' then false else b),(t,c))::rest, Some (c', c)\r
-    ) in\r
-  function\r
-  | [] -> [], None\r
-  | (orig,branches) :: ms ->\r
-   match aux branches with\r
-   | _, None -> let ms, res = give_duplicates ms in (orig,branches) :: ms, res\r
-   | branches', Some subst -> (orig,branches') :: ms, Some subst in\r
- let matches, vars_to_be_unified = give_duplicates p.matches in\r
- let p = {p with matches=matches} in\r
- match vars_to_be_unified with\r
-  | None -> p\r
-  | Some(t', t) ->\r
-   (* print_endline ("> unify " ^ string_of_t p (t') ^ " with " ^ string_of_t p t); *)\r
-   unify (unify_terms p t' t)\r
-;;\r
-\r
-let problem_done p =\r
-  let all_separated = List.for_all (fun (_, lst) -> List.length lst = 1 || List.for_all (fun (_,(t,_)) -> is_var t) lst) p.matches in\r
-  all_separated && List.exists ((=) B) p.div\r
-;;\r
-\r
-let free_vars p t =\r
- let rec aux level = function\r
- | V v -> if v >= level then [v] else []\r
- | A(t1,t2) -> (aux level t1) @ (aux level t2)\r
- | L t -> aux (level+1) t\r
- | LM(ts,_,id) -> (List.concat (List.map (aux level) ts)) @ (\r
-  let lst = List.assoc id p.matches in\r
-  List.concat (List.map (fun (_,(t1,t2)) -> (aux 0 t1) @ (aux 0 t2)) lst)\r
- )\r
- | B -> []\r
- | P -> []\r
- in Util.sort_uniq (aux 0 t)\r
-;;\r
-\r
-let visible_vars p t =\r
- let rec aux = function\r
- | V v -> [v]\r
- | A(t1,t2) -> (aux t1) @ (aux t2)\r
- | L t -> []\r
- | LM(ts,_,id) -> (List.concat (List.map aux ts)) @ (\r
-  let lst = List.assoc id p.matches in\r
-  List.concat (List.map (fun (_,(t1,t2)) -> (aux t1) @ (aux t2)) lst)\r
- )\r
- | B -> []\r
- | P -> []\r
- in Util.sort_uniq (aux t)\r
-;;\r
-\r
-let forget_variable var p =\r
- let p', div = subst_many true (var, P) p p.div in\r
- let p = {p' with conv=p.conv} in\r
- let p, conv = subst_many false (var, B) p p.conv in\r
- let p, matches = subst_in_matches (var, B) p p.matches in\r
- {p with div; conv; matches; sigma=p.sigma}\r
-;;\r
-let rec remove_divergent_discriminators p =\r
- let f = fun (b,(t,_)) -> b && (t = B || is_lambda t) in\r
- try\r
-  let v,l = List.find (fun (_,lst) -> List.exists f lst) p.matches in\r
-  let (_,(_,c)) as entry = List.find f l in\r
-  let l = List.filter ((<>) entry) l in\r
-  let matches = List.map (fun (v', l') -> v', if v' = v then l else l') p.matches in\r
-  let vars = free_vars p c in\r
-  let p = {p with matches} in\r
-  List.fold_right forget_variable vars p\r
- with Not_found -> p\r
-;;\r
-\r
-exception Done;;\r
-\r
-let sanity p =\r
- (* try to fix divergent discriminators *)\r
- let p = remove_divergent_discriminators p in\r
- (* Remove lambdas from conv TODO remove duplicates *)\r
- let div = List.filter (function | P | L _ -> false | _ -> true) p.div in\r
- let conv = List.filter (function | B | V _ | A _ -> true | _ -> false) p.conv in\r
- let p = {p with div;conv} in\r
- (* Sanity checks: *)\r
- if p.div = [] then problem_fail p "p.div converged";\r
- if List.mem B p.conv then problem_fail p "p.conv diverged";\r
- if not (List.for_all (fun (_, lst) -> List.for_all (fun (b,(t,_)) -> is_inert t) lst) p.matches)\r
-  then problem_fail p "Unsolvable discrimination";\r
-\r
- (* unify! :( *)\r
- let p = unify p in\r
- print_endline (string_of_problem p); (* non cancellare *)\r
- if problem_done p then raise Done else p\r
-;;\r
-\r
-let print_cmd s1 s2 = print_endline (">> " ^ s1 ^ " " ^ s2);;\r
-\r
-let ignore var n p =\r
- print_cmd "EAT" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- let rec aux m t =\r
-  if m = 0\r
-   then lift n t\r
-   else L (aux (m-1) t) in\r
- let p, fresh = freshvar p in\r
- let subst = var, aux n (V fresh) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let explode p =\r
- let fv1 = List.concat (List.map (visible_vars p) p.div) in\r
- let fv2 = List.concat (List.map (visible_vars p) p.conv) in\r
- let fv = List.filter (fun x -> not (List.mem x fv2)) fv1 in\r
- let fv = List.filter ((<) p.orig_freshno) fv in\r
- match fv with\r
- | var::_ ->\r
-  print_cmd "EXPLODE" ("on " ^ string_of_t p (V var));\r
-  let subst = var, B in\r
-  sanity (subst_in_problem subst p)\r
- | _ -> problem_fail p "premature explosion"\r
-;;\r
-\r
-let step var p =\r
- print_cmd "STEP" ("on " ^ string_of_t p (V var));\r
- let subst = var, LM([], 0, var) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let id var p =\r
- print_cmd "ID" ("on " ^ string_of_t p (V var));\r
- let subst = var, L(V 0) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let apply var appk p =\r
- print_cmd "APPLY"\r
-  (string_of_t p (V var) ^ " applies no." ^ string_of_int appk ^ " fresh variables");\r
- let rec mk_freshvars n p =\r
-  if n = 0\r
-   then p, []\r
-   else\r
-    let p, vs = mk_freshvars (n-1) p in\r
-    let p, v = freshvar p in\r
-    p, V(v)::vs in\r
- let p, vars = mk_freshvars appk p in\r
- let p, t = mk_apps false p (V 0) (List.map (lift 1) vars) in\r
- let t = L (A (lift 1 (V var), t))  in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let perm var n p =\r
- print_cmd "PERM" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- let p, v = freshvar p in\r
- let rec aux' m t = if m < 0 then t else A(aux' (m-1) t, V m) in\r
- let rec aux m t =\r
-  if m = 0\r
-   then aux' (n-1) t\r
-   else L (aux (m-1) t) in\r
- let t = aux n (lift n (V v)) in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-(* TODO:\r
-- cosi' come e' possibile unificare rami di branch solo se vanno -> a variabili,\r
-  allo stesso modo e' possibile ignorare dei rami se vanno in variabili, e quelle variabili\r
-  vengono sostituite ovunque: con bombe in conv e con pacman in div\r
-*)\r
-let forget var no p =\r
- try\r
-  let l = List.assoc var p.matches in\r
-  let (b,(tm,c)) = List.nth l no in\r
-  let l = List.mapi (fun n x -> if n = no then (b,(B,c)) else x) l in\r
-  let matches = List.map (fun (v,lst) -> v, if v = var then l else lst) p.matches in\r
-  let p = {p with matches} in\r
-  print_cmd "FORGET" (string_of_t p tm ^ " from the match of " ^ string_of_t p (V var));\r
-  sanity p\r
-  (* (match c with\r
-   | V var ->\r
-   print_endline (\r
-    "--- FORGET " ^ string_of_t p tm ^ " from the match of " ^ string_of_t p (V var));\r
-   let p = forget_variable var p in\r
-\r
-   | _ -> print_endline "too late to forget that term"; p\r
-  ) *)\r
- with Failure "nth" ->\r
-  print_endline "wtf?"; p\r
-;;\r
-\r
-let parse strs =\r
- let dummy_p = {orig_freshno=0; freshno=0; div=[]; conv=[]; matches=[]; sigma=[]} in\r
-  let rec aux level = function\r
-  | Parser.Lam t -> L (aux (level + 1) t)\r
-  | Parser.App (t1, t2) ->\r
-   if level = 0 then snd (mk_app false dummy_p (aux level t1) (aux level t2))\r
-    else A(aux level t1, aux level t2)\r
-  | Parser.Var v -> V v\r
-  in let (tms, free) = Parser.parse_many strs\r
-  in (List.map (aux 0) tms, free)\r
-;;\r
-\r
-let rec list_split n =\r
- function\r
- | [] -> [], []\r
- | x::xs as l -> if n = 0 then [], l else let a, b = list_split (n-1) xs in x::a, b\r
-;;\r
-\r
-let magic6 div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div @ conv) in\r
- let div, conv = list_split (List.length div) all_tms in\r
- let varno = List.length var_names in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]} in\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-  let p = subst_in_problem subst p in p\r
-  with Not_found -> p in\r
- let p = sanity p in\r
- try\r
-  problem_fail (List.fold_left (|>) p cmds) "Problem not completed"\r
- with\r
- | Done -> ()\r
-;;\r
-\r
-let interactive div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div @ conv) in\r
- let div, conv = list_split (List.length div) all_tms in\r
- let varno = List.length var_names in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]} in\r
- (* activate bombs *)\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-   subst_in_problem subst p\r
-  with Not_found -> p in\r
- (* activate pacmans *)\r
- let p = try\r
-  let subst = Util.index_of "PACMAN" var_names, P in\r
-   let p = subst_in_problem subst p in\r
-   (print_endline ("after subst in problem " ^ string_of_problem p); p)\r
-  with Not_found -> p in\r
- (* initial sanity check *)\r
- let p = sanity p in\r
- let p = List.fold_left (|>) p cmds in\r
- let rec f p cmds =\r
-  let nth spl n = int_of_string (List.nth spl n) in\r
-  let read_cmd () =\r
-   let s = read_line () in\r
-   let spl = Str.split (Str.regexp " +") s in\r
-   s, let uno = List.hd spl in\r
-    try if uno = "explode" then explode\r
-    else if uno = "ignore" then ignore (nth spl 1) (nth spl 2)\r
-    else if uno = "step" then step (nth spl 1)\r
-    else if uno = "perm" then perm (nth spl 1) (nth spl 2)\r
-    else if uno = "apply" then apply (nth spl 1) (nth spl 2)\r
-    else if uno = "forget" then forget (nth spl 1) (nth spl 2)\r
-    else if uno = "id" then id (nth spl 1)\r
-    else failwith "Wrong input."\r
-    with Failure s -> print_endline s; (fun x -> x) in\r
-  let str, cmd = read_cmd () in\r
-  let cmds = (" " ^ str ^ ";")::cmds in\r
-  try\r
-   let p = cmd p in f p cmds\r
-  with\r
-  | Done -> print_endline "Done! Commands history: "; List.iter print_endline (List.rev cmds)\r
- in f p []\r
-;;\r
-\r
-let _ = magic6\r
- ["x x"]\r
- [ "_. BOMB" ]\r
- [ ignore 1 1; explode ]\r
-;;\r
-\r
- let _ = magic6\r
-  ["x y BOMB b"]\r
-  [ "x BOMB y c" ]\r
-  [ perm 1 3; step 8 ; explode; ];;\r
-\r
-let _ = magic6\r
- ["x BOMB a1 c"]\r
- [ "x y BOMB d"; "x BOMB a2 c" ]\r
- [ perm 1 3 ; step 10 ; step 13; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["x (x x)"]\r
- [ "x x" ; "x x x" ] [\r
- apply 1 1;\r
- step 1;\r
- explode;\r
- step 9;\r
-];;\r
-\r
-let _ = magic6\r
- ["x (_.BOMB)"]\r
- [ "x (_._. BOMB)" ]\r
- [ apply 1 2; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["x (_.y)"]\r
- [ "y (_. x)" ]\r
- [ apply 1 1; ignore 1 1;  explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y (x a1 BOMB c) (x BOMB b1 d)"]\r
- [ "y (x a2 BOMB c) (x BOMB b1 d)";\r
- "y (x a1 BOMB c) (x BOMB b2 d)";] [\r
- perm 2 3;\r
- step 12;\r
- perm 17 2;\r
- step 19;\r
- step 18;\r
- ignore 22 1;\r
- ignore 21 1;\r
- ignore 24 1;\r
- ignore 25 1;\r
- step 1;\r
- step 32;\r
- explode;\r
- ]\r
-;;\r
-\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ apply 2 1; step 3; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y x"]\r
- [ "y (x.x)"; "x (_. BOMB)" ]\r
- [ apply 1 1; ignore 2 1; step 1; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ step 1; explode; apply 2 1; id 2; ignore 3 1; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y (x a)"]\r
- [ "y (x b)"; "x BOMB" ] [\r
- id 2;\r
- step 1;\r
- explode;\r
-];;\r
-\r
-magic6\r
- ["y (x a)"] [ "y (x b)"; "x BOMB"; "y a" ]\r
- [\r
- apply 1 1;\r
- perm 2 2;\r
- ignore 9 1;\r
- step 10;\r
- explode;\r
- ];;\r
-(* "y (a c)"\r
-[ "y (b c)"; "y (x a)"; "y (x b)"; "x BOMB" ]  *)\r
-\r
-magic6\r
-["x a (x (a.y BOMB))"]\r
-[ "x b"; "x (y c)"; "x (y d)" ]\r
-[apply 1 1;\r
-apply 2 1;\r
-explode;]\r
-(* [\r
-step 1;\r
-step 3;\r
-explode' 10;\r
-(* ma si puo' fare anche senza forget *) *)\r
-(* ] *)\r
-;;\r
-\r
-(* dipendente dalla codifica? no, ma si risolve solo con id *)\r
-magic6\r
- ["y a"] ["y b"; "x (y (_.BOMB))"]\r
-[\r
-apply 1 1;\r
-apply 2 1;\r
-explode;\r
-];;\r
- (* [id 1; explode];; *)\r
-\r
-magic6\r
- ["PACMAN (x x x)"] ["PACMAN (x x)"]\r
- [\r
- ignore 2 2;\r
- explode;\r
- ];;\r
-\r
-print_hline();\r
-print_endline "ALL DONE. "\r
diff --git a/ocaml/andrea7.ml b/ocaml/andrea7.ml
deleted file mode 100644 (file)
index 4a27c79..0000000
+++ /dev/null
@@ -1,751 +0,0 @@
-let (++) f g x = f (g x);;\r
-\r
-let print_hline = Console.print_hline;;\r
-\r
-type var = int;;\r
-type t =\r
- | V of var\r
- | A of t * t\r
- | L of t\r
- | B (* bottom *)\r
- | P (* pacman *)\r
- | Stuck of var * int\r
- (* | Ptr of int *)\r
-;;\r
-\r
-let rec consts = (* const_apps, const_lambda *)\r
- let rec aux1 = function\r
- | A(t, _) -> 1 + aux1 t\r
- | _ -> 0 in\r
- let rec aux2 = function\r
- | L t -> 1 + aux2 t\r
- | _ -> 0 in\r
- function\r
- | A(t1, t2) as t ->\r
-    let a1, b1 = consts t1 in\r
-    let a2, b2 = consts t2 in\r
-    max (aux1 t) (max a1 a2), max b1 b2\r
- | L t' as t ->\r
-    let a, b = consts t' in\r
-    a, max (aux2 t) b\r
- | _ -> 0, 0\r
-;;\r
-\r
-\r
-type problem = {\r
-   orig_freshno: int\r
- ; freshno : int\r
- ; div : t\r
- ; conv : t list\r
- ; matches : (var (* variable originating this match *) * ((int (* index of the term to discriminate *) * var option (* continuation *))) list) list\r
- ; sigma : (var * t) list (* substitutions *)\r
- ; stepped : var list\r
- ; arities : (var * int) list\r
- ; k_app : int\r
- ; k_lam : int\r
-}\r
-\r
-let dummy_p = {orig_freshno=0; freshno=0; div=B; conv=[]; matches=[]; sigma=[]; stepped=[]; arities=[]; k_app=0;k_lam=0};;\r
-\r
-let append_conv p t = let len = List.length p.conv in let p = {p with conv=t::p.conv} in p, len;;\r
-let get_conv p n = List.nth p.conv (List.length p.conv - 1 - n);;\r
-let index_of_conv t conv = List.length conv - 1 - (Util.index_of t conv);;\r
-\r
-let eq_conv = (=);;\r
-let eq_conv_indices p i j = eq_conv (get_conv p i) (get_conv p j);;\r
-let all_terms p = p.div :: p.conv;;\r
-\r
-exception Done of (var * t) list (* substitution *);;\r
-exception Fail of int * string;;\r
-\r
-let string_of_t p =\r
-  let bound_vars = ["x"; "y"; "z"; "w"; "q"; "x1"; "x2"; "x3"; "x4"; "x5"] in\r
-  let rec string_of_term_w_pars level = function\r
-    | V v -> if v >= level then "`" ^ string_of_int (v-level) else List.nth bound_vars (level - v-1)\r
-    | A _\r
-    | L _ as t -> "(" ^ string_of_term_no_pars_lam level t ^ ")"\r
-    | B -> "BOT"\r
-    | P -> "PAC"\r
-    | Stuck _ as t -> "(" ^ string_of_term_no_pars_app level t ^ ")"\r
-    (* | Ptr _ as t-> "(" ^ string_of_term_no_pars_app level t ^ ")" *)\r
-    (* "&" ^ string_of_int n *)\r
-  and string_of_term_no_pars_app level = function\r
-    | A(t1,t2) -> (string_of_term_no_pars_app level t1) ^ " " ^ (string_of_term_w_pars level t2)\r
-    | Stuck(v,n) -> ":" ^ string_of_term_no_pars_app level (V v) ^ " " ^ (string_of_term_w_pars level (get_conv p n))\r
-    (* | Ptr n -> string_of_term_no_pars_app level (get_conv p n) *)\r
-    (* | Ptr n -> "&" ^ string_of_int n *)\r
-    | _ as t -> string_of_term_w_pars level t\r
-  and string_of_term_no_pars_lam level = function\r
-    | L t -> "λ" ^ string_of_term_w_pars (level+1) (V 0) ^ ". " ^ (string_of_term_no_pars_lam (level+1) t)\r
-    | _ as t -> string_of_term_no_pars level t\r
-  and string_of_term_no_pars level = function\r
-    | L _ as t -> string_of_term_no_pars_lam level t\r
-    | _ as t -> string_of_term_no_pars_app level t\r
-  in string_of_term_no_pars 0\r
-;;\r
-\r
-let string_of_problem p =\r
- let lines = [\r
-  "[arities] " ^ String.concat " " (List.map (fun (v,n) -> "`" ^ string_of_int v ^ "=" ^ string_of_int n) p.arities);\r
-  "[stepped]" ^ String.concat " " (List.map string_of_int p.stepped);\r
-  "[DV] " ^ (string_of_t p p.div);\r
-  "[CV] " ^ String.concat "\n     " (List.map (string_of_t p) p.conv);\r
-  (* "" ; *)\r
- ] @ Util.concat_map (fun (v, lst) -> ("[<>] of "^(string_of_t p (V v))) :: List.map (fun (n,c) -> "   " ^ string_of_t p (get_conv p n)\r
- ^ (match c with None -> "" | Some v -> " -> " ^ string_of_t p (V v))\r
- ) lst) p.matches @ [""] in\r
- String.concat "\n" lines\r
-;;\r
-\r
-let problem_fail p reason =\r
- print_endline "!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!";\r
- print_endline (string_of_problem p);\r
- raise (Fail (-1, reason))\r
-;;\r
-\r
-let freshvar ({freshno} as p) =\r
- {p with freshno=freshno+1}, freshno+1\r
-;;\r
-\r
-let add_to_match p id t =\r
- let p, entry =\r
-  try\r
-   p, index_of_conv t p.conv\r
-  with\r
-  | Not_found -> append_conv p t in\r
- let entry' = entry, None in\r
- let matches =\r
-  List.map (fun (id',lst as x) -> if id <> id' then x else (id, entry'::lst)) p.matches\r
-  in\r
- {p with matches}, entry\r
-;;\r
-\r
-let var_occurs_in p v =\r
- let rec aux level = function\r
- | V v' -> v + level = v'\r
- | Stuck(v',n) -> assert (v <> v'); aux level (get_conv p n)\r
- | A(t1,t2) -> (aux level t1) || (aux level t2)\r
- | L t -> aux (level+1) t\r
- | B -> false\r
- | P -> false\r
- (* | Ptr n -> aux level (get_conv p n) *)\r
-\r
- in aux 0\r
-;;\r
-\r
-let rec is_inert p =\r
- function\r
- | A(t,_) -> is_inert p t\r
- (* | Ptr n -> is_inert p (get_conv p n) *)\r
- | V _ | Stuck _ -> true\r
- | L _ | B | P -> false\r
-;;\r
-\r
-let is_var = function V _ -> true | _ -> false;;\r
-let is_lambda = function L _ -> true | _ -> false;;\r
-let is_pacman = function P -> true | _ -> false;;\r
-\r
-let rec subst level delift sub p =\r
- function\r
- | V v -> p, if v = level + fst sub then lift level (snd sub) else V (if delift && v > level then v-1 else v)\r
- | L t -> let p, t = subst (level + 1) delift sub p t in p, L t\r
- | A (t1,t2) ->\r
-  let p, t1 = subst level delift sub p t1 in\r
-  let p, t2 = subst level delift sub p t2 in\r
-  if t1 = B || t2 = B then p, B else\r
-  if level = 0 then mk_app p t1 t2 else p, A (t1, t2)\r
- | B -> p, B\r
- | P -> p, P\r
- (* | Ptr _ as t -> p, t *)\r
- | Stuck(v,_) as t ->
-    assert (v <> level + fst sub); (* can't instantiate v twice after a step *)\r
-    (* FIXME!!!! URGENT!!! *)\r
-    p, t\r
-and mk_app p t1 t2 = let t1 = if t1 = P then L P else t1 in match t1 with\r
- | L t1 -> subst 0 true (0, t2) p t1\r
- | V v when List.mem v p.stepped ->\r
-    let p, n = add_to_match p v t2 in\r
-    p, Stuck(v, n)\r
- | B | _ when t2 = B -> p, B\r
- | t1 -> p, A (t1, t2)\r
-and mk_apps p t =\r
- function\r
- | [] -> p, t\r
- | t'::ts -> let p, t = mk_app p t t' in mk_apps p t ts\r
-and lift n =\r
- let rec aux n' =\r
-  function\r
-  | V m -> V (if m >= n' then m + n else m)\r
-  | L t -> L (aux (n'+1) t)\r
-  | A (t1, t2) -> A (aux n' t1, aux n' t2)\r
-  | B -> B\r
-  | P -> P\r
-  | Stuck(m,ptr) -> assert (m >= n'); Stuck(m + n, ptr)\r
-  (* | Ptr _ as t -> t *)\r
- in aux 0\r
-;;\r
-\r
-let subst = subst 0 false;;\r
-\r
-let mk_lambda t = L (lift 1 t) ;;\r
-\r
-let subst_many sub =\r
- let rec aux p = function\r
- | [] -> p, []\r
- | t::tms ->\r
-  let p, tms = aux p tms in\r
-  let p, t = subst sub p t in\r
-  p, t :: tms\r
- in aux\r
-;;\r
-\r
-let subst_in_problem (sub: var * t) (p: problem) =\r
-(* print_endline ("SUBST IN PROBLEM: " ^ string_of_t p (V (fst sub)) ^ " |-> " ^ string_of_t p (snd sub)); *)\r
-(* BUG QUI FIXME!!!! *)\r
- let rec mix l1 l2 = match l1, l2 with\r
- | [], l2 -> l2\r
- | x::xs, _::ys -> x:: (mix xs ys)\r
- | _ -> assert false in\r
- let p, conv = subst_many sub p p.conv in\r
- let p, div = subst sub p p.div in\r
- let conv = List.rev (mix (List.rev conv) (List.rev p.conv)) in\r
- let p = {p with div; conv} in\r
- (* print_endline ("after sub: \n" ^ string_of_problem p); *)\r
- {p with sigma=sub::p.sigma}\r
-;;\r
-\r
-let problem_done p =\r
-  let all_separated = List.for_all (fun (_, lst) -> List.for_all (fun (n,_) -> is_var (get_conv p n)) lst) p.matches in\r
-  all_separated && p.div = B\r
-;;\r
-\r
-let free_vars p t =\r
- let rec aux level = function\r
- | V v -> if v >= level then [v] else []\r
- | A(t1,t2) -> (aux level t1) @ (aux level t2)\r
- | L t -> aux (level+1) t\r
- | B | P\r
- | Stuck _ -> []\r
- (* | Ptr n -> aux 0 (get_conv p n) *)\r
- in Util.sort_uniq (aux 0 t)\r
-;;\r
-\r
-let visible_vars p t =\r
- let rec aux = function\r
- | V v -> [v]\r
- | A(t1,t2) -> (aux t1) @ (aux t2)\r
- | B | P\r
- | Stuck _ | L _ -> []\r
- (* | Ptr n -> aux (get_conv p n) *)\r
- in Util.sort_uniq (aux t)\r
-;;\r
-\r
-(* TODO FIXME *)\r
-let apply_substs p t = t;;\r
-\r
-let unblock var index cont p =\r
- let rec aux p = function\r
- | Stuck(v',n') as t -> p, (if var = v' && index = n' then apply_substs p (V cont) else t)\r
- | A (t1, t2) ->\r
-    let p, t1 = aux p t1 in\r
-    let p, t2 = aux p t2 in\r
-    mk_app p t1 t2\r
- | _ as t -> p, t in\r
- let p, div = aux p p.div in\r
- let _, conv = List.fold_right (fun c (p, conv) -> let p, c = aux p c in p, c::conv) p.conv (p,[]) in\r
- {p with div; conv}\r
-;;\r
-\r
-let rec unblock_all p =\r
- let aux (orig, m) (matches, news, p) =\r
-  let nn = List.filter (fun (n,c) -> is_var (get_conv p n) && c = None) m in\r
-  let p, conts = List.fold_left (fun (p,conts) (n,_) ->\r
-    match Util.find_opt (function (n', c) when eq_conv_indices p n' n -> c | _ -> None) m\r
-    with Some c -> p, (n, c)::conts | None ->\r
-     (* c is the new continuation *)\r
-     let p, c = freshvar p in\r
-     let arity = c, List.assoc orig p.arities - 1 in\r
-     print_endline ("``" ^ string_of_int orig);\r
-     assert ((snd arity) > -1 );\r
-     let p = {p with arities=arity::p.arities} in\r
-     p, (n, c)::conts\r
-   ) (p, []) nn in\r
-  let m = List.map (fun (n,c) -> n, try\r
-   Some (List.assoc n conts)\r
-  with\r
-  | Not_found -> c) m in\r
-  (orig, m) :: matches, (List.map (fun x -> orig, x) conts) @ news, p\r
- in\r
- let matches, news, p = List.fold_right aux p.matches ([],[], p) in\r
- (* FIXPOINT *)\r
- if news <> [] then\r
- let f = List.fold_left (fun f (a,(b,c)) -> f ++ (unblock a b c)) (fun p -> p) news in\r
- unblock_all (f {p with matches}) else p\r
-;;\r
-\r
-let rec simple_explode p =\r
- match p.div with\r
- | V var ->\r
-  let subst = var, B in\r
-  sanity (subst_in_problem subst p)\r
- | _ -> p\r
-\r
-and sanity p =\r
- (* Sanity checks: *)\r
- if (function | P | L _ -> true | _ -> false) p.div then problem_fail p "p.div converged";\r
- if List.mem B p.conv then problem_fail p "p.conv diverged";\r
- if not (List.for_all (fun (_, lst) -> List.for_all (fun (n,_) -> is_inert p (get_conv p n)) lst) p.matches)\r
-  then problem_fail p "Unsolvable discrimination";\r
-\r
- let p = unblock_all p in\r
- print_endline (string_of_problem p); (* non cancellare *)\r
- let p = if problem_done p then raise (Done p.sigma) else p in\r
- let p = if is_var p.div then simple_explode p else p in\r
- p\r
-;;\r
-\r
-let print_cmd s1 s2 = print_endline (">> " ^ s1 ^ " " ^ s2);;\r
-\r
-let rec hd_args t = match t with\r
- | V v -> v, []\r
- | A(t1,t2) -> let a, b = hd_args t1 in a, b @ [t2]\r
- | _ -> -666, []\r
-;;\r
-\r
-let max_arity_of_var v =\r
- let rec aux level =\r
- function\r
- | V _ -> 0\r
- | A _ as t -> print_string (string_of_t dummy_p t); let hd, args = hd_args t in\r
-    let acc = if hd = level + v then List.length args else 0 in\r
-    List.fold_right (max ++ (aux level)) args acc\r
- | L t -> aux (level + 1) t\r
- | Stuck(v,n) -> 0\r
- (* | Ptr n -> assert false *)\r
- | P | B -> 0\r
- in aux 0\r
-;;\r
-\r
-let ignore var n p =\r
- print_cmd "EAT" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- let rec aux m t =\r
-  if m = 0\r
-   then lift n t\r
-   else L (aux (m-1) t) in\r
- let p, fresh = freshvar p in\r
- let subst = var, aux n (V fresh) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-\r
-\r
-let eat var p =\r
- print_cmd "EAT" ("var " ^ string_of_t p (V var));\r
- let rec is_hd v' = function\r
- | A (t,_) -> is_hd v' t\r
- | V v -> v' = v\r
- | _ -> false in\r
- let rec app_length = function\r
- | A (t,_) -> 1 + app_length t\r
- | _ -> 0 in\r
- let rec find_app_no = function\r
- | V _ | L _ | P | B -> 0\r
- | A (t1,t2) as t ->\r
-    max (max (find_app_no t1) (find_app_no t2))\r
-     (if is_hd var t1 then app_length t else 0)\r
- | Stuck _ -> 0\r
- (* | Ptr n -> find_app_no (get_conv p n) *)\r
- in let n = List.fold_right (max ++ find_app_no) (all_terms p) 0 in\r
- let rec aux m t =\r
-  if m = 0\r
-   then lift n t\r
-   else L (aux (m-1) t) in\r
- let p, fresh = freshvar p in\r
- let subst = var, aux n (V fresh) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-(* let explode p =\r
- let fv1 = visible_vars p p.div in\r
- let fv2 = List.concat (List.map (visible_vars p) p.conv) in\r
- let fv = List.filter (fun x -> not (List.mem x fv2)) fv1 in\r
- let fv = List.filter ((<) p.orig_freshno) fv in\r
- match fv with\r
- | var::_ ->\r
-  print_cmd "EXPLODE" ("on " ^ string_of_t p (V var));\r
-  let subst = var, B in\r
-  sanity (subst_in_problem subst p)\r
- | _ -> raise (Fail (-1,"premature explosion"))\r
-;; *)\r
-\r
-(* let step var p =
- print_cmd "STEP" ("on " ^ string_of_t p (V var));
- let matches = (var,[])::p.matches in
- let p = {p with matches;stepped=var::p.stepped} in
- let subst = var, V var in
- sanity (subst_in_problem subst p)\r
-;; *)\r
-\r
-let choose n p =\r
- print_cmd "CHOOSE" ("#" ^ string_of_int n);\r
- let rec aux n t = match t with\r
- | V _ -> 0, t\r
- | A(t1,_) -> let n', t' = aux n t1 in if n = n' then n', t' else n'+1, t\r
- | _ -> assert false\r
- in let n', div = aux n p.div in\r
- if n' <> n then problem_fail p "wrong choose";\r
- let p = {p with div} in\r
- sanity p\r
-;;\r
-\r
-let apply var appk p =\r
- print_cmd "APPLY"\r
-  (string_of_t p (V var) ^ " applies no." ^ string_of_int appk ^ " fresh variables");\r
- let rec mk_freshvars n p =\r
-  if n = 0\r
-   then p, []\r
-   else\r
-    let p, vs = mk_freshvars (n-1) p in\r
-    let p, v = freshvar p in\r
-    p, V(v)::vs in\r
- let p, vars = mk_freshvars appk p in\r
- let p, t = mk_apps p (V 0) (List.map (lift 1) vars) in\r
- let t = L (A (lift 1 (V var), t))  in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let find_arities_after_app p =\r
- let rec aux level n = function\r
- | L t -> assert (n > 0); max_arity_of_var level t :: aux (level+1) (n-1) t\r
- | _ -> Array.to_list (Array.make n 0)\r
- in aux 0\r
-;;\r
-let find_all_first_args_of v =\r
- let rec aux level = function\r
- | L t -> aux (level+1) t\r
- | V _ -> []\r
- | A(V v', t2) -> (if v + level = v' then [t2] else []) @ aux level t2\r
- | A(t1,t2) -> aux level t1 @ aux level t2\r
- | _ -> []\r
- in aux 0\r
-;;\r
-\r
-let step' var p =\r
- let appk = p.k_lam + p.k_app + 1 in\r
- print_cmd "STEP'" ("on " ^ string_of_t p (V var) ^ " and applies no." ^ string_of_int appk ^ " fresh variables");\r
- let p, vars = (* +1 below because of lifting *)\r
-  Array.fold_left (fun (p,vars) _ -> let p, v = freshvar p in p, (v+1)::vars)\r
-   (p, []) (Array.make appk ()) in\r
- let p, t = mk_apps p (V 0) (List.map (fun x -> V x) vars) in\r
-\r
- let first_args = Util.sort_uniq (List.fold_right ((@) ++ (find_all_first_args_of var)) (all_terms p) []) in\r
- let map = List.fold_left (fun acc t -> let acc' = find_arities_after_app p appk t in List.map (fun (x,y) -> max x y) (List.combine acc acc')) (Array.to_list (Array.make appk 0)) first_args in\r
- let arities = List.combine (List.map ((+) (-1)) vars) map in\r
-\r
- (* let p, var' = freshvar p in *)\r
- let p, var' = p, var in\r
- let matches = (var', []) :: p.matches in\r
- let p = {p with matches; stepped=var'::p.stepped; arities=arities@p.arities} in\r
- let t = L (A (lift 1 (V var'), t))  in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let perm var n p =\r
- if n = 1 then p else (\r
- print_cmd "PERM" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- (* let p, v = freshvar p in *)\r
- let p, v = p, var in\r
- let rec aux' m t = if m < 0 then t else A(aux' (m-1) t, V m) in\r
- let rec aux m t =\r
-  if m = 0\r
-   then aux' (n-1) t\r
-   else L (aux (m-1) t) in\r
- let t = aux n (lift n (V v)) in\r
- let subst = var, t in\r
- (* let p = {p with arities=(v, List.assoc var p.arities)::p.arities} in *)\r
- sanity (subst_in_problem subst p)\r
-) ;;\r
-\r
-let free_vars_of_p p =\r
- Util.sort_uniq (Util.concat_map (free_vars p) (all_terms p));;\r
-\r
-let rec applied_vars p = function\r
-| B | P -> []\r
-| L _ -> [] (* ??? *)\r
-| V _ -> []\r
-| A(V v,t2) -> v :: applied_vars p t2\r
-| A(t1,t2) -> applied_vars p t1 @ applied_vars p t2\r
-(* | Ptr n -> applied_vars p (get_conv p n) *)\r
-| Stuck _ -> [] (* ??? *)\r
-;;\r
-\r
-let applied_vars_of_p p =\r
- Util.sort_uniq (Util.concat_map (applied_vars p) (all_terms p));;\r
-\r
-let rec auto p =\r
- let aux f var =\r
-  try\r
-   auto (f var); ()\r
-  with\r
-  | Done _ as d -> raise d\r
-  | Fail(_, s) -> print_endline ("<<< Backtracking because: " ^ s) in\r
- print_endline ">>> auto called";\r
- (* Compute useful free variables *)\r
- let fv = applied_vars_of_p p in\r
- let fv = List.filter (fun v -> not (List.mem v p.stepped)) fv in\r
- List.iter (fun v -> print_string ("@`" ^ string_of_int v)) fv;\r
- let fv0 = List.filter (fun v -> List.assoc v p.arities > 0) fv in (* remove variable with arity left 0, cannot step there *)\r
- if fv0 = [] then (print_endline "warning! empty step fv0"; List.iter (fun v -> print_string ("@`" ^ string_of_int v)) fv);\r
- let permute_and_step p v =\r
-  let step'' problem prm var =\r
-   let problem = perm var prm problem in\r
-   (* let _ = read_line () in *)\r
-   let problem = step' var problem in\r
-   problem in\r
-  let arity = List.assoc v p.arities in\r
-  let _, perms = Array.fold_left (fun (arity, acc) () -> let a = arity + 1 in a, a::acc) (1,[1]) (Array.make (arity-1) ()) in\r
-  List.iter (fun perm -> aux (step'' p perm) v) perms\r
- in\r
- List.iter (permute_and_step p) fv0;\r
- List.iter (aux (fun v -> eat v p)) fv;\r
- (* mancano: applicazioni e choose; ??? *)\r
-;;\r
-\r
-let parse strs =\r
-  let rec aux level = function\r
-  | Parser.Lam t -> L (aux (level + 1) t)\r
-  | Parser.App (t1, t2) ->\r
-   if level = 0 then snd (mk_app dummy_p (aux level t1) (aux level t2))\r
-    else A(aux level t1, aux level t2)\r
-  | Parser.Var v -> V v\r
-  in let (tms, free) = Parser.parse_many strs\r
-  in (List.map (aux 0) tms, free)\r
-;;\r
-\r
-let magic6 div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div :: conv) in\r
- let div, conv = List.hd all_tms, List.tl all_tms in\r
- let varno = List.length var_names in\r
- let k_app, k_lam = List.fold_left (fun (a, b) t -> let a', b' = consts t in max a a', max b b') (0,0) all_tms in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]; stepped=[];k_app;k_lam;arities=[]} in\r
- let fv = Util.sort_uniq (Util.concat_map (free_vars p) all_tms) in\r
- let arities = List.map (fun var -> var, k_app) fv in\r
- let p = {p with arities} in\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-  let p = subst_in_problem subst p in p\r
-  with Not_found -> p in\r
- let p = sanity p in\r
- try\r
-  problem_fail (List.fold_left (|>) p cmds) "Problem not completed"\r
- with\r
- | Done _ -> ()\r
-;;\r
-\r
-let auto div conv =\r
- print_hline ();\r
- let all_tms, var_names = parse (div :: conv) in\r
- let div, conv = List.hd all_tms, List.tl all_tms in\r
- let varno = List.length var_names in\r
- let k_app, k_lam = List.fold_left (fun (a, b) t -> let a', b' = consts t in max a a', max b b') (0,0) all_tms in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]; stepped=[];k_app;k_lam;arities=[]} in\r
- let fv = Util.sort_uniq (Util.concat_map (free_vars p) all_tms) in\r
- let max_arity_of_var_in_p var p =\r
-  1 + List.fold_right (max ++ (max_arity_of_var var)) (all_terms p) 0 in\r
- let arities = List.map (fun var -> var, max_arity_of_var_in_p var p) fv in\r
- let p = {p with arities} in\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-  let p = subst_in_problem subst p in p\r
-  with Not_found -> p in\r
- let p = sanity p in\r
- try\r
-  auto p;\r
-  failwith "auto failed."\r
- with\r
- | Done _ -> print_endline "<<< auto ok >>>"; (* TODO: print and verify substitution *)\r
-;;\r
-\r
-(* let interactive div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div @ conv) in\r
- let div, conv = list_split (List.length div) all_tms in\r
- let varno = List.length var_names in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]} in\r
- (* activate bombs *)\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-   subst_in_problem subst p\r
-  with Not_found -> p in\r
- (* activate pacmans *)\r
- let p = try\r
-  let subst = Util.index_of "PACMAN" var_names, P in\r
-   let p = subst_in_problem subst p in\r
-   (print_endline ("after subst in problem " ^ string_of_problem p); p)\r
-  with Not_found -> p in\r
- (* initial sanity check *)\r
- let p = sanity p in\r
- let p = List.fold_left (|>) p cmds in\r
- let rec f p cmds =\r
-  let nth spl n = int_of_string (List.nth spl n) in\r
-  let read_cmd () =\r
-   let s = read_line () in\r
-   let spl = Str.split (Str.regexp " +") s in\r
-   s, let uno = List.hd spl in\r
-    try if uno = "explode" then explode\r
-    else if uno = "ignore" then ignore (nth spl 1) (nth spl 2)\r
-    else if uno = "step" then step (nth spl 1)\r
-    else if uno = "perm" then perm (nth spl 1) (nth spl 2)\r
-    else if uno = "apply" then apply (nth spl 1) (nth spl 2)\r
-    (* else if uno = "forget" then forget (nth spl 1) (nth spl 2) *)\r
-    else if uno = "id" then id (nth spl 1)\r
-    else failwith "Wrong input."\r
-    with Failure s -> print_endline s; (fun x -> x) in\r
-  let str, cmd = read_cmd () in\r
-  let cmds = (" " ^ str ^ ";")::cmds in\r
-  try\r
-   let p = cmd p in f p cmds\r
-  with\r
-  | Done -> print_endline "Done! Commands history: "; List.iter print_endline (List.rev cmds)\r
- in f p []\r
-;; *)\r
-\r
-let _ = auto\r
- "x x"\r
- [ "_. BOMB" ]\r
- (* [ eat 1 ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
-   "x y BOMB b"\r
- [ "x BOMB y c" ]\r
- (* [ perm 1 3; step' 8 ; eat 4; eat 5; eat 15; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "x BOMB a1 c"\r
- [ "x y BOMB d"; "x BOMB a2 c" ]\r
- (* [ perm 1 3 ; step' 10 ; eat 4; eat 6;  step' 17; eat 3; eat 7; eat 27; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "x (x x)"\r
- [ "x x" ; "x x x" ]\r
- (* [\r
- step' 1;\r
- eat 6; eat 9; eat 13;\r
-]*)\r
-;;\r
-\r
-\r
-(* let _ = auto\r
- "x (_.BOMB)"\r
- [ "x (_._. BOMB)" ]\r
- (* [ apply 1 2; ] *)\r
-;; *)\r
-\r
-\r
-let _ = auto\r
- "x (_.y)"\r
- [ "y (_. x)" ]\r
- (* [ apply 1 1; ignore 1 1;  explode; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "y (x a1 BOMB c) (x BOMB b1 d)"\r
- [ "y (x a2 BOMB c) (x BOMB b1 d)";\r
- "y (x a1 BOMB c) (x BOMB b2 d)";]\r
- (* [perm 2 3;\r
- step 12;\r
- perm 17 2;\r
- step 19;\r
- step 18;\r
- ignore 22 1;\r
- ignore 21 1;\r
- ignore 24 1;\r
- ignore 25 1;\r
- step 1;\r
- step 32;\r
- explode;\r
- ] *)\r
-;;\r
-\r
-(*\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ apply 2 1; step 3; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y x"]\r
- [ "y (x.x)"; "x (_. BOMB)" ]\r
- [ apply 1 1; ignore 2 1; step 1; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ step 1; explode; apply 2 1; id 2; ignore 3 1; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y (x a)"]\r
- [ "y (x b)"; "x BOMB" ] [\r
- id 2;\r
- step 1;\r
- explode;\r
-];;\r
-\r
-magic6\r
- ["y (x a)"] [ "y (x b)"; "x BOMB"; "y a" ]\r
- [\r
- apply 1 1;\r
- perm 2 2;\r
- ignore 9 1;\r
- step 10;\r
- explode;\r
- ];;\r
-(* "y (a c)"\r
-[ "y (b c)"; "y (x a)"; "y (x b)"; "x BOMB" ]  *)\r
-\r
-magic6\r
-["x a (x (a.y BOMB))"]\r
-[ "x b"; "x (y c)"; "x (y d)" ]\r
-[apply 1 1;\r
-apply 2 1;\r
-explode;]\r
-(* [\r
-step 1;\r
-step 3;\r
-explode' 10;\r
-(* ma si puo' fare anche senza forget *) *)\r
-(* ] *)\r
-;;\r
-\r
-(* dipendente dalla codifica? no, ma si risolve solo con id *)\r
-magic6\r
- ["y a"] ["y b"; "x (y (_.BOMB))"]\r
-[\r
-apply 1 1;\r
-apply 2 1;\r
-explode;\r
-];;\r
- (* [id 1; explode];; *)\r
-\r
-magic6\r
- ["PACMAN (x x x)"] ["PACMAN (x x)"]\r
- [\r
- ignore 2 2;\r
- explode;\r
- ];; *)\r
-\r
-print_hline();\r
-print_endline "ALL DONE. "\r
diff --git a/ocaml/andrea8.ml b/ocaml/andrea8.ml
deleted file mode 100644 (file)
index 7fd82eb..0000000
+++ /dev/null
@@ -1,736 +0,0 @@
-let (++) f g x = f (g x);;\r
-\r
-let print_hline = Console.print_hline;;\r
-\r
-type var = int;;\r
-type t =\r
- | V of var\r
- | A of t * t\r
- | L of t\r
- | B (* bottom *)\r
- | P (* pacman *)\r
- (* | Stuck of var * int *)\r
- (* | Ptr of int *)\r
-;;\r
-\r
-let rec consts = (* const_apps, const_lambda *)\r
- let rec aux1 = function\r
- | A(t, _) -> 1 + aux1 t\r
- | _ -> 0 in\r
- let rec aux2 = function\r
- | L t -> 1 + aux2 t\r
- | _ -> 0 in\r
- function\r
- | A(t1, t2) as t ->\r
-    let a1, b1 = consts t1 in\r
-    let a2, b2 = consts t2 in\r
-    max (aux1 t) (max a1 a2), max b1 b2\r
- | L t' as t ->\r
-    let a, b = consts t' in\r
-    a, max (aux2 t) b\r
- | _ -> 0, 0\r
-;;\r
-\r
-\r
-type problem = {\r
-   orig_freshno: int\r
- ; freshno : int\r
- ; div : t\r
- ; conv : t list\r
- ; matches : (var (* variable originating this match *) * ((bool (* coming from div *) * t (* term to discriminate *) * var (* continuation *))) list) list\r
- ; sigma : (var * t) list (* substitutions *)\r
- ; stepped : var list\r
- ; arities : (var * int) list\r
- ; k_app : int\r
- ; k_lam : int\r
-}\r
-\r
-let dummy_p = {orig_freshno=0; freshno=0; div=B; conv=[]; matches=[]; sigma=[]; stepped=[]; arities=[]; k_app=0;k_lam=0};;\r
-\r
-let append_conv p t = let len = List.length p.conv in let p = {p with conv=t::p.conv} in p, len;;\r
-let get_conv p n = List.nth p.conv (List.length p.conv - 1 - n);;\r
-let index_of_conv t conv = List.length conv - 1 - (Util.index_of t conv);;\r
-\r
-let eq_conv = (=);;\r
-let eq_conv_indices p i j = eq_conv (get_conv p i) (get_conv p j);;\r
-let all_terms p = (p.div :: p.conv) @ Util.concat_map (fun (_, lst) -> List.map (fun (_,x,_) -> x) lst) p.matches;;\r
-\r
-exception Done of (var * t) list (* substitution *);;\r
-exception Fail of int * string;;\r
-\r
-let string_of_t p =\r
-  let bound_vars = ["x"; "y"; "z"; "w"; "q"; "x1"; "x2"; "x3"; "x4"; "x5"] in\r
-  let rec string_of_term_w_pars level = function\r
-    | V v -> if v >= level then "`" ^ string_of_int (v-level) else List.nth bound_vars (level - v-1)\r
-    | A _\r
-    | L _ as t -> "(" ^ string_of_term_no_pars_lam level t ^ ")"\r
-    | B -> "BOT"\r
-    | P -> "PAC"\r
-    (* | Stuck _ as t -> "(" ^ string_of_term_no_pars_app level t ^ ")" *)\r
-    (* | Ptr _ as t-> "(" ^ string_of_term_no_pars_app level t ^ ")" *)\r
-    (* "&" ^ string_of_int n *)\r
-  and string_of_term_no_pars_app level = function\r
-    | A(t1,t2) -> (string_of_term_no_pars_app level t1) ^ " " ^ (string_of_term_w_pars level t2)\r
-    (* | Stuck(v,n) -> ":" ^ string_of_term_no_pars_app level (V v) ^ " " ^ (string_of_term_w_pars level (get_conv p n)) *)\r
-    (* | Ptr n -> string_of_term_no_pars_app level (get_conv p n) *)\r
-    (* | Ptr n -> "&" ^ string_of_int n *)\r
-    | _ as t -> string_of_term_w_pars level t\r
-  and string_of_term_no_pars_lam level = function\r
-    | L t -> "λ" ^ string_of_term_w_pars (level+1) (V 0) ^ ". " ^ (string_of_term_no_pars_lam (level+1) t)\r
-    | _ as t -> string_of_term_no_pars level t\r
-  and string_of_term_no_pars level = function\r
-    | L _ as t -> string_of_term_no_pars_lam level t\r
-    | _ as t -> string_of_term_no_pars_app level t\r
-  in string_of_term_no_pars 0\r
-;;\r
-\r
-let string_of_problem p =\r
- let lines = [\r
-  "[arities] " ^ String.concat " " (List.map (fun (v,n) -> "`" ^ string_of_int v ^ "=" ^ string_of_int n) p.arities);\r
-  "[stepped] " ^ String.concat " " (List.map string_of_int p.stepped);\r
-  "[DV] " ^ (string_of_t p p.div);\r
-  "[CV] " ^ String.concat "\n     " (List.map (string_of_t p) p.conv);\r
-  (* "" ; *)\r
- ] @ Util.concat_map (fun (v, lst) -> ("[<>] of "^(string_of_t p (V v))) :: List.map (fun (b,t,c) -> (if b then " * " else "   ") ^ string_of_t p t\r
- ^ " -> " ^ string_of_t p (V c)\r
- ) lst) p.matches @ [""] in\r
- String.concat "\n" lines\r
-;;\r
-\r
-let problem_fail p reason =\r
- print_endline "!!!!!!!!!!!!!!! FAIL !!!!!!!!!!!!!!!";\r
- print_endline (string_of_problem p);\r
- raise (Fail (-1, reason))\r
-;;\r
-\r
-let freshvar ({freshno} as p) =\r
- {p with freshno=freshno+1}, freshno+1\r
-;;\r
-\r
-let add_to_match p id fromdiv t =\r
- let p, v = freshvar p in\r
- let arity = (List.assoc id p.arities) - 1 in\r
- let entry = fromdiv, t, v in\r
- let matches =\r
-  List.map (fun (id',lst as x) -> if id <> id' then x else (id, entry::lst)) p.matches\r
-  in\r
- let arities = (v,arity) :: p.arities in\r
- {p with matches; arities}, V v\r
-;;\r
-\r
-let var_occurs_in p v =\r
- let rec aux level = function\r
- | V v' -> v + level = v'\r
- (* | Stuck(v',n) -> assert (v <> v'); aux level (get_conv p n) *)\r
- | A(t1,t2) -> (aux level t1) || (aux level t2)\r
- | L t -> aux (level+1) t\r
- | B -> false\r
- | P -> false\r
- (* | Ptr n -> aux level (get_conv p n) *)\r
-\r
- in aux 0\r
-;;\r
-\r
-let rec is_inert p =\r
- function\r
- | A(t,_) -> is_inert p t\r
- (* | Ptr n -> is_inert p (get_conv p n) *)\r
- | V _ -> true\r
- | L _ | B | P -> false\r
-;;\r
-\r
-let is_var = function V _ -> true | _ -> false;;\r
-let is_lambda = function L _ -> true | _ -> false;;\r
-let is_pacman = function P -> true | _ -> false;;\r
-\r
-let rec subst level delift fromdiv sub p =\r
- function\r
- | V v -> p, if v = level + fst sub then lift level (snd sub) else V (if delift && v > level then v-1 else v)\r
- | L t -> let p, t = subst (level + 1) delift fromdiv sub p t in p, L t\r
- | A (t1,t2) ->\r
-  let p, t1 = subst level delift fromdiv sub p t1 in\r
-  let p, t2 = subst level delift fromdiv sub p t2 in\r
-  if t1 = B || t2 = B then p, B else\r
-  if level = 0 then mk_app fromdiv p t1 t2 else p, A (t1, t2)\r
- | B -> p, B\r
- | P -> p, P\r
-and mk_app fromdiv p t1 t2 = let t1 = if t1 = P then L P else t1 in match t1 with\r
- | B | _ when t2 = B -> p, B\r
- | L t1 -> subst 0 true fromdiv (0, t2) p t1\r
- | V v when List.mem v p.stepped ->\r
-    let p, x = add_to_match p v fromdiv t2 in\r
-    p, x\r
- | t1 -> p, A (t1, t2)\r
-and mk_apps fromdiv p t =\r
- function\r
- | [] -> p, t\r
- | t'::ts -> let p, t = mk_app fromdiv p t t' in mk_apps fromdiv p t ts\r
-and lift n =\r
- let rec aux n' =\r
-  function\r
-  | V m -> V (if m >= n' then m + n else m)\r
-  | L t -> L (aux (n'+1) t)\r
-  | A (t1, t2) -> A (aux n' t1, aux n' t2)\r
-  | B -> B\r
-  | P -> P\r
- in aux 0\r
-;;\r
-\r
-let subst = subst 0 false;;\r
-\r
-let mk_lambda t = L (lift 1 t) ;;\r
-\r
-let subst_conv sub =\r
- let rec aux p = function\r
- | [] -> p, []\r
- | t::tms ->\r
-  let p, tms = aux p tms in\r
-  let p, t = subst false sub p t in\r
-  p, t :: tms\r
- in aux\r
-;;\r
-\r
-let subst_in_problem (sub: var * t) (p: problem) =\r
-print_endline ("SUBST IN PROBLEM: " ^ string_of_t p (V (fst sub)) ^ " |-> " ^ string_of_t p (snd sub));\r
-(* BUG QUI FIXME!!!! *)\r
- let rec mix l1 l2 = match l1, l2 with\r
- | [], l2 -> l2\r
- | x::xs, _::ys -> x:: (mix xs ys)\r
- | _ -> assert false in\r
- let p = {p with stepped=(fst sub)::p.stepped} in\r
- let p, conv = subst_conv sub p p.conv in\r
- let p, div = subst true sub p p.div in\r
- let conv = List.rev (mix (List.rev conv) (List.rev p.conv)) in\r
- let p = {p with div; conv} in\r
- (* print_endline ("after sub: \n" ^ string_of_problem p); *)\r
- {p with sigma=sub::p.sigma}\r
-;;\r
-\r
-(* FIXME *)\r
-let unify_terms p v1 v2 =\r
- if List.mem v1 p.stepped\r
-  then problem_fail p "The collapse of a match came after too many steps :(";\r
- subst_in_problem (v1, V v2) p\r
-;;\r
-\r
-let rec unify p =\r
- let rec give_duplicates =\r
-  let rec aux' t = function\r
-  | [] -> [], None\r
-  | (b',t',c')::ts -> if t = t' (* FIXME! eta-eq here *) then ts, Some (b',c') else (\r
-   let ts, res = aux' t ts in (b',t',c')::ts, res) in\r
-  let rec aux = function\r
-   | [] -> [], None\r
-   | (b,t,c)::rest -> (\r
-    match aux' t rest with\r
-    | rest, None -> aux rest\r
-    | rest, Some(b',c') -> (b || b', t, c) :: rest, Some(c', c)\r
-    ) in\r
-  function\r
-  | [] -> [], None\r
-  | (orig,branches) :: ms ->\r
-   match aux branches with\r
-   | _, None -> let ms, res = give_duplicates ms in (orig,branches) :: ms, res\r
-   | branches', Some subst -> (orig,branches') :: ms, Some subst in\r
- let matches, vars_to_be_unified = give_duplicates p.matches in\r
- let p = {p with matches=matches} in\r
- match vars_to_be_unified with\r
-  | None -> p\r
-  | Some(t', t) ->\r
-   (* print_endline ("> unify " ^ string_of_t p (t') ^ " with " ^ string_of_t p t); *)\r
-   unify (unify_terms p t' t)\r
-;;\r
-\r
-let problem_done p =\r
- let condition (b, t, cont) =\r
-  (b && t = B) ||\r
-  (not (List.mem cont p.stepped)) ||\r
-  is_var t in\r
- let all_separated = List.for_all (fun (_, lst) -> List.for_all condition lst) p.matches in\r
- all_separated && p.div = B\r
-;;\r
-\r
-let free_vars p t =\r
- let rec aux level = function\r
- | V v -> if v >= level then [v] else []\r
- | A(t1,t2) -> (aux level t1) @ (aux level t2)\r
- | L t -> aux (level+1) t\r
- | B | P -> []\r
- in Util.sort_uniq (aux 0 t)\r
-;;\r
-\r
-let visible_vars p t =\r
- let rec aux = function\r
- | V v -> [v]\r
- | A(t1,t2) -> (aux t1) @ (aux t2)\r
- | B | P\r
- | L _ -> []\r
- (* | Ptr n -> aux (get_conv p n) *)\r
- in Util.sort_uniq (aux t)\r
-;;\r
-\r
-\r
-let rec simple_explode p =\r
- match p.div with\r
- | V var ->\r
-  let subst = var, B in\r
-  sanity (subst_in_problem subst p)\r
- | _ -> p\r
-\r
-and sanity p =\r
- (* Sanity checks: *)\r
- if (function | P | L _ -> true | _ -> false) p.div then problem_fail p "p.div converged";\r
- if List.mem B p.conv then problem_fail p "p.conv diverged";\r
- let solvable (b,t,c) = (b && not (List.mem c p.stepped)) || is_inert p t in\r
- if not (List.for_all (fun (_, lst) -> List.for_all solvable lst) p.matches)\r
-  then problem_fail p "Unsolvable discrimination";\r
-\r
- let p = unify p in\r
- print_endline (string_of_problem p); (* non cancellare *)\r
- let p = if problem_done p then raise (Done p.sigma) else p in\r
- let p = if is_var p.div then simple_explode p else p in\r
- p\r
-;;\r
-\r
-let print_cmd s1 s2 = print_endline (">> " ^ s1 ^ " " ^ s2);;\r
-\r
-let rec hd_args t = match t with\r
- | V v -> v, []\r
- | A(t1,t2) -> let a, b = hd_args t1 in a, b @ [t2]\r
- | _ -> -666, []\r
-;;\r
-\r
-let max_arity_of_var v =\r
- let rec aux level =\r
- function\r
- | V _ -> 0\r
- | A _ as t -> print_string (string_of_t dummy_p t); let hd, args = hd_args t in\r
-    let acc = if hd = level + v then List.length args else 0 in\r
-    List.fold_right (max ++ (aux level)) args acc\r
- | L t -> aux (level + 1) t\r
- | P | B -> 0\r
- in aux 0\r
-;;\r
-\r
-let ignore var n p =\r
- print_cmd "EAT" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- let rec aux m t =\r
-  if m = 0\r
-   then lift n t\r
-   else L (aux (m-1) t) in\r
- let p, fresh = freshvar p in\r
- let subst = var, aux n (V fresh) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-\r
-\r
-let eat var p =\r
- print_cmd "EAT" ("var " ^ string_of_t p (V var));\r
- let rec is_hd v' = function\r
- | A (t,_) -> is_hd v' t\r
- | V v -> v' = v\r
- | _ -> false in\r
- let rec app_length = function\r
- | A (t,_) -> 1 + app_length t\r
- | _ -> 0 in\r
- let rec find_app_no = function\r
- | V _ | L _ | P | B -> 0\r
- | A (t1,t2) as t ->\r
-    max (max (find_app_no t1) (find_app_no t2))\r
-     (if is_hd var t1 then app_length t else 0)\r
- in let n = List.fold_right (max ++ find_app_no) (all_terms p) 0 in\r
- let rec aux m t =\r
-  if m = 0\r
-   then lift n t\r
-   else L (aux (m-1) t) in\r
- let p, fresh = freshvar p in\r
- let subst = var, aux n (V fresh) in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-(* let explode p =\r
- let fv1 = visible_vars p p.div in\r
- let fv2 = List.concat (List.map (visible_vars p) p.conv) in\r
- let fv = List.filter (fun x -> not (List.mem x fv2)) fv1 in\r
- let fv = List.filter ((<) p.orig_freshno) fv in\r
- match fv with\r
- | var::_ ->\r
-  print_cmd "EXPLODE" ("on " ^ string_of_t p (V var));\r
-  let subst = var, B in\r
-  sanity (subst_in_problem subst p)\r
- | _ -> raise (Fail (-1,"premature explosion"))\r
-;; *)\r
-\r
-(* let step var p =
- print_cmd "STEP" ("on " ^ string_of_t p (V var));
- let matches = (var,[])::p.matches in
- let p = {p with matches;stepped=var::p.stepped} in
- let subst = var, V var in
- sanity (subst_in_problem subst p)\r
-;; *)\r
-\r
-let choose n p =\r
- print_cmd "CHOOSE" ("#" ^ string_of_int n);\r
- let rec aux n t = match t with\r
- | V _ -> 0, t\r
- | A(t1,_) -> let n', t' = aux n t1 in if n = n' then n', t' else n'+1, t\r
- | _ -> assert false\r
- in let n', div = aux n p.div in\r
- if n' <> n then problem_fail p "wrong choose";\r
- let p = {p with div} in\r
- sanity p\r
-;;\r
-\r
-let apply var appk p =\r
- print_cmd "APPLY"\r
-  (string_of_t p (V var) ^ " applies no." ^ string_of_int appk ^ " fresh variables");\r
- let rec mk_freshvars n p =\r
-  if n = 0\r
-   then p, []\r
-   else\r
-    let p, vs = mk_freshvars (n-1) p in\r
-    let p, v = freshvar p in\r
-    p, V(v)::vs in\r
- let p, vars = mk_freshvars appk p in\r
- let p, t = mk_apps false p (V 0) (List.map (lift 1) vars) in\r
- let t = L (A (lift 1 (V var), t))  in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let find_arities_after_app p =\r
- let rec aux level n = function\r
- | L t -> assert (n > 0); max_arity_of_var level t :: aux (level+1) (n-1) t\r
- | _ -> Array.to_list (Array.make n 0)\r
- in aux 0\r
-;;\r
-let find_all_first_args_of v =\r
- let rec aux level = function\r
- | L t -> aux (level+1) t\r
- | V _ -> []\r
- | A(V v', t2) -> (if v + level = v' then [t2] else []) @ aux level t2\r
- | A(t1,t2) -> aux level t1 @ aux level t2\r
- | _ -> []\r
- in aux 0\r
-;;\r
-\r
-let step' var p =\r
- let appk = p.k_lam + p.k_app + 1 in\r
- print_cmd "STEP'" ("on " ^ string_of_t p (V var) ^ " and applies no." ^ string_of_int appk ^ " fresh variables");\r
- let p, vars = (* +1 below because of lifting *)\r
-  Array.fold_left (fun (p,vars) _ -> let p, v = freshvar p in p, (v+1)::vars)\r
-   (p, []) (Array.make appk ()) in\r
- let p, t = mk_apps false p (V 0) (List.map (fun x -> V x) vars) in\r
-\r
- let first_args = Util.sort_uniq (List.fold_right ((@) ++ (find_all_first_args_of var)) (all_terms p) []) in\r
- let map = List.fold_left (fun acc t -> let acc' = find_arities_after_app p appk t in List.map (fun (x,y) -> max x y) (List.combine acc acc')) (Array.to_list (Array.make appk 0)) first_args in\r
- let arities = List.combine (List.map ((+) (-1)) vars) map in\r
-\r
- (* let p, var' = freshvar p in *)\r
- let p, var' = p, var in\r
- let matches = (var', []) :: p.matches in\r
- let p = {p with matches; arities=arities@p.arities} in\r
- let t = L (A (lift 1 (V var'), t))  in\r
- let subst = var, t in\r
- sanity (subst_in_problem subst p)\r
-;;\r
-\r
-let perm var n p =\r
- if n = 1 then p else (\r
- print_cmd "PERM" ("on " ^ string_of_t p (V var) ^ " (of:" ^ string_of_int n ^ ")");\r
- (* let p, v = freshvar p in *)\r
- let p, v = p, var in\r
- let rec aux' m t = if m < 0 then t else A(aux' (m-1) t, V m) in\r
- let rec aux m t =\r
-  if m = 0\r
-   then aux' (n-1) t\r
-   else L (aux (m-1) t) in\r
- let t = aux n (lift n (V v)) in\r
- let subst = var, t in\r
- (* let p = {p with arities=(v, List.assoc var p.arities)::p.arities} in *)\r
- sanity (subst_in_problem subst p)\r
-) ;;\r
-\r
-let free_vars_of_p p =\r
- Util.sort_uniq (Util.concat_map (free_vars p) (all_terms p));;\r
-\r
-let rec applied_vars p = function\r
-| B | P -> []\r
-| L _ -> [] (* ??? *)\r
-| V _ -> []\r
-| A(V v,t2) -> v :: applied_vars p t2\r
-| A(t1,t2) -> applied_vars p t1 @ applied_vars p t2\r
-;;\r
-\r
-let applied_vars_of_p p =\r
- Util.sort_uniq (Util.concat_map (applied_vars p) (all_terms p));;\r
-\r
-let rec auto p =\r
- let aux f var =\r
-  try\r
-   auto (f var); ()\r
-  with\r
-  (* | Done _ as d -> raise d *)\r
-  | Fail(_, s) -> print_endline ("<<< Backtracking because: " ^ s) in\r
- print_endline ">>> auto called";\r
- (* Compute useful free variables *)\r
- let fv = applied_vars_of_p p in\r
- let fv = List.filter (fun v -> not (List.mem v p.stepped)) fv in\r
- List.iter (fun v -> print_string ("@`" ^ string_of_int v)) fv;\r
- let fv0 = List.filter (fun v -> List.assoc v p.arities > 0) fv in (* remove variable with arity left 0, cannot step there *)\r
- if fv0 = [] then (print_endline "warning! empty step fv0"; List.iter (fun v -> print_string ("@`" ^ string_of_int v)) fv);\r
- let permute_and_step p v =\r
-  let step'' problem prm var =\r
-   let problem = perm var prm problem in\r
-   (* let _ = read_line () in *)\r
-   let problem = step' var problem in\r
-   problem in\r
-  let arity = List.assoc v p.arities in\r
-  let _, perms = Array.fold_left (fun (arity, acc) () -> let a = arity + 1 in a, a::acc) (1,[1]) (Array.make (arity-1) ()) in\r
-  List.iter (fun perm -> aux (step'' p perm) v) perms\r
- in\r
- List.iter (permute_and_step p) fv0;\r
- List.iter (aux (fun v -> eat v p)) fv;\r
- (* mancano: applicazioni e choose; ??? *)\r
-;;\r
-\r
-let parse strs =\r
-  let rec aux level = function\r
-  | Parser.Lam t -> L (aux (level + 1) t)\r
-  | Parser.App (t1, t2) ->\r
-   if level = 0 then snd (mk_app false dummy_p (aux level t1) (aux level t2))\r
-    else A(aux level t1, aux level t2)\r
-  | Parser.Var v -> V v\r
-  in let (tms, free) = Parser.parse_many strs\r
-  in (List.map (aux 0) tms, free)\r
-;;\r
-\r
-let magic6 div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div :: conv) in\r
- let div, conv = List.hd all_tms, List.tl all_tms in\r
- let varno = List.length var_names in\r
- let k_app, k_lam = List.fold_left (fun (a, b) t -> let a', b' = consts t in max a a', max b b') (0,0) all_tms in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]; stepped=[];k_app;k_lam;arities=[]} in\r
- let fv = Util.sort_uniq (Util.concat_map (free_vars p) all_tms) in\r
- let arities = List.map (fun var -> var, k_app) fv in\r
- let p = {p with arities} in\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-  let p = subst_in_problem subst p in p\r
-  with Not_found -> p in\r
- let p = sanity p in\r
- try\r
-  problem_fail (List.fold_left (|>) p cmds) "Problem not completed"\r
- with\r
- | Done _ -> ()\r
-;;\r
-\r
-let auto div conv =\r
- print_hline ();\r
- let all_tms, var_names = parse (div :: conv) in\r
- let div, conv = List.hd all_tms, List.tl all_tms in\r
- let varno = List.length var_names in\r
- let k_app, k_lam = List.fold_left (fun (a, b) t -> let a', b' = consts t in max a a', max b b') (0,0) all_tms in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]; stepped=[];k_app;k_lam;arities=[]} in\r
- let fv = Util.sort_uniq (Util.concat_map (free_vars p) all_tms) in\r
- let max_arity_of_var_in_p var p =\r
-  1 + List.fold_right (max ++ (max_arity_of_var var)) (all_terms p) 0 in\r
- let arities = List.map (fun var -> var, max_arity_of_var_in_p var p) fv in\r
- let p = {p with arities} in\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-  let p = subst_in_problem subst p in p\r
-  with Not_found -> p in\r
- let p = sanity p in\r
- try\r
-  auto p;\r
-  failwith "auto failed."\r
- with\r
- | Done _ -> print_endline "<<< auto ok >>>"; (* TODO: print and verify substitution *)\r
-;;\r
-\r
-(* let interactive div conv cmds =\r
- print_hline ();\r
- let all_tms, var_names = parse (div @ conv) in\r
- let div, conv = list_split (List.length div) all_tms in\r
- let varno = List.length var_names in\r
- let p = {orig_freshno=varno; freshno=1+varno; div; conv; matches=[]; sigma=[]} in\r
- (* activate bombs *)\r
- let p = try\r
-  let subst = Util.index_of "BOMB" var_names, L B in\r
-   subst_in_problem subst p\r
-  with Not_found -> p in\r
- (* activate pacmans *)\r
- let p = try\r
-  let subst = Util.index_of "PACMAN" var_names, P in\r
-   let p = subst_in_problem subst p in\r
-   (print_endline ("after subst in problem " ^ string_of_problem p); p)\r
-  with Not_found -> p in\r
- (* initial sanity check *)\r
- let p = sanity p in\r
- let p = List.fold_left (|>) p cmds in\r
- let rec f p cmds =\r
-  let nth spl n = int_of_string (List.nth spl n) in\r
-  let read_cmd () =\r
-   let s = read_line () in\r
-   let spl = Str.split (Str.regexp " +") s in\r
-   s, let uno = List.hd spl in\r
-    try if uno = "explode" then explode\r
-    else if uno = "ignore" then ignore (nth spl 1) (nth spl 2)\r
-    else if uno = "step" then step (nth spl 1)\r
-    else if uno = "perm" then perm (nth spl 1) (nth spl 2)\r
-    else if uno = "apply" then apply (nth spl 1) (nth spl 2)\r
-    (* else if uno = "forget" then forget (nth spl 1) (nth spl 2) *)\r
-    else if uno = "id" then id (nth spl 1)\r
-    else failwith "Wrong input."\r
-    with Failure s -> print_endline s; (fun x -> x) in\r
-  let str, cmd = read_cmd () in\r
-  let cmds = (" " ^ str ^ ";")::cmds in\r
-  try\r
-   let p = cmd p in f p cmds\r
-  with\r
-  | Done -> print_endline "Done! Commands history: "; List.iter print_endline (List.rev cmds)\r
- in f p []\r
-;; *)\r
-\r
-let _ = auto\r
- "x x"\r
- [ "_. BOMB" ]\r
- (* [ eat 1 ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
-   "x y BOMB b"\r
- [ "x BOMB y c" ]\r
- (* [ perm 1 3; step' 8 ; eat 4; eat 5; eat 15; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "x BOMB a1 c"\r
- [ "x y BOMB d"; "x BOMB a2 c" ]\r
- (* [ perm 1 3 ; step' 10 ; eat 4; eat 6;  step' 17; eat 3; eat 7; eat 27; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "x (x x)"\r
- [ "x x" ; "x x x" ]\r
- (* [\r
- step' 1;\r
- eat 6; eat 9; eat 13;\r
-]*)\r
-;;\r
-\r
-\r
-(* let _ = auto\r
- "x (_.BOMB)"\r
- [ "x (_._. BOMB)" ]\r
- (* [ apply 1 2; ] *)\r
-;; *)\r
-\r
-\r
-let _ = auto\r
- "x (_.y)"\r
- [ "y (_. x)" ]\r
- (* [ apply 1 1; ignore 1 1;  explode; ] *)\r
-;;\r
-\r
-\r
-let _ = auto\r
- "y (x a1 BOMB c) (x BOMB b1 d)"\r
- [ "y (x a2 BOMB c) (x BOMB b1 d)";\r
- "y (x a1 BOMB c) (x BOMB b2 d)";]\r
- (* [perm 2 3;\r
- step 12;\r
- perm 17 2;\r
- step 19;\r
- step 18;\r
- ignore 22 1;\r
- ignore 21 1;\r
- ignore 24 1;\r
- ignore 25 1;\r
- step 1;\r
- step 32;\r
- explode;\r
- ] *)\r
-;;\r
-\r
-let _ = auto\r
-"PACMAN (x x x)" ["PACMAN (x x)"];;\r
-\r
-(*\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ apply 2 1; step 3; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y x"]\r
- [ "y (x.x)"; "x (_. BOMB)" ]\r
- [ apply 1 1; ignore 2 1; step 1; explode; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["z (y x)"]\r
- [ "z (y (x.x))"; "y (_. BOMB)" ]\r
- [ step 1; explode; apply 2 1; id 2; ignore 3 1; ]\r
-;;\r
-\r
-let _ = magic6\r
- ["y (x a)"]\r
- [ "y (x b)"; "x BOMB" ] [\r
- id 2;\r
- step 1;\r
- explode;\r
-];;\r
-\r
-magic6\r
- ["y (x a)"] [ "y (x b)"; "x BOMB"; "y a" ]\r
- [\r
- apply 1 1;\r
- perm 2 2;\r
- ignore 9 1;\r
- step 10;\r
- explode;\r
- ];;\r
-(* "y (a c)"\r
-[ "y (b c)"; "y (x a)"; "y (x b)"; "x BOMB" ]  *)\r
-\r
-magic6\r
-["x a (x (a.y BOMB))"]\r
-[ "x b"; "x (y c)"; "x (y d)" ]\r
-[apply 1 1;\r
-apply 2 1;\r
-explode;]\r
-(* [\r
-step 1;\r
-step 3;\r
-explode' 10;\r
-(* ma si puo' fare anche senza forget *) *)\r
-(* ] *)\r
-;;\r
-\r
-(* dipendente dalla codifica? no, ma si risolve solo con id *)\r
-magic6\r
- ["y a"] ["y b"; "x (y (_.BOMB))"]\r
-[\r
-apply 1 1;\r
-apply 2 1;\r
-explode;\r
-];;\r
- (* [id 1; explode];; *)\r
-\r
-magic6\r
- ["PACMAN (x x x)"] ["PACMAN (x x)"]\r
- [\r
- ignore 2 2;\r
- explode;\r
- ];; *)\r
-\r
-print_hline();\r
-print_endline "ALL DONE. "\r
diff --git a/ocaml/console.ml b/ocaml/console.ml
deleted file mode 100644 (file)
index 696a74d..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-type fancyobj = <
-  to_string : unit -> string;
-  to_html : unit -> string
->;;
-
-let sepx = "\xe2\xbf\x96";;
-let endx = "\xe2\xbf\x97";;
-
-let socket_name = "/tmp/fancy.log";;
-
-let html_enabled = Sys.file_exists socket_name;;
-
-let socket = let open Unix in
-  if html_enabled
-  then socket PF_UNIX SOCK_STREAM 0
-  else socket PF_INET SOCK_STREAM 0;;
-
-let html_enabled = if html_enabled then
-  try
-    let _ = Unix.connect socket (Unix.ADDR_UNIX socket_name) in true
-  with Unix.Unix_error _ -> false
-  else false
-;;
-
-let cols =
-  let process_output_to_list2 = fun command ->
-    let chan = Unix.open_process_in command in
-    let res = ref ([] : string list) in
-    let rec process_otl_aux () =
-      let e = input_line chan in
-      res := e::!res;
-      process_otl_aux() in
-    try process_otl_aux ()
-    with End_of_file ->
-      let stat = Unix.close_process_in chan in (List.rev !res,stat)
-  in let cmd_to_list command =
-    let (l,_) = process_output_to_list2 command in l
-  in try let lines = cmd_to_list "tput cols" in int_of_string (List.hd (lines))
-  with _ -> 100 (* default value *)
-;;
-
-let writeall s =
-  let _ = Unix.send socket s 0 (String.length s) [] in ()
-;;
-
-let concat ls = (String.concat sepx ls) ^ endx;;
-
-(* HELO message *)
-if html_enabled then
-  writeall(concat["helo"; String.concat " " (Array.to_list Sys.argv)])
-;;
-
-
-(* let logs objs =
-  if html_enabled then (
-    let strs = (List.map (fun x -> x#to_html()) objs) in
-    writeall (concat ("log" :: strs))
-  ); prerr_endline (String.concat " " (List.map (fun x -> x#to_string()) objs))
-;; *)
-
-let html_escape s =
-  let m = [("&", "&amp;"); (">", "&gt;"); ("<", "&lt;"); ("&quot;", "\""); ("&#39;", "'")]
-  in let m = List.map (fun (x,y) -> Str.regexp x, y) m
-  in List.fold_right (fun (x,y) z -> Str.global_replace x y z) m s;; (* FIXME TODO *)
-
-let fancy_of_string s : fancyobj = object
-  method to_string () = s
-  method to_html () = html_escape s
-end;;
-
-let empty = fancy_of_string "";;
-
-let line = ref empty;;
-
-let (/) a b = object
-  method to_string () = a
-  method to_html () = b
-end;;
-
-let (^^) a b = object
-  method to_string () = (a#to_string () ^ "" ^ b#to_string ())
-  method to_html () = a#to_html () ^ " " ^ b#to_html ()
-end;;
-
-(* Output functions on standard output *)
-
-let print_string s =
-  line := !line ^^ fancy_of_string s
-;;
-
-let print_char c =
-  print_string (String.make 1 c)
-;;
-
-(* let print_bytes : bytes -> unit *)
-
-let print_int n =
-  print_string (string_of_int n)
-;;
-
-(* val print_float : float -> unit *)
-
-let print_newline () =
-  if !line <> empty then (
-  Pervasives.print_endline (!line#to_string());
-  if html_enabled then (writeall (concat ["log"; !line#to_html()]));
-  line := empty
-  )
-;;
-
-let print f =
-  line := !line ^^ f
-;;
-
-let print_string_endline f =
-  print (fancy_of_string f); print_newline ()
-;;
-
-let print_endline f =
-  print f; print_newline ()
-;;
-
-let print_hline () =
-  print_newline ();
-  print_endline ( String.make cols '-' / "<hr>")
-;;
-
-let print_heading s =
-  print_newline ();
-  print_endline (("# " ^ s) / ("<h2>" ^ html_escape s ^ "</h2>"))
-;;
-
-let print_bullet f =
-  print_newline ();
-  print_endline (("- " / "<ul><li>") ^^ f ^^ ("" / "</ul>"))
-;;
-
-let print_math s =
-  print_endline ( s / "" );
-  if html_enabled then (writeall (concat ["math"; s]))
-;;
diff --git a/ocaml/console.mli b/ocaml/console.mli
deleted file mode 100644 (file)
index e3b769b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-type fancyobj\r
-\r
-val fancy_of_string: string -> fancyobj\r
-\r
-val (^^) : fancyobj -> fancyobj -> fancyobj\r
-val (/) : string -> string -> fancyobj\r
-\r
-\r
-val print_char : char -> unit\r
-val print_string : string -> unit\r
-val print_string_endline : string -> unit\r
-(* val print_bytes : bytes -> unit *)\r
-val print_int : int -> unit\r
-(* val print_float : float -> unit *)\r
-\r
-val print : fancyobj -> unit\r
-val print_endline : fancyobj -> unit\r
-\r
-val print_newline : unit -> unit\r
-\r
-val print_hline : unit -> unit\r
-val print_heading : string -> unit\r
-val print_bullet : fancyobj -> unit\r
-val print_math : string -> unit\r
diff --git a/ocaml/lambda4.ml b/ocaml/lambda4.ml
deleted file mode 100644 (file)
index 5ff7866..0000000
+++ /dev/null
@@ -1,774 +0,0 @@
-open Util
-open Util.Vars
-open Pure
-open Num
-
-(* exceptions *)
-exception Pacman
-exception Bottom
-exception Lambda
-exception Backtrack of string
-
-(* verbosity *)
-let _very_verbose = false;;
-(** Display measure of every term when printing problem *)
-let _measure_of_terms = false;;
-
-let verbose s =
- if _very_verbose then prerr_endline s
-;;
-
-let convergent_dummy = `N(-1);;
-
-type discriminating_set = (int * nf) list;;
-
-type problem =
- { freshno: int
- ; div: i_var option (* None = bomb *)
- ; conv: i_n_var list (* the inerts that must converge *)
- ; ps: i_n_var list (* the n-th inert must become n *)
- ; sigma: (int * nf) list (* the computed substitution *)
- ; deltas: discriminating_set ref list (* collection of all branches *)
- ; initialSpecialK: int
- ; label : string
- ; var_names : string list (* names of the original free variables *)
-
- ; trail: discriminating_set list list
-};;
-
-let label_of_problem {label} = label;;
-
-let string_of_var l x =
- try
-  List.nth l x
- with Failure "nth" -> "`" ^ string_of_int x
-;;
-let string_of_term p t = print ~l:p.var_names (t :> nf);;
-
-let first bound p var f =
- let p = {p with trail = (List.map (!) p.deltas)::p.trail} in
- let rec aux i =
-  if i > bound then
-   raise (Backtrack ("no more alternatives for " ^ string_of_var p.var_names var))
-  else
-   try
-    f p i
-   with Backtrack s ->
-prerr_endline (">>>>>> BACKTRACK (reason: " ^ s ^") measure=$ ");
-     List.iter (fun (r,l) -> r := l) (List.combine p.deltas (List.hd p.trail)) ;
-prerr_endline("Now trying var="^string_of_var p.var_names var^" i="^string_of_int (i+1));
-     aux (i+1)
- in
-  aux 1
-
-
-let all_terms p =
- (match p.div with None -> [] | Some t -> [(t :> i_n_var)])
- @ p.conv
- @ p.ps
-;;
-
-let measure_of_term, measure_of_terms =
- let rec aux = function
- | `N _ | `Bottom | `Pacman -> 0
- | `Var(_,ar) -> if ar = min_int then 0 else max 0 ar (*assert (ar >= 0); ar*)
- | `Lam(_,t) -> aux t
- | `I(v,args) -> aux (`Var v) + aux_many (Listx.to_list args :> nf list)
- | `Match(u,(_,ar),_,_,args) -> aux (u :> nf) + (if ar <= 0 then 0 else ar - 1) + aux_many (args :> nf list)
- and aux_many tms = List.fold_right ((+) ++ aux) tms 0 in
- (fun t -> aux (t :> nf)), (fun l -> aux_many (l :> nf list))
-;;
-
-let sum_arities p = measure_of_terms (all_terms p)
-
-let problem_measure p = sum_arities p;;
-let string_of_measure = string_of_int;;
-
-let string_of_problem label ({freshno; div; conv; ps; deltas} as p) =
- let aux_measure_terms t = if _measure_of_terms then "(" ^ string_of_int (measure_of_term t) ^ ") " else "" in
- let deltas = String.concat ("\n#  ") (List.map (fun r -> String.concat " <> " (List.map (fun (i,_) -> string_of_int i) !r)) deltas) in
- let l = p.var_names in
- String.concat "\n" ([
-  "";
-  "# DISPLAY PROBLEM (" ^ label ^ ") " ^ "measure=" ^ string_of_measure (problem_measure p);
-  if List.length p.deltas > 1 then (
-   "# Discriminating sets (deltas):\n" ^
-   "#  " ^ deltas
-   ) else "# ";
-  "#";
-  "$" ^ p.label;
-  (match div with None -> "# D" | Some div -> "D " ^ aux_measure_terms div ^ print ~l (div :> nf));
-  ]
-  @ List.map (fun t -> if t = convergent_dummy then "# C" else "C " ^ aux_measure_terms t ^ print ~l (t :> nf)) conv
-  @ List.mapi (fun i t -> string_of_int i ^ " " ^ aux_measure_terms t ^ print ~l (t :> nf)) ps
-  @ [""])
-;;
-
-
-let failwithProblem p reason =
- print_endline (string_of_problem "FAIL" p);
- failwith reason
-;;
-
-let make_fresh_var p arity =
- let freshno = p.freshno + 1 in
- {p with freshno}, `Var(freshno,arity)
-;;
-
-let make_fresh_vars p arities =
- List.fold_right
-  (fun arity (p, vars) -> let p, var = make_fresh_var p arity in p, var::vars)
-  arities
-  (p, [])
-;;
-
-let simple_expand_match ps =
- let rec aux_nob level = function
-  | #i_num_var as t -> (aux_i_num_var level t :> nf)
-  | `Lam(b,t) -> `Lam(b,aux (level+1) t)
-  | `Pacman as t -> t
- and aux level = function
-  | `Bottom as t -> t
-  | #nf_nob as t -> aux_nob level t
- and aux_i_num_var level = function
-  | `Match(u,v,bs_lift,bs,args) as torig ->
-    let (u : i_num_var) = aux_i_num_var level u in
-    bs := List.map (fun (n, x) -> n, aux 0 x) !bs;
-    (try
-       (match u with
-         | #i_n_var as u ->
-            let i = index_of ~eq:eta_eq (lift (-level) u) (ps :> nf list) in (* can raise Not_found *)
-            let t = cast_to_i_num_var (mk_match (`N i) v bs_lift bs (args :> nf list)) in
-            if t <> torig then
-             aux_i_num_var level t
-            else raise Not_found
-         | _ -> raise Not_found)
-      with Not_found ->
-       cast_to_i_num_var (mk_appl (`Match(u,v,bs_lift,bs,[])) (List.map (aux_nob level) args)))
-  | `I(v,args) -> cast_to_i_num_var (mk_appl (`Var v) (List.map (aux_nob level) (Listx.to_list args)))
-  | `N _ | `Var _ as t -> t
- in aux_i_num_var 0
-;;
-
-let fixpoint f =
- let rec aux x = let x' = f x in if x <> x' then aux x' else x in aux
-;;
-
-let rec super_simplify_ps ps =
- fixpoint (List.map (fun x -> cast_to_i_n_var (simple_expand_match ps (x :> i_num_var))))
-;;
-
-let rec super_simplify_ps_with_match ps =
- fixpoint (List.map (cast_to_i_num_var ++ (simple_expand_match ps)))
-;;
-
-let super_simplify ({div; ps; conv} as p) =
-  let ps = super_simplify_ps p.ps p.ps in
-  let conv = super_simplify_ps ps p.conv in
-  let div = option_map (fun div ->
-   let divs = super_simplify_ps p.ps ([div] :> i_n_var list) in
-    List.hd divs) div in
-  {p with div=option_map cast_to_i_var div; ps; conv}
-
-let cast_to_ps_with_match =
- function
-    #i_num_var as y -> (y : i_num_var)
-  | `Bottom | `Pacman -> raise (Backtrack "BOT/PAC in ps")
-  | t ->
-    prerr_endline (print (t :> nf));
-    assert false (* algorithm failed *)
-
-let subst_in_problem x inst ({freshno; div; conv; ps; sigma} as p) =
- let len_ps = List.length ps in
-(*(let l = Array.to_list (Array.init (freshno + 1) string_of_var) in
-prerr_endline ("# INST0: " ^ string_of_var x ^ " := " ^ print ~l inst));*)
- let rec aux_ps ((freshno,acc_ps,acc_new_ps) as acc) =
-  function
-  | [] -> acc
-  | t::todo_ps ->
-(*prerr_endline ("EXPAND t:" ^ print (t :> nf));*)
-     let t = subst false false x inst (t :> nf) in
-(*prerr_endline ("SUBSTITUTED t:" ^ print (t :> nf));*)
-     let freshno,new_t,acc_new_ps =
-      try
-       expand_match (freshno,acc_ps@`Var(max_int/3,-666)::todo_ps,acc_new_ps) t
-      with Pacman | Bottom -> raise (Backtrack "Pacman/Bottom in ps")
-     in
-      aux_ps (freshno,acc_ps@[new_t],acc_new_ps) todo_ps
-
-  (* cut&paste from aux above *)
-  and aux_conv ps ((freshno,acc_conv,acc_new_ps) as acc) =
-   function
-   | [] -> acc
-   | t::todo_conv ->
-   (*prerr_endline ("EXPAND t:" ^ print (t :> nf));*)
-      let t = subst false false x inst (t :> nf) in
-(*prerr_endline ("SUBSTITUTED t:" ^ print (t :> nf));*)
-      let freshno,new_t,acc_new_ps =
-       try
-        expand_match (freshno,ps,acc_new_ps) t
-       with Pacman | Lambda -> freshno,convergent_dummy,acc_new_ps
-          | Bottom -> raise (Backtrack "Bottom in conv") in
-      aux_conv ps (freshno,acc_conv@[new_t],acc_new_ps) todo_conv
-
-  (* cut&paste from aux' above *)
-  and aux_div ps (freshno,acc_new_ps) =
-   function
-   | None -> freshno, None, acc_new_ps
-   | Some t ->
-      let t = subst false false x inst (t :> nf) in
-      try
-       let freshno,new_t,acc_new_ps = expand_match (freshno,ps,acc_new_ps) t in
-        (* backtrack if it is a number or a variable *)
-        match new_t with
-         | `N _   -> raise (Backtrack "div=`N")
-         | `Var _
-         | `I _ as new_t -> freshno, Some(new_t), acc_new_ps
-      with
-       | Bottom -> freshno, None, acc_new_ps
-       | Pacman -> raise (Backtrack "div=PAC")
-
-  and expand_match ((freshno,acc_ps,acc_new_ps) as acc) t =
-   match t with
-   | `Match(u',orig,bs_lift,bs,args) ->
-        let freshno,u,acc_new_ps = expand_match acc (u' :> nf) in
-        let acc_new_ps,i =
-         match u with
-         | `N i -> acc_new_ps,i
-         | _ ->
-            let ps = List.map (fun t -> cast_to_ps_with_match (subst false false x inst (t:> nf))) (acc_ps@acc_new_ps) in
-            let super_simplified_ps = super_simplify_ps_with_match ps ps in
-(*prerr_endline ("CERCO u:" ^ print (fst u :> nf));
-List.iter (fun x -> prerr_endline ("IN: " ^ print (fst x :> nf))) ps;
-List.iter (fun x -> prerr_endline ("IN2: " ^ print (fst x :> nf))) super_simplified_ps;*)
-            match index_of_opt ~eq:eta_eq super_simplified_ps (u :> i_num_var) with
-               Some i -> acc_new_ps, i
-             | None -> acc_new_ps@[u], len_ps + List.length acc_new_ps
-        in
-         let freshno=
-          if List.exists (fun (j,_) -> i=j) !bs then
-           freshno
-          else
-           let freshno,v = freshno+1, `Var (freshno+1, -666) in (* make_fresh_var freshno in *)
-           bs := !bs @ [i, v] ;
-           freshno in
-(*prerr_endlie ("t DA RIDURRE:" ^ print (`Match(`N i,arity,bs_lift,bs,args) :> nf) ^ " more_args=" ^ string_of_int more_args);*)
-         let t = mk_match (`N i) orig bs_lift bs (args :> nf list) in
-(*prerr_endline ("NUOVO t:" ^ print (fst t :> nf) ^ " more_args=" ^ string_of_int (snd t));*)
-          expand_match (freshno,acc_ps,acc_new_ps) t
-   | `Lam _ -> raise Lambda (* assert false (* algorithm invariant/loose typing *) *)
-   | `Bottom -> raise Bottom
-   | `Pacman -> raise Pacman
-   | #i_n_var as x ->
-      let x = simple_expand_match (acc_ps@acc_new_ps) x in
-      freshno,cast_to_i_n_var x,acc_new_ps in
-
- let freshno,old_ps,new_ps = aux_ps (freshno,[],[]) ps in
- let freshno,conv,new_ps = aux_conv old_ps (freshno,[],new_ps) conv in
- let freshno,div,new_ps = aux_div old_ps (freshno,new_ps) (div :> i_num_var option) in
-
- let ps = List.map cast_to_i_n_var (old_ps @ new_ps) in
- let conv = List.map cast_to_i_n_var conv in
- let p = {p with freshno; div; conv; ps} in
- prerr_endline ("# INST: " ^ string_of_var p.var_names x ^ " := " ^ string_of_term p inst);
- ( (* check if double substituting a variable *)
-  if List.exists (fun (x',_) -> x = x') sigma
-   then failwithProblem p ("Variable "^ string_of_var p.var_names x ^"replaced twice")
- );
- let p = {p with sigma = sigma@[x,inst]} in
- let p = super_simplify p in
- prerr_endline (string_of_problem "instantiate" p);
- p
-;;
-
-exception TriggerMatchReduction of int;;
-exception Dangerous;;
-
-let arity_of arities hd =
- let pos,_,nargs = List.find (fun (_,hd',_) -> hd=hd') arities in
- nargs + if pos = -1 then - 1 else 0
-;;
-
-let rec dangerous arities showstoppers =
- function
-    `N _
-  | `Var _
-  | `Lam _
-  | `Pacman -> ()
-  | `Match(t,_,liftno,bs,args) ->
-      (* CSC: XXX partial dependency on the encoding *)
-      (match t with
-          `N _ -> List.iter (dangerous arities showstoppers) args
-        | `Match _ as t -> dangerous arities showstoppers t ; List.iter (dangerous arities showstoppers) args
-        | `Var(x,_) -> dangerous_inert arities showstoppers x args 2
-        | `I((x,_),args') -> dangerous_inert arities showstoppers x (Listx.to_list args' @ args) 2
-      )
-  | `I((k,_),args) -> dangerous_inert arities showstoppers k (Listx.to_list args) 0
-
-and dangerous_inert arities showstoppers k args more_args =
- List.iter (dangerous arities showstoppers) args ;
- if List.mem k showstoppers then raise Dangerous else
- try
-  let arity = arity_of arities k in
-  if List.length args + more_args > arity then raise Dangerous else ()
- with
-  Not_found -> ()
-
-(* cut & paste from above *)
-let rec dangerous_conv p arities showstoppers =
- function
-  | `N _
-  | `Var _
-  | `Lam _
-  | `Pacman -> ()
-  | `Match(t,_,liftno,bs,args) -> (
-      (* CSC: XXX partial dependency on the encoding *)
-       try (match t with
-        | `N _ -> List.iter (dangerous_conv p arities showstoppers) args
-        | `Match _ as t -> dangerous_conv p arities showstoppers t; List.iter (dangerous_conv p arities showstoppers) args
-        | `Var(x,_) -> dangerous_inert_conv p arities showstoppers x [] args 2
-        | `I((x,_),args') -> dangerous_inert_conv p arities showstoppers x (Listx.to_list args') args 2
-        ) with TriggerMatchReduction x -> (
-           match Util.find_opt (fun (n, t) -> if hd_of (List.nth p.ps n) = Some x then Some t else None) !bs with
-            | None -> ()
-            | Some t -> (
-               match t with
-                | `Bottom -> raise Dangerous
-                | #nf_nob as t -> dangerous_conv p arities showstoppers t
-               )
-           )
-       )
-  | `I((k,_),args) -> dangerous_inert_conv p arities showstoppers k (Listx.to_list args) [] 0
-
-and dangerous_inert_conv p arities showstoppers k args match_args more_args =
- let all_args = args @ match_args in
- List.iter (dangerous_conv p arities showstoppers) all_args;
- let all_args = (all_args :> nf list) in
- if List.mem k showstoppers then raise Dangerous else
-  try
-   let arity = arity_of arities k in
-prerr_endline ("dangerous_inert_conv: ar=" ^ string_of_int arity ^ " k="^string_of_var p.var_names k ^ " listlenargs=" ^ (string_of_int (List.length args)) ^ " more_args=" ^ string_of_int more_args);
-   if more_args > 0 (* match argument*) && List.length args = arity then raise (TriggerMatchReduction k)
-    else if List.length all_args + more_args > arity then raise Dangerous else ()
-  with
-   Not_found -> ()
-
-(* inefficient algorithm *)
-let rec edible p arities showstoppers =
- let rec aux f showstoppers tms = function
-   | [] -> showstoppers
-   | x::xs when List.exists (fun y -> hd_of x = Some y) showstoppers ->
-      (* se la testa di x e' uno show-stopper *)
-      let new_showstoppers = sort_uniq (showstoppers @ free_vars (x :> nf)) in
-      (* aggiungi tutte le variabili libere di x *)
-      if List.length showstoppers <> List.length new_showstoppers then
-       aux f new_showstoppers tms tms
-      else
-       aux f showstoppers tms xs
-   | x::xs ->
-      match hd_of x with
-         None -> aux f showstoppers tms xs
-       | Some h ->
-          try
-           f showstoppers (x :> nf_nob) ;
-           aux f showstoppers tms xs
-          with
-           Dangerous ->
-            aux f (sort_uniq (h::showstoppers)) tms tms
-  in
-   let showstoppers = sort_uniq (aux (dangerous arities) showstoppers p.ps p.ps) in
-   let dangerous_conv = sort_uniq (aux (dangerous_conv p arities) showstoppers p.conv p.conv) in
-
-(* prerr_endline ("dangerous_conv lenght:" ^ string_of_int (List.length dangerous_conv));
-List.iter (fun l -> prerr_endline (String.concat " " (List.map (string_of_var p.var_names) l))) dangerous_conv; *)
-
-    let showstoppers' = showstoppers @ dangerous_conv in
-    let showstoppers' = sort_uniq (match p.div with
-     | None -> showstoppers'
-     | Some div ->
-       if List.exists ((=) (hd_of_i_var div)) showstoppers'
-       then showstoppers' @ free_vars (div :> nf) else showstoppers') in
-    if showstoppers <> showstoppers' then edible p arities showstoppers' else showstoppers', dangerous_conv
-;;
-
-let precompute_edible_data {ps; div} xs =
- let aux t = match t with `Var _ -> 0 | `I(_, args) -> Listx.length args | `N _ -> assert false in
- (fun l -> match div with
-  | None -> l
-  | Some div -> (-1, hd_of_i_var div, aux div) :: l)
-  (List.map (fun hd ->
-   let i, tm = Util.findi (fun y -> hd_of y = Some hd) ps in
-    i, hd, aux tm
-   ) xs)
-;;
-
-(** Returns (p, showstoppers_step, showstoppers_eat) where:
-    - showstoppers_step are the heads occurring twice
-      in the same discriminating set
-    - showstoppers_eat are the heads in ps having different number
-      of arguments *)
-let critical_showstoppers p =
-  let p = super_simplify p in
-  let hd_of_div = match p.div with None -> [] | Some t -> [hd_of_i_var t] in
-  let showstoppers_step =
-  concat_map (fun bs ->
-    let heads = List.map (fun (i,_) -> List.nth p.ps i) !bs in
-    let heads = List.sort compare (hd_of_div @ filter_map hd_of heads) in
-    snd (split_duplicates heads)
-    ) p.deltas @
-     if List.exists (fun t -> [hd_of t] = List.map (fun x -> Some x) hd_of_div) p.conv
-     then hd_of_div else [] in
-  let showstoppers_step = sort_uniq showstoppers_step in
-  let showstoppers_eat =
-   let heads_and_arities =
-    List.sort (fun (k,_) (h,_) -> compare k h)
-     (filter_map (function `Var(k,_) -> Some (k,0) | `I((k,_),args) -> Some (k,Listx.length args) | _ -> None ) p.ps) in
-   let rec multiple_arities =
-    function
-       []
-     | [_] -> []
-     | (x,i)::(y,j)::tl when x = y && i <> j ->
-         x::multiple_arities tl
-     | _::tl -> multiple_arities tl in
-   multiple_arities heads_and_arities in
-
-  let showstoppers_eat = sort_uniq showstoppers_eat in
-  let showstoppers_eat = List.filter
-    (fun x -> not (List.mem x showstoppers_step))
-    showstoppers_eat in
-  List.iter (fun v -> prerr_endline ("DANGEROUS STEP: " ^ (string_of_var p.var_names) v)) showstoppers_step;
-  List.iter (fun v -> prerr_endline ("DANGEROUS EAT: " ^ (string_of_var p.var_names) v)) showstoppers_eat;
-  p, showstoppers_step, showstoppers_eat
-  ;;
-
-let eat p =
-  let ({ps} as p), showstoppers_step, showstoppers_eat = critical_showstoppers p in
-  let showstoppers = showstoppers_step @ showstoppers_eat in
-  let heads = List.sort compare (filter_map hd_of ps) in
-  let arities = precompute_edible_data p (uniq heads) in
-  let inedible, showstoppers_conv = edible p arities showstoppers in
-  let l = List.filter (fun (_,hd,_) -> not (List.mem hd inedible)) arities in
-  let p =
-  List.fold_left (fun p (pos,hd,nargs) -> if pos = -1 then p else
-   let v = `N pos in
-   let inst = make_lams v nargs in
-prerr_endline ("# [INST_IN_EAT] eating: " ^ string_of_var p.var_names hd ^ " := " ^ string_of_term p inst);
-   { p with sigma = p.sigma @ [hd,inst] }
-   ) p l in
-  (* to avoid applied numbers in safe positions that
-     trigger assert failures subst_in_problem x inst p*)
- let ps =
-  List.map (fun t ->
-   try
-    let j,_,_ = List.find (fun (_,hd,_) -> hd_of t = Some hd) l in
-    `N j
-   with Not_found -> t
-  ) ps in
- let p = match p.div with
-  | None -> p
-  | Some div ->
-   if List.mem (hd_of_i_var div) inedible
-   then p
-   else
-    let n = match div with `I(_,args) -> Listx.length args | `Var _ -> 0 in
-    let x = hd_of_i_var div in
-    let inst = make_lams `Bottom n in
-    subst_in_problem x inst p in
-(*let dangerous_conv = showstoppers_conv in
-prerr_endline ("dangerous_conv lenght:" ^ string_of_int (List.length dangerous_conv));
-List.iter (fun l -> prerr_endline (String.concat " " (List.map (string_of_var p.var_names) l))) dangerous_conv; *)
- let conv =
-   List.map (function t ->
-    try
-     if let hd = hd_of t in hd <> None && not (List.mem (Util.option_get hd) showstoppers_conv) then t else (
-     (match t with | `Var _ -> raise Not_found | _ -> ());
-     let _ = List.find (fun h -> hd_of t = Some h) inedible in
-      t)
-    with Not_found -> match hd_of t with
-     | None -> assert (t = convergent_dummy); t
-     | Some h ->
-      prerr_endline ("FREEZING " ^ string_of_var p.var_names h);
-      convergent_dummy
-   ) p.conv in
- List.iter
-  (fun bs ->
-    bs :=
-     List.map
-      (fun (n,t as res) ->
-        match List.nth ps n with
-           `N m -> m,t
-         | _ -> res
-      ) !bs
-  ) p.deltas ;
- let old_conv = p.conv in
- let p = { p with ps; conv } in
- if l <> [] || old_conv <> conv
-  then prerr_endline (string_of_problem "eat" p);
- if List.for_all (function `N _ -> true | _ -> false) ps && p.div = None then
-  `Finished p
- else
-  `Continue p
-
-
-let safe_arity_of_var p x =
- (* Compute the minimum number of arguments when x is in head
-    position at p.div or p.ps *)
- let aux = function
- | `Var(y,_) -> if x = y then 0 else max_int
- | `I((y,_),args) -> if x = y then Listx.length args else max_int
- | _ -> max_int in
- let tms = ((match p.div with None -> [] | Some t -> [(t :> i_n_var)]) @ p.ps) in
- List.fold_left (fun acc t -> Pervasives.min acc (aux t)) max_int tms
-;;
-
-let instantiate p x perm =
- let n = (prerr_endline ("WARNING: using constant initialSpecialK=" ^ string_of_int p.initialSpecialK)); p.initialSpecialK in
- let arities = Array.to_list (Array.make (n+1) min_int) in
- let p,vars = make_fresh_vars p arities in
- (* manual lifting of vars by perm in next line *)
- let vars = List.map (function `Var (n,ar) -> `Var (n+perm,ar)) vars in
- let args = Listx.from_list vars in
- let bs = ref [] in
- (* other_vars are the variables which are delayed and re-applied to the match *)
- let other_vars = Array.mapi (fun n () -> `Var(n+1,min_int)) (Array.make (perm-1) ()) in
- let other_vars = Array.to_list other_vars in
- (* 666, since it will be replaced anyway during subst: *)
- let inst = `Match(`I((0,min_int),args),(x,-666),perm,bs,other_vars) in
- (* Add a number of 'perm' leading lambdas *)
- let inst = Array.fold_left (fun t () -> `Lam(false, t)) inst (Array.make perm ()) in
- let p = {p with deltas=bs::p.deltas} in
- subst_in_problem x inst p
-;;
-
-let compute_special_k tms =
- let rec aux k (t: nf) = Pervasives.max k (match t with
- | `Lam(b,t) -> aux (k + if b then 1 else 0) t
- | `I(n, tms) -> Listx.max (Listx.map (aux 0) (tms :> nf Listx.listx))
- | `Match(t, _, liftno, bs, args) ->
-     List.fold_left max 0 (List.map (aux 0) ((t :> nf)::(args :> nf list)@List.map snd !bs))
- | `N _
- | `Bottom
- | `Pacman
- | `Var _ -> 0
- ) in
- let rec aux' top t = match t with
- | `Lam(_,t) -> aux' false t
- | `I((_,ar), tms) -> max ar
-     (Listx.max (Listx.map (aux' false) (tms :> nf Listx.listx)))
- | `Match(t, _, liftno, bs, args) ->
-     List.fold_left max 0 (List.map (aux' false) ((t :> nf)::(args :> nf list)@List.map snd !bs))
- | `N _
- | `Bottom
- | `Pacman
- | `Var _ -> 0 in
- Listx.max (Listx.map (aux 0) tms) + Listx.max (Listx.map (aux' true) tms)
-;;
-
-let choose_step p =
- let p, showstoppers_step, showstoppers_eat = critical_showstoppers p in
- let x =
-  match showstoppers_step, showstoppers_eat with
-  | [], y::_ ->
-     prerr_endline ("INSTANTIATING (critical eat) : " ^ string_of_var p.var_names y); y
-  | x::_, _ ->
-     prerr_endline ("INSTANTIATING (critical step): " ^ string_of_var p.var_names x); x
-  | [], [] ->
-     let heads =
-      (* Choose only variables still alive (with arity > 0) *)
-      List.sort compare (filter_map (
-       fun t -> match t with `Var _ -> None | x -> if arity_of_hd x <= 0 then None else hd_of x
-      ) ((match p.div with Some t -> [(t :> i_n_var)] | _ -> []) @ p.ps)) in
-     (match heads with
-      | [] ->
-         (try
-           fst (List.find (((<) 0) ++ snd) (concat_map free_vars' (p.conv :> nf list)))
-          with
-           Not_found -> assert false)
-      | x::_ ->
-         prerr_endline ("INSTANTIATING TO EAT " ^ string_of_var p.var_names x);
-         x) in
- let arity_of_x = Util.option_get (max_arity_tms x (all_terms p)) in
- let safe_arity_of_x = safe_arity_of_var p x in
- x, min arity_of_x safe_arity_of_x
-;;
-
-let rec auto_eat p =
- prerr_endline "{{{{{{{{ Computing measure before auto_instantiate }}}}}}";
- let m = problem_measure p in
- let x, arity_of = choose_step p in
- first arity_of p x (fun p j ->
-  let p' = instantiate p x j in
-  match eat p' with
-  | `Finished p -> p
-  | `Continue p ->
-      prerr_endline "{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}";
-      let delta = problem_measure p - m in
-      if delta >= 0
-       then
-        (failwith
-        ("Measure did not decrease (+=" ^ string_of_int delta ^ ")"))
-       else prerr_endline ("$ Measure decreased: " ^ string_of_int delta);
-      auto_eat p)
-;;
-
-let auto p n =
-prerr_endline ("@@@@ FIRST INSTANTIATE PHASE (" ^ string_of_int n ^ ") @@@@");
- match eat p with
- | `Finished p -> p
- | `Continue p -> auto_eat p
-;;
-
-
-(******************************************************************************)
-
-let optimize_numerals p =
-  let replace_in_sigma perm =
-    let rec aux = function
-    | `N n -> `N (List.nth perm n)
-    | `Pacman
-    | `I _ -> assert false
-    | `Var _ as t -> t
-    | `Lam(v,t) -> `Lam(v, aux t)
-    | `Match(_,_,_,bs,_) as t -> (bs := List.map (fun (n,t) -> (List.nth perm n, t)) !bs); t
-    | `Bottom as t -> t
-    in List.map (fun (n,t) -> (n,aux t))
-  in
-  let deltas' = List.mapi (fun n d -> (n, List.map fst !d)) p.deltas in
-  let maxs = Array.to_list (Array.init (List.length deltas') (fun _ -> 0)) in
-  let max = List.fold_left max 0 (concat_map snd deltas') in
-  let perm,_ = List.fold_left (fun (perm, maxs) (curr_n:int) ->
-      let containing = filter_map (fun (i, bs) -> if List.mem curr_n bs then Some i else None) deltas' in
-      (* (prerr_endline (string_of_int curr_n ^ " occurs in: " ^ (String.concat " " (List.map string_of_int containing)))); *)
-      let neww = List.fold_left Pervasives.max 0 (List.mapi (fun n max -> if List.mem n containing then max else 0) maxs) in
-      let maxs = List.mapi (fun i m -> if List.mem i containing then neww+1 else m) maxs in
-      (neww::perm, maxs)
-    ) ([],maxs) (Array.to_list (Array.init (max+1) (fun x -> x))) in
-  replace_in_sigma (List.rev perm) p.sigma
-;;
-
-let env_of_sigma freshno sigma =
- let rec aux n =
-  if n > freshno then
-   []
-  else
-   let e = aux (n+1) in
-   (try
-    e,Pure.lift (-n-1) (snd (List.find (fun (i,_) -> i = n) sigma)),[]
-   with
-    Not_found -> ([],Pure.V n,[]))::e
- in aux 0
-;;
-(* ************************************************************************** *)
-
-type response = [
- | `CompleteSeparable of string
- | `CompleteUnseparable of string
- | `Uncomplete
-]
-
-type result = [
- `Complete | `Uncomplete
-] * [
- | `Separable of (int * Num.nf) list
- | `Unseparable of string
-]
-
-let run p =
- Console.print_hline();
- prerr_endline (string_of_problem "main" p);
- let p_finale = auto p p.initialSpecialK in
- let freshno,sigma = p_finale.freshno, p_finale.sigma in
- prerr_endline ("------- <DONE> ------ measure=. \n ");
- List.iter (fun (x,inst) -> prerr_endline (string_of_var p_finale.var_names x ^ " := " ^ string_of_term p_finale inst)) sigma;
-
- prerr_endline "---------<OPT>----------";
- let sigma = optimize_numerals p_finale in (* optimize numerals *)
- List.iter (fun (x,inst) -> prerr_endline (string_of_var p_finale.var_names x ^ " := " ^ string_of_term p_finale inst)) sigma;
-
- prerr_endline "---------<PURE>---------";
- let scott_of_nf t = ToScott.scott_of_nf (t :> nf) in
- let div = option_map scott_of_nf p.div in
- let conv = List.map scott_of_nf p.conv in
- let ps = List.map scott_of_nf p.ps in
-
- let sigma' = List.map (fun (x,inst) -> x, ToScott.scott_of_nf inst) sigma in
- let e' = env_of_sigma freshno sigma' in
-
- prerr_endline "--------<REDUCE>---------";
- (function Some div ->
-  print_endline (Pure.print div);
-  let t = Pure.mwhd (e',div,[]) in
-  prerr_endline ("*:: " ^ (Pure.print t));
-  assert (t = Pure.B)
- | None -> ()) div;
- List.iter (fun n ->
-   verbose ("_::: " ^ (Pure.print n));
-   let t = Pure.mwhd (e',n,[]) in
-   verbose ("_:: " ^ (Pure.print t));
-   assert (t <> Pure.B)
- ) conv ;
- List.iteri (fun i n ->
-   verbose ((string_of_int i) ^ "::: " ^ (Pure.print n));
-   let t = Pure.mwhd (e',n,[]) in
-   verbose ((string_of_int i) ^ ":: " ^ (Pure.print t));
-   assert (t = Scott.mk_n i)
- ) ps ;
- prerr_endline "-------- </DONE> --------";
- p_finale.sigma
-;;
-
-let solve (p, todo) =
- let completeness, to_run =
-  match todo with
-   | `CompleteUnseparable s -> `Complete, `False s
-   | `CompleteSeparable _ -> `Complete, `True
-   | `Uncomplete -> `Uncomplete, `True in
- completeness, match to_run with
-  | `False s -> `Unseparable s
-  | `True ->
-      try
-       `Separable (run p)
-      with
-       Backtrack _ -> `Unseparable "backtrack"
-;;
-
-let no_bombs_pacmans p =
-    not (List.exists (eta_subterm `Bottom) (p.ps@p.conv))
- && not (List.exists (eta_subterm `Pacman) p.ps)
- && Util.option_map (eta_subterm `Pacman) p.div <> Some true
-;;
-
-let check p =
- if (let rec f = function
-     | [] -> false
-     | hd::tl -> List.exists (eta_eq hd) tl || f tl in
-   f p.ps) (* FIXME what about initial fragments of numbers? *)
-  then `CompleteUnseparable "ps contains duplicates"
- (* check if div occurs somewhere in ps@conv *)
- else if (match p.div with
-  | None -> true
-  | Some div -> not (List.exists (eta_subterm div) (p.ps@p.conv))
-  ) && no_bombs_pacmans p
-  then `CompleteSeparable "no bombs, pacmans and div"
-  (* il check seguente e' spostato nel parser e lancia un ParsingError *)
- (* else if false (* TODO bombs or div fuori da lambda in ps@conv *)
-  then `CompleteUnseparable "bombs or div fuori da lambda in ps@conv" *)
- else if p.div = None
-  then `CompleteSeparable "no div"
- else `Uncomplete
-;;
-
-let problem_of (label, div, conv, ps, var_names) =
- (* TODO: replace div with bottom in problem??? *)
- let all_tms = (match div with None -> [] | Some div -> [(div :> i_n_var)]) @ ps @ conv in
- if all_tms = [] then failwith "problem_of: empty problem";
- let initialSpecialK = compute_special_k (Listx.from_list (all_tms :> nf list)) in
- let freshno = List.length var_names in
- let deltas =
-  let dummy = `Var (max_int / 2, -666) in
-   [ ref (Array.to_list (Array.init (List.length ps) (fun i -> i, dummy))) ] in
- let trail = [] in
- let sigma = [] in
- let p = {freshno; div; conv; ps; sigma; deltas; initialSpecialK; trail; var_names; label} in
- p, check p
-;;
diff --git a/ocaml/lambda4.mli b/ocaml/lambda4.mli
deleted file mode 100644 (file)
index d6e4202..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-type problem\r
-\r
-val label_of_problem : problem -> string\r
-\r
-type response = [\r
- | `CompleteSeparable of string\r
- | `CompleteUnseparable of string\r
- | `Uncomplete\r
-]\r
-\r
-type result = [\r
- `Complete | `Uncomplete\r
-] * [\r
- | `Separable of (int * Num.nf) list\r
- | `Unseparable of string\r
-]\r
-\r
-val problem_of: (string (* problem label *)\r
-* Num.i_var option (* div *)\r
-* Num.i_n_var list (* conv *)\r
-* Num.i_n_var list (* ps *)\r
-* string list (* names of free variables *)) -> problem * response\r
-val solve: problem * response -> result\r
diff --git a/ocaml/listx.ml b/ocaml/listx.ml
deleted file mode 100644 (file)
index 821e281..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-(* Non-empty lists *)
-type 'a listx =
-  | Nil of 'a
-  | Cons of ('a * 'a listx)
-
-let rec fold_left f acc l =
-  match l with
-  | Nil x -> f acc x
-  | Cons (x, l') -> fold_left f (f acc x) l'
-
-let hd =
- function
-  | Nil x
-  | Cons (x,_) -> x
-
-let rec map f =
-  function
-  | Nil x -> Nil (f x)
-  | Cons (x, l') -> Cons (f x, map f l')
-
-let rec append l =
-  function
-  | Nil x -> Cons (x, l)
-  | Cons (x, l') -> Cons (x, append l l')
-
-let rec length = function
-  | Nil _ -> 1
-  | Cons (_, xs) -> 1 + (length xs)
-
-let rec assoc x = function
-  | Nil (y,t)
-  | Cons ((y,t),_) when x=y -> t
-  | Nil _ -> raise Not_found
-  | Cons (_,l) -> assoc x l
-
-let rec to_list =
- function
-    Nil x -> [x]
-  | Cons (x,l) -> x::to_list l
-
-let rec from_list =
- function
-    [] -> raise (Failure "from_list: empty list")
-  | [x] -> Nil x
-  | x::l -> Cons(x,from_list l)
-
-let rec split_nth n l =
- match n,l with
-    0,_ -> []
- | 1,Nil x -> [x]
- | n,Cons (hd,tl) -> hd::split_nth (n-1) tl
- | _,_ -> raise (Failure "split_nth: not enough args")
-
-let rec max =
-  function
-  | Nil x -> x
-  | Cons (x, l) -> Pervasives.max x (max l)
-
-let rec last =
-  function
-  | Nil x -> x
-  | Cons (_, l) -> last l
-(*
-let rec nth i l = match l, i with
- | Cons (x, _), 1  -> x
- | _, n when n <= 0 -> raise (Invalid_argument "Listx.nth")
- | Cons (_, xs), n -> nth (n-1) xs
- | Nil x, 1        -> x
- | Nil _, _        -> raise (Invalid_argument "Listx.nth")
-;;
-*)
diff --git a/ocaml/listx.mli b/ocaml/listx.mli
deleted file mode 100644 (file)
index a43bc4e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-type 'a listx = Nil of 'a | Cons of ('a * 'a listx)
-val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b listx -> 'a
-val hd : 'a listx -> 'a
-val map : ('a -> 'b) -> 'a listx -> 'b listx
-val append : 'a listx -> 'a listx -> 'a listx
-val length : 'a listx -> int
-val assoc : 'a -> ('a * 'b) listx -> 'b
-val to_list : 'a listx -> 'a list
-val from_list : 'a list -> 'a listx
-val split_nth : int -> 'a listx -> 'a list
-val max : 'a listx -> 'a
-val last : 'a listx -> 'a
diff --git a/ocaml/logs/fail.txt b/ocaml/logs/fail.txt
deleted file mode 100644 (file)
index a0cf184..0000000
+++ /dev/null
@@ -1,2999 +0,0 @@
--666 | 44 => `169:-666 | 45 => `170:-666] )) u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-461\r
-1686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (`64:2 (λ`171. [match(b:1) `171:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `16\r
-3:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 =\r
-> `168:-666 | 44 => `169:-666 | 45 => `170:-666] ))) `70:-4611686018427387904 `69:-4611686018427387904 `68:-461168601842\r
-7387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `64:2 (λ`171. [match(b:1) `171:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904\r
-`76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: e:1 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: `169:1 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `10\r
-3:-4611686018427387904\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `64:4 (λ`171. [match(b:1) `171:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) (λ`171. [match(f:1) `171:-4611686018427387904 `93:-4611686018427387904 `92:\r
--4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-4611686018427387904 with 24 => λ`172. [match\r
-(`92:-666) `172:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46\r
-11686018427387904 `96:-4611686018427387904 with 26 => λ`173. [match(`98:-666) `173:-4611686018427387904 `107:-4611686018\r
-427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 2\r
-8 => λ`174. [match(`104:-666) `174:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-461168\r
-6018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`175. [match(`128:-666) `175:-461168601842\r
-7387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-46\r
-11686018427387904 with 34 => λ`176. [match(`133:-666) `176:-4611686018427387904 `144:-4611686018427387904 `143:-46116860\r
-18427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`177. [match(`138:\r
--666) `177:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611\r
-686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`174. [match(`105:-666) `174:-461168\r
-6018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `1\r
-10:-4611686018427387904 with 30 => λ`175. [match(`110:-666) `175:-4611686018427387904 `120:-4611686018427387904 `119:-46\r
-11686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )]\r
- )] ) | 27 => `102:-666] ) | 25 => `95:-666] )) (`64:3 (λ`171. [match(b:1) `171:-4611686018427387904 `165:-4611686018427\r
-387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 =\r
-> `166:-666 | 42 => `167:-666 | 43 => `168:-666 | 44 => `169:-666 | 45 => `170:-666] )) (e:3 (λ`171. λ`172. [match(d:1)\r
-`172:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860184273\r
-87904 `28:-4611686018427387904 with 8 => λ`173. [match(`30:-666) `173:-4611686018427387904 `38:-4611686018427387904 `37:\r
--4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`174. [match(\r
-`35:-666) `174:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611\r
-686018427387904 `40:-4611686018427387904 with 10 => λ`175. [match(`40:-666) `175:-4611686018427387904 `50:-4611686018427\r
-387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`\r
-176. [match(`45:-666) `176:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-46116860184273879\r
-04 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`177. [match(`50:-666) `177:-4611686018427387904 `79:-4\r
-611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 w\r
-ith 20 => λ`178. [match(`72:-666) `178:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-46\r
-11686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`178. [match(`73:\r
--666) `178:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-46116860\r
-18427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`177. [match(`51:-666) `177:-46\r
-11686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `5\r
-9:-4611686018427387904 with 15 => λ`178. [match(`57:-666) `178:-4611686018427387904 `70:-4611686018427387904 `69:-461168\r
-6018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73\r
-:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => `64:-666] )) (λ`171. i:2 h:1))) `120:-4611686018427387\r
-904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `64:4 (λ`171. λ`172. [match(n:1) `172:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-461168\r
-6018427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`173. [match(s:-666) `173:-4611686018427387904 `2\r
-6:-4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with\r
-7 => `27:-666] ) | 16 => `71:-666] )) (λ`171. `171:2 (λ`172. [match(d:1) `172:-4611686018427387904 `32:-4611686018427387\r
-904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`173.\r
- [match(`30:-666) `173:-4611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `\r
-35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`174. [match(`35:-666) `174:-4611686018427387904 `44:-461168\r
-6018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 1\r
-0 => λ`175. [match(`40:-666) `175:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018\r
-427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`176. [match(`45:-666) `176:-4611686018427387904\r
- `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116860184273\r
-87904 with 12 => λ`177. [match(`50:-666) `177:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77\r
-:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`178. [match(`72:-666) `178:-4611686\r
-018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `12\r
-2:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`178. [match(`73:-666) `178:-4611686018427387904 `86:-4611686018\r
-427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 =>\r
- `87:-666 | 23 => `88:-666] )] ) | 13 => λ`177. [match(`51:-666) `177:-4611686018427387904 `63:-4611686018427387904 `62:\r
--4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`178. [match\r
-(`57:-666) `178:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-461\r
-1686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )]\r
-)] )] )] ) | 14 => `64:-666] ))) (λ`171. [match(`80:1) `171:-4611686018427387904 `86:-4611686018427387904 `85:-461168601\r
-8427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-6\r
-66] )) `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-461\r
-1686018427387904\r
-| 34: 34\r
-| 35: e:1 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-\r
-4611686018427387904\r
-| 36: `170:2 (λ`171. λ`172. e:1) `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686\r
-018427387904\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: `170:1 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611686018427387904 `15\r
-3:-4611686018427387904\r
-| 39: h:2 (λ`171. λ`172. [match(n:1) `172:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`173. [match(s:-666) `173:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-\r
-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: `168:0 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 45: e:1 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 82 95= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: e\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `64\r
-INSTANTIATING CRITICAL TO EAT e\r
-INSTANTIATING AND HOPING e\r
-WARNING: using constant initialSpecialK\r
-# INST: e := λ`182. [match(d:666) `182:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-46\r
-11686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => `177:-666 | 48 => `17\r
-8:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=73 freshno = 181\r
-|> DISCRIMINATING SETS (deltas)\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45\r
-| 38 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) `64:1 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-461168601\r
-8427387904 with 9 => λ`182. [match(`38:-666) `182:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904\r
- `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`183. [match(`43:-666) `183:-461\r
-1686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46\r
-:-4611686018427387904 with 11 => λ`184. [match(`48:-666) `184:-4611686018427387904 `56:-4611686018427387904 `55:-4611686\r
-018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`185. [match(`53:-66\r
-6) `185:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-46116860184\r
-27387904 `75:-4611686018427387904 with 20 => λ`186. [match(`75:-666) `186:-4611686018427387904 `126:-4611686018427387904\r
- `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127\r
-:-666] ) | 21 => λ`186. [match(`76:-666) `186:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84\r
-:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13\r
-=> λ`185. [match(`54:-666) `185:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-461168601842\r
-7387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`186. [match(`60:-666) `186:-4611686018427387904 `\r
-70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387\r
-904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => `177:-666 | 48 =>\r
- `178:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:\r
--4611686018427387904 `96:-4611686018427387904) with 26 => λ`182. [match(`100:-666) `182:-4611686018427387904 `107:-46116\r
-86018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 w\r
-ith 28 => λ`183. [match(`106:-666) `183:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4\r
-611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`184. [match(`130:-666) `184:-4611686\r
-018427387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `13\r
-4:-4611686018427387904 with 34 => λ`185. [match(`135:-666) `185:-4611686018427387904 `144:-4611686018427387904 `143:-461\r
-1686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`186. [match(\r
-`140:-666) `186:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:\r
--4611686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`183. [match(`107:-666) `183:-4\r
-611686018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-46116860184273879\r
-04 `110:-4611686018427387904 with 30 => λ`184. [match(`112:-666) `184:-4611686018427387904 `120:-4611686018427387904 `11\r
-9:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-66\r
-6] )] )] ) | 27 => `102:-666] `64:2 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427387904 `164:-461168\r
-6018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 =>\r
- `167:-666 | 43 => `168:-666 | 44 => `169:-666 | 45 => `170:-666] ))) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: `152:1 a:0\r
-| 5: `166:0 n:-4611686018427387904 m:-4611686018427387904 l:-4611686018427387904 k:-4611686018427387904\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: `167:1 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-461\r
-1686018427387904\r
-| 9: `102:0 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `177:2 (λ`182. i:2 h:1) `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018\r
-427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `64:1 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `64:2 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-461\r
-1686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (`64:2 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `16\r
-3:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 =\r
-> `168:-666 | 44 => `169:-666 | 45 => `170:-666] ))) `70:-4611686018427387904 `69:-4611686018427387904 `68:-461168601842\r
-7387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `64:2 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904\r
-`76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: `169:1 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `10\r
-3:-4611686018427387904\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `64:4 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) (λ`182. [match(f:1) `182:-4611686018427387904 `93:-4611686018427387904 `92:\r
--4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-4611686018427387904 with 24 => λ`183. [match\r
-(`92:-666) `183:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46\r
-11686018427387904 `96:-4611686018427387904 with 26 => λ`184. [match(`98:-666) `184:-4611686018427387904 `107:-4611686018\r
-427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 2\r
-8 => λ`185. [match(`104:-666) `185:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-461168\r
-6018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`186. [match(`128:-666) `186:-461168601842\r
-7387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-46\r
-11686018427387904 with 34 => λ`187. [match(`133:-666) `187:-4611686018427387904 `144:-4611686018427387904 `143:-46116860\r
-18427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`188. [match(`138:\r
--666) `188:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611\r
-686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`185. [match(`105:-666) `185:-461168\r
-6018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `1\r
-10:-4611686018427387904 with 30 => λ`186. [match(`110:-666) `186:-4611686018427387904 `120:-4611686018427387904 `119:-46\r
-11686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )]\r
- )] ) | 27 => `102:-666] ) | 25 => `95:-666] )) (`64:3 (λ`182. [match(b:1) `182:-4611686018427387904 `165:-4611686018427\r
-387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 =\r
-> `166:-666 | 42 => `167:-666 | 43 => `168:-666 | 44 => `169:-666 | 45 => `170:-666] )) [match(e:3) [match(f:1) `174:-46\r
-11686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `2\r
-8:-4611686018427387904 with 8 => λ`182. [match(`32:-666) `182:-4611686018427387904 `38:-4611686018427387904 `37:-4611686\r
-018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`183. [match(`37:-666\r
-) `183:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-461168601842\r
-7387904 `40:-4611686018427387904 with 10 => λ`184. [match(`42:-666) `184:-4611686018427387904 `50:-4611686018427387904 `\r
-49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`185. [ma\r
-tch(`47:-666) `185:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-\r
-4611686018427387904 `52:-4611686018427387904 with 12 => λ`186. [match(`52:-666) `186:-4611686018427387904 `79:-461168601\r
-8427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 =\r
-> λ`187. [match(`74:-666) `187:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018\r
-427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`187. [match(`75:-666) `1\r
-87:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387\r
-904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`186. [match(`53:-666) `186:-4611686018\r
-427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116\r
-86018427387904 with 15 => λ`187. [match(`59:-666) `187:-4611686018427387904 `70:-4611686018427387904 `69:-46116860184273\r
-87904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 |\r
-6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => `64:-666] `173:-4611686018427387904 `172:-4611686018427387904\r
-`171:-4611686018427387904) with 46 => `176:-666 | 47 => `177:-666 | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-666\r
-| 51 => `181:-666] λ`182. i:2 h:1)) `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-\r
-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `64:4 (λ`182. λ`183. [match(n:1) `183:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-461168\r
-6018427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`184. [match(s:-666) `184:-4611686018427387904 `2\r
-6:-4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with\r
-7 => `27:-666] ) | 16 => `71:-666] )) (λ`182. `182:2 (λ`183. [match(d:1) `183:-4611686018427387904 `32:-4611686018427387\r
-904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`184.\r
- [match(`30:-666) `184:-4611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `\r
-35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`185. [match(`35:-666) `185:-4611686018427387904 `44:-461168\r
-6018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 1\r
-0 => λ`186. [match(`40:-666) `186:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018\r
-427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`187. [match(`45:-666) `187:-4611686018427387904\r
- `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116860184273\r
-87904 with 12 => λ`188. [match(`50:-666) `188:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77\r
-:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`189. [match(`72:-666) `189:-4611686\r
-018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `12\r
-2:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`189. [match(`73:-666) `189:-4611686018427387904 `86:-4611686018\r
-427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 =>\r
- `87:-666 | 23 => `88:-666] )] ) | 13 => λ`188. [match(`51:-666) `188:-4611686018427387904 `63:-4611686018427387904 `62:\r
--4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`189. [match\r
-(`57:-666) `189:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-461\r
-1686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )]\r
-)] )] )] ) | 14 => `64:-666] ))) (λ`182. [match(`80:1) `182:-4611686018427387904 `86:-4611686018427387904 `85:-461168601\r
-8427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-6\r
-66] )) `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-461\r
-1686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: `170:2 (λ`182. λ`183. λ`184. [match(b:1) `184:-4611686018427387904 `175:-4611686018427387904 `174:-461168601842738\r
-7904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => `177:-66\r
-6 | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666] )) `62:-4611686018427387904 `61:-461168601842\r
-7387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: `170:1 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611686018427387904 `15\r
-3:-4611686018427387904\r
-| 39: h:2 (λ`182. λ`183. [match(n:1) `183:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`184. [match(s:-666) `184:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-\r
-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: `168:0 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: `105:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 50: `144:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-|\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `64\r
-DANGEROUS EAT: `164\r
-dangerous_conv lenght:5\r
-`64 `37 `36 `35 `34 h `74 `64 `37 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `7\r
-6 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151\r
- h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121 `100 `175 `174\r
-`173 `172 `171 `176 `177 `178 `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131 `130 `129 `128 `138 `137\r
- `136 `135 `134 `144 `143 `142 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110 `120 `119 `118 `117 `116\r
- `121 `102 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121\r
-\r
-dangerous_conv lenght:5\r
-`64 `37 `36 `35 `34 h `74 `64 `37 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `7\r
-6 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151\r
- h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121 `100 `175 `174\r
-`173 `172 `171 `176 `177 `178 `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131 `130 `129 `128 `138 `137\r
- `136 `135 `134 `144 `143 `142 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110 `120 `119 `118 `117 `116\r
- `121 `102 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121\r
-\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 73 82= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `64\r
-DANGEROUS EAT: `164\r
-INSTANTIATING CRITICAL TO EAT h\r
-INSTANTIATING AND HOPING `177\r
-WARNING: using constant initialSpecialK\r
-# INST: `177 := λ`188. [match(`176:666) `188:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `1\r
-84:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904 with 52 => `187:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=72 freshno = 187\r
-|> DISCRIMINATING SETS (deltas)\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45\r
-| 38 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) `64:1 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-461168601\r
-8427387904 with 9 => λ`188. [match(`38:-666) `188:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904\r
- `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`189. [match(`43:-666) `189:-461\r
-1686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46\r
-:-4611686018427387904 with 11 => λ`190. [match(`48:-666) `190:-4611686018427387904 `56:-4611686018427387904 `55:-4611686\r
-018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`191. [match(`53:-66\r
-6) `191:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-46116860184\r
-27387904 `75:-4611686018427387904 with 20 => λ`192. [match(`75:-666) `192:-4611686018427387904 `126:-4611686018427387904\r
- `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127\r
-:-666] ) | 21 => λ`192. [match(`76:-666) `192:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84\r
-:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13\r
-=> λ`191. [match(`54:-666) `191:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-461168601842\r
-7387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`192. [match(`60:-666) `192:-4611686018427387904 `\r
-70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387\r
-904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`188. [match(`17\r
-6:-666) `188:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-) with 26 => λ`188. [match(`100:-666) `188:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387904 `105\r
-:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`189. [match(`106:-666) `189:-4611\r
-686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904\r
-`128:-4611686018427387904 with 33 => λ`190. [match(`130:-666) `190:-4611686018427387904 `138:-4611686018427387904 `137:-\r
-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`191. [mat\r
-ch(`135:-666) `191:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `1\r
-41:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`192. [match(`140:-666) `192:-4611686018427387904 `150:-46\r
-11686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-461168601842738790\r
-4 with 37 => `152:-666] )] )] )] ) | 29 => λ`189. [match(`107:-666) `189:-4611686018427387904 `114:-4611686018427387904\r
-`113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30 => λ`190\r
-. [match(`112:-666) `190:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387\r
-904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] `64:2 (λ`188. [\r
-match(b:1) `188:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:\r
--4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:-666 | 44 => `169:-66\r
-6 | 45 => `170:-666] ))) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: `152:1 a:0\r
-| 5: `166:0 n:-4611686018427387904 m:-4611686018427387904 l:-4611686018427387904 k:-4611686018427387904\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: `167:1 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-461\r
-1686018427387904\r
-| 9: `102:0 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `64:1 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `64:2 (λ`188. [match(b:1) `188:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-461\r
-1686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (`64:2 (λ`188. [match(b:1) `188:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `16\r
-3:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 =\r
-> `168:-666 | 44 => `169:-666 | 45 => `170:-666] ))) `70:-4611686018427387904 `69:-4611686018427387904 `68:-461168601842\r
-7387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `64:2 (λ`188. [match(b:1) `188:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904\r
-`76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: `169:1 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `10\r
-3:-4611686018427387904\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `64:4 (λ`188. [match(b:1) `188:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611\r
-686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 => `166:-666 | 42 => `167:-666 | 43 => `168:\r
--666 | 44 => `169:-666 | 45 => `170:-666] )) (λ`188. [match(f:1) `188:-4611686018427387904 `93:-4611686018427387904 `92:\r
--4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-4611686018427387904 with 24 => λ`189. [match\r
-(`92:-666) `189:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46\r
-11686018427387904 `96:-4611686018427387904 with 26 => λ`190. [match(`98:-666) `190:-4611686018427387904 `107:-4611686018\r
-427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 2\r
-8 => λ`191. [match(`104:-666) `191:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-461168\r
-6018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`192. [match(`128:-666) `192:-461168601842\r
-7387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-46\r
-11686018427387904 with 34 => λ`193. [match(`133:-666) `193:-4611686018427387904 `144:-4611686018427387904 `143:-46116860\r
-18427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`194. [match(`138:\r
--666) `194:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611\r
-686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`191. [match(`105:-666) `191:-461168\r
-6018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `1\r
-10:-4611686018427387904 with 30 => λ`192. [match(`110:-666) `192:-4611686018427387904 `120:-4611686018427387904 `119:-46\r
-11686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )]\r
- )] ) | 27 => `102:-666] ) | 25 => `95:-666] )) (`64:3 (λ`188. [match(b:1) `188:-4611686018427387904 `165:-4611686018427\r
-387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904 with 41 =\r
-> `166:-666 | 42 => `167:-666 | 43 => `168:-666 | 44 => `169:-666 | 45 => `170:-666] )) [match(e:3) [match(f:1) `174:-46\r
-11686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `2\r
-8:-4611686018427387904 with 8 => λ`188. [match(`32:-666) `188:-4611686018427387904 `38:-4611686018427387904 `37:-4611686\r
-018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`189. [match(`37:-666\r
-) `189:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-461168601842\r
-7387904 `40:-4611686018427387904 with 10 => λ`190. [match(`42:-666) `190:-4611686018427387904 `50:-4611686018427387904 `\r
-49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`191. [ma\r
-tch(`47:-666) `191:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-\r
-4611686018427387904 `52:-4611686018427387904 with 12 => λ`192. [match(`52:-666) `192:-4611686018427387904 `79:-461168601\r
-8427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 =\r
-> λ`193. [match(`74:-666) `193:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018\r
-427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`193. [match(`75:-666) `1\r
-93:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387\r
-904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`192. [match(`53:-666) `192:-4611686018\r
-427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116\r
-86018427387904 with 15 => λ`193. [match(`59:-666) `193:-4611686018427387904 `70:-4611686018427387904 `69:-46116860184273\r
-87904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 |\r
-6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => `64:-666] `173:-4611686018427387904 `172:-4611686018427387904\r
-`171:-4611686018427387904) with 46 => `176:-666 | 47 => λ`188. [match(`176:-666) `188:-4611686018427387904 `186:-4611686\r
-018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904 wit\r
-h 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666] λ`188. i:2 h:1)) `120:-461\r
-1686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `64:4 (λ`188. λ`189. [match(n:1) `189:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-461168\r
-6018427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`190. [match(s:-666) `190:-4611686018427387904 `2\r
-6:-4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with\r
-7 => `27:-666] ) | 16 => `71:-666] )) (λ`188. `188:2 (λ`189. [match(d:1) `189:-4611686018427387904 `32:-4611686018427387\r
-904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`190.\r
- [match(`30:-666) `190:-4611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `\r
-35:-4611686018427387904 `34:-4611686018427387904 with 9 => λ`191. [match(`35:-666) `191:-4611686018427387904 `44:-461168\r
-6018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 1\r
-0 => λ`192. [match(`40:-666) `192:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018\r
-427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`193. [match(`45:-666) `193:-4611686018427387904\r
- `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116860184273\r
-87904 with 12 => λ`194. [match(`50:-666) `194:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77\r
-:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`195. [match(`72:-666) `195:-4611686\r
-018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `12\r
-2:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`195. [match(`73:-666) `195:-4611686018427387904 `86:-4611686018\r
-427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 =>\r
- `87:-666 | 23 => `88:-666] )] ) | 13 => λ`194. [match(`51:-666) `194:-4611686018427387904 `63:-4611686018427387904 `62:\r
--4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`195. [match\r
-(`57:-666) `195:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-461\r
-1686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )]\r
-)] )] )] ) | 14 => `64:-666] ))) (λ`188. [match(`80:1) `188:-4611686018427387904 `86:-4611686018427387904 `85:-461168601\r
-8427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-6\r
-66] )) `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-461\r
-1686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: `170:2 (λ`188. λ`189. λ`190. [match(b:1) `190:-4611686018427387904 `175:-4611686018427387904 `174:-461168601842738\r
-7904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`191. [\r
-match(`173:-666) `191:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904\r
- `183:-4611686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 =>\r
- `180:-666 | 51 => `181:-666] )) `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686\r
-018427387904\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: `170:1 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611686018427387904 `15\r
-3:-4611686018427387904\r
-| 39: h:2 (λ`188. λ`189. [match(n:1) `189:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`190. [match(s:-666) `190:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-\r
-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: `168:0 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: `105:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 50: `144:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-|\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `64\r
-DANGEROUS EAT: `164\r
-dangerous_conv lenght:5\r
-`64 `37 `36 `35 `34 h `74 `64 `37 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `7\r
-6 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151\r
- h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121 `100 `175 `174\r
-`173 `172 `171 `176 `186 `185 `184 `183 `182 `187 `178 `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131\r
- `130 `129 `128 `138 `137 `136 `135 `134 `144 `143 `142 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110\r
- `120 `119 `118 `117 `116 `121 `102 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121\r
-\r
-dangerous_conv lenght:5\r
-`64 `37 `36 `35 `34 h `74 `64 `37 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `7\r
-6 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151\r
- h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121 `100 `175 `174\r
-`173 `172 `171 `176 `186 `185 `184 `183 `182 `187 `178 `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131\r
- `130 `129 `128 `138 `137 `136 `135 `134 `144 `143 `142 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110\r
- `120 `119 `118 `117 `116 `121 `102 `64 `165 `164 `163 `162 `161 `166 `167 `168 `169 `170 `121\r
-\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 72 73= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `64\r
-DANGEROUS EAT: `164\r
-INSTANTIATING CRITICAL TO EAT h\r
-INSTANTIATING AND HOPING `64\r
-WARNING: using constant initialSpecialK\r
-# INST: `64 := λ`198. [match(`63:666) `198:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 =>\r
- `197:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=63 freshno = 197\r
-|> DISCRIMINATING SETS (deltas)\r
-| 53 <> 55 <> 57\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 38 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) [match(`64:1) `37:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 =>\r
- `197:-666] `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904) with 9 => λ`198. [match(`38:-666\r
-) `198:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-461168601842\r
-7387904 `40:-4611686018427387904 with 10 => λ`199. [match(`43:-666) `199:-4611686018427387904 `50:-4611686018427387904 `\r
-49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`200. [ma\r
-tch(`48:-666) `200:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-\r
-4611686018427387904 `52:-4611686018427387904 with 12 => λ`201. [match(`53:-666) `201:-4611686018427387904 `79:-461168601\r
-8427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 =\r
-> λ`202. [match(`75:-666) `202:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018\r
-427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`202. [match(`76:-666) `2\r
-02:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387\r
-904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`201. [match(`54:-666) `201:-4611686018\r
-427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116\r
-86018427387904 with 15 => λ`202. [match(`60:-666) `202:-4611686018427387904 `70:-4611686018427387904 `69:-46116860184273\r
-87904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 |\r
-6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`198. [match(`17\r
-6:-666) `198:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-) with 26 => λ`198. [match(`100:-666) `198:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387904 `105\r
-:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`199. [match(`106:-666) `199:-4611\r
-686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904\r
-`128:-4611686018427387904 with 33 => λ`200. [match(`130:-666) `200:-4611686018427387904 `138:-4611686018427387904 `137:-\r
-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`201. [mat\r
-ch(`135:-666) `201:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `1\r
-41:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`202. [match(`140:-666) `202:-4611686018427387904 `150:-46\r
-11686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-461168601842738790\r
-4 with 37 => `152:-666] )] )] )] ) | 29 => λ`199. [match(`107:-666) `199:-4611686018427387904 `114:-4611686018427387904\r
-`113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30 => λ`200\r
-. [match(`112:-666) `200:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387\r
-904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] `195:1) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: `152:1 a:0\r
-| 5: `166:0 n:-4611686018427387904 m:-4611686018427387904 l:-4611686018427387904 k:-4611686018427387904\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: `167:1 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-461\r
-1686018427387904\r
-| 9: `102:0 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `193:0 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `195:1 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-461168601842\r
-7387904\r
-| 17: `71:2 `195:1 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `\r
-66:-4611686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `195:1 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-46\r
-11686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: `169:1 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `10\r
-3:-4611686018427387904\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `195:3 (λ`198. [match(f:1) `198:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-461168\r
-6018427387904 `90:-4611686018427387904 `89:-4611686018427387904 with 24 => λ`199. [match(`92:-666) `199:-461168601842738\r
-7904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-461168601\r
-8427387904 with 26 => λ`200. [match(`98:-666) `200:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387\r
-904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`201. [match(`104:-666) `2\r
-01:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-461168601842\r
-7387904 `128:-4611686018427387904 with 33 => λ`202. [match(`128:-666) `202:-4611686018427387904 `138:-461168601842738790\r
-4 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`2\r
-03. [match(`133:-666) `203:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-46116860184273\r
-87904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`204. [match(`138:-666) `204:-4611686018427387904\r
-`150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-4611686018\r
-427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`201. [match(`105:-666) `201:-4611686018427387904 `114:-461168601842\r
-7387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30\r
-=> λ`202. [match(`110:-666) `202:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-46116860\r
-18427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] ) | 25\r
-=> `95:-666] )) (`195:2 [match(e:3) [match(f:1) `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`198. [match(`32:-666) `198:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`199. [match(`37:-666) `199:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`200. [match(`42:-6\r
-66) `200:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`201. [match(`47:-666) `201:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`202. [\r
-match(`52:-666) `202:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`203. [match(`74:-666) `203:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`203. [match(`75:-666) `203:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`202. [match(`53:-666) `202:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`203. [match(`59:-666) `203:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`198.\r
- [match(`63:-666) `198:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 => `197:-666] )] `173:\r
--4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with 46 => `176:-666 | 47 => λ`198. [match(`17\r
-6:-666) `198:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] λ`198. i:2 h:1)) `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117\r
-:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `197:3 (λ`198. `198:2 (λ`199. [match(d:1) `199:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`200. [match(`30:-666) `200:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`201. [match(`35:-666) `201:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`202. [match(`40:-6\r
-66) `202:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`203. [match(`45:-666) `203:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`204. [\r
-match(`50:-666) `204:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`205. [match(`72:-666) `205:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`205. [match(`73:-666) `205:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`204. [match(`51:-666) `204:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`205. [match(`57:-666) `205:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`200.\r
- [match(`61:-666) `200:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 => `197:-666] )] ))) (\r
-λ`198. [match(`80:1) `198:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-461168601842738790\r
-4 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )) `132:-4611686018427387904 `\r
-131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: `170:2 (λ`198. λ`199. λ`200. [match(b:1) `200:-4611686018427387904 `175:-4611686018427387904 `174:-461168601842738\r
-7904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`201. [\r
-match(`173:-666) `201:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904\r
- `183:-4611686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 =>\r
- `180:-666 | 51 => `181:-666] )) `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686\r
-018427387904\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: `170:1 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611686018427387904 `15\r
-3:-4611686018427387904\r
-| 39: h:2 (λ`198. λ`199. [match(n:1) `199:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`200. [match(s:-666) `200:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: `168:0 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: `105:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 50: `144:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-| 53: `62:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-4611686018427387904 `189:-46116\r
-86018427387904 `188:-4611686018427387904\r
-| 54: `192:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 55: `194:0 `191:-4611686018427387904 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 56: `191:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-|\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-DANGEROUS EAT: `195\r
-dangerous_conv lenght:5\r
-`37 `192 `191 `190 `189 `188 `36 `35 `34 `74 `37 `192 `191 `190 `189 `188 `193 `195 `197 `36 `35 `34 `44 `43 `42 `41 `40\r
- `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `76 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `\r
-63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151 h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `121 `100 `175 `174 `173 `172 `171 `176 `186 `185 `184 `183 `182 `187 `178\r
- `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131 `130 `129 `128 `138 `137 `136 `135 `134 `144 `143 `14\r
-2 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110 `120 `119 `118 `117 `116 `121 `102 `195 `121\r
-\r
-# INST_IN_EAT: `166 := λ`198. λ`199. λ`200. λ`201. 5\r
-# INST_IN_EAT: `167 := λ`198. λ`199. λ`200. λ`201. λ`202. 8\r
-# INST_IN_EAT: `168 := λ`198. λ`199. λ`200. λ`201. 44\r
-# INST_IN_EAT: `169 := λ`198. λ`199. λ`200. λ`201. λ`202. 29\r
-# INST_IN_EAT: `170 := λ`198. λ`199. λ`200. λ`201. λ`202. 36\r
-# INST_IN_EAT: `194 := λ`198. λ`199. λ`200. λ`201. 55\r
-dangerous_conv lenght:5\r
-`37 `192 `191 `190 `189 `188 `36 `35 `34 `74 `37 `192 `191 `190 `189 `188 `193 `195 `197 `36 `35 `34 `44 `43 `42 `41 `40\r
- `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `76 `75 `126 `125 `124 `123 `122 `127 `86 `85 `84 `83 `82 `87 `88 `\r
-63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151 h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96 `121 `100 `175 `174 `173 `172 `171 `176 `186 `185 `184 `183 `182 `187 `178\r
- `179 `180 `181 `99 `98 `97 `96 `107 `106 `105 `104 `103 `132 `131 `130 `129 `128 `138 `137 `136 `135 `134 `144 `143 `14\r
-2 `141 `140 `150 `149 `148 `147 `146 `152 `114 `113 `112 `111 `110 `120 `119 `118 `117 `116 `121 `102 `195 `121\r
-\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=58 freshno = 197\r
-|> DISCRIMINATING SETS (deltas)\r
-| 53 <> 55 <> 57\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) [match(`64:1) `37:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 =>\r
- `197:-666] `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904) with 9 => λ`198. [match(`38:-666\r
-) `198:-4611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-461168601842\r
-7387904 `40:-4611686018427387904 with 10 => λ`199. [match(`43:-666) `199:-4611686018427387904 `50:-4611686018427387904 `\r
-49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`200. [ma\r
-tch(`48:-666) `200:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-\r
-4611686018427387904 `52:-4611686018427387904 with 12 => λ`201. [match(`53:-666) `201:-4611686018427387904 `79:-461168601\r
-8427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 =\r
-> λ`202. [match(`75:-666) `202:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018\r
-427387904 `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`202. [match(`76:-666) `2\r
-02:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387\r
-904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`201. [match(`54:-666) `201:-4611686018\r
-427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116\r
-86018427387904 with 15 => λ`202. [match(`60:-666) `202:-4611686018427387904 `70:-4611686018427387904 `69:-46116860184273\r
-87904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 |\r
-6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`198. [match(`17\r
-6:-666) `198:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-) with 26 => λ`198. [match(`100:-666) `198:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387904 `105\r
-:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`199. [match(`106:-666) `199:-4611\r
-686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904\r
-`128:-4611686018427387904 with 33 => λ`200. [match(`130:-666) `200:-4611686018427387904 `138:-4611686018427387904 `137:-\r
-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`201. [mat\r
-ch(`135:-666) `201:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `1\r
-41:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`202. [match(`140:-666) `202:-4611686018427387904 `150:-46\r
-11686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-461168601842738790\r
-4 with 37 => `152:-666] )] )] )] ) | 29 => λ`199. [match(`107:-666) `199:-4611686018427387904 `114:-4611686018427387904\r
-`113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30 => λ`200\r
-. [match(`112:-666) `200:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387\r
-904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] `195:1) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: `152:1 a:0\r
-| 5: 5\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: 8\r
-| 9: `102:0 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `193:0 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `195:1 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-461168601842\r
-7387904\r
-| 17: `71:2 `195:1 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `\r
-66:-4611686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `195:1 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-46\r
-11686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: 29\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `195:3 (λ`198. [match(f:1) `198:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-461168\r
-6018427387904 `90:-4611686018427387904 `89:-4611686018427387904 with 24 => λ`199. [match(`92:-666) `199:-461168601842738\r
-7904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-461168601\r
-8427387904 with 26 => λ`200. [match(`98:-666) `200:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387\r
-904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`201. [match(`104:-666) `2\r
-01:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-461168601842\r
-7387904 `128:-4611686018427387904 with 33 => λ`202. [match(`128:-666) `202:-4611686018427387904 `138:-461168601842738790\r
-4 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`2\r
-03. [match(`133:-666) `203:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-46116860184273\r
-87904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`204. [match(`138:-666) `204:-4611686018427387904\r
-`150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-4611686018\r
-427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`201. [match(`105:-666) `201:-4611686018427387904 `114:-461168601842\r
-7387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30\r
-=> λ`202. [match(`110:-666) `202:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-46116860\r
-18427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] ) | 25\r
-=> `95:-666] )) (`195:2 [match(e:3) [match(f:1) `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`198. [match(`32:-666) `198:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`199. [match(`37:-666) `199:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`200. [match(`42:-6\r
-66) `200:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`201. [match(`47:-666) `201:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`202. [\r
-match(`52:-666) `202:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`203. [match(`74:-666) `203:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`203. [match(`75:-666) `203:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`202. [match(`53:-666) `202:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`203. [match(`59:-666) `203:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`198.\r
- [match(`63:-666) `198:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 => `197:-666] )] `173:\r
--4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with 46 => `176:-666 | 47 => λ`198. [match(`17\r
-6:-666) `198:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] λ`198. i:2 h:1)) `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117\r
-:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `197:3 (λ`198. `198:2 (λ`199. [match(d:1) `199:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`200. [match(`30:-666) `200:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`201. [match(`35:-666) `201:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`202. [match(`40:-6\r
-66) `202:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`203. [match(`45:-666) `203:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`204. [\r
-match(`50:-666) `204:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`205. [match(`72:-666) `205:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`205. [match(`73:-666) `205:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`204. [match(`51:-666) `204:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`205. [match(`57:-666) `205:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`200.\r
- [match(`61:-666) `200:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => `195:-666 | 57 => `197:-666] )] ))) (\r
-λ`198. [match(`80:1) `198:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-461168601842738790\r
-4 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )) `132:-4611686018427387904 `\r
-131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: 36\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: 36\r
-| 39: h:2 (λ`198. λ`199. [match(n:1) `199:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`200. [match(s:-666) `200:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: 44\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: `105:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 50: `144:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-| 53: `62:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-4611686018427387904 `189:-46116\r
-86018427387904 `188:-4611686018427387904\r
-| 54: `192:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 55: 55\r
-| 56: `191:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 58 72= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-DANGEROUS EAT: `195\r
-INSTANTIATING CRITICAL TO EAT h\r
-INSTANTIATING AND HOPING `195\r
-@@@@ NEW INSTANTIATE PHASE (1) @@@@\r
-WARNING: using constant initialSpecialK\r
-# INST: `195 := λ`207. [match(`194:666) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `2\r
-00:-4611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61\r
-=> `206:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=52 freshno = 206\r
-|> DISCRIMINATING SETS (deltas)\r
-| 58 <> 59 <> 61\r
-| 53 <> 55 <> 57\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) [match(`64:1) `37:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`207. [match(`19\r
-4:-666) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46\r
-11686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-66\r
-6] `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904) with 9 => λ`207. [match(`38:-666) `207:-4\r
-611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `\r
-40:-4611686018427387904 with 10 => λ`208. [match(`43:-666) `208:-4611686018427387904 `50:-4611686018427387904 `49:-46116\r
-86018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`209. [match(`48:-\r
-666) `209:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-461168601\r
-8427387904 `52:-4611686018427387904 with 12 => λ`210. [match(`53:-666) `210:-4611686018427387904 `79:-461168601842738790\r
-4 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`211.\r
-[match(`75:-666) `211:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904\r
- `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`211. [match(`76:-666) `211:-46116\r
-86018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-\r
-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`210. [match(`54:-666) `210:-4611686018427387904\r
- `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116860184273\r
-87904 with 15 => λ`211. [match(`60:-666) `211:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68\r
-:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:\r
--666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`207. [match(`17\r
-6:-666) `207:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-) with 26 => λ`207. [match(`100:-666) `207:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387904 `105\r
-:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`208. [match(`106:-666) `208:-4611\r
-686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904\r
-`128:-4611686018427387904 with 33 => λ`209. [match(`130:-666) `209:-4611686018427387904 `138:-4611686018427387904 `137:-\r
-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`210. [mat\r
-ch(`135:-666) `210:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `1\r
-41:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`211. [match(`140:-666) `211:-4611686018427387904 `150:-46\r
-11686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-461168601842738790\r
-4 with 37 => `152:-666] )] )] )] ) | 29 => λ`208. [match(`107:-666) `208:-4611686018427387904 `114:-4611686018427387904\r
-`113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30 => λ`209\r
-. [match(`112:-666) `209:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387\r
-904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] λ`207. [match(`\r
-194:1) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-461\r
-1686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: `152:1 a:0\r
-| 5: 5\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: 8\r
-| 9: `102:0 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `193:0 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `203:0 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (λ`207. [match(`194:1) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4\r
-611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `2\r
-06:-666] )) `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904\r
-| 18: `95:0 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 19: 6\r
-| 20: `204:0 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: 29\r
-| 30: `113:1 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904\r
-| 31: `206:2 [match(`195:2) [match(e:3) [match(f:1) `174:-4611686018427387904 `32:-4611686018427387904 `31:-461168601842\r
-7387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`207. [match(`32:-666) `20\r
-7:-4611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-46116860184273879\r
-04 `34:-4611686018427387904 with 9 => λ`208. [match(`37:-666) `208:-4611686018427387904 `44:-4611686018427387904 `43:-46\r
-11686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`209. [match(`4\r
-2:-666) `209:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-461168\r
-6018427387904 `46:-4611686018427387904 with 11 => λ`210. [match(`47:-666) `210:-4611686018427387904 `56:-461168601842738\r
-7904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`21\r
-1. [match(`52:-666) `211:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904\r
- `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`212. [match(`74:-666) `212:-4611686018427387904 `126:-46\r
-11686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-461168601842738790\r
-4 with 32 => `127:-666] ) | 21 => λ`212. [match(`75:-666) `212:-4611686018427387904 `86:-4611686018427387904 `85:-461168\r
-6018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88\r
-:-666] )] ) | 13 => λ`211. [match(`53:-666) `211:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904\r
-`61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`212. [match(`59:-666) `212:-4611\r
-686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:\r
--4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`\r
-207. [match(`63:-666) `207:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-46116860184273\r
-87904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`208. [match(`193:-666) `208:-46\r
-11686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-461168601842738790\r
-4 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-666] )] `173:-4611\r
-686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with 46 => `176:-666 | 47 => λ`207. [match(`176:-66\r
-6) `207:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686\r
-018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-666 | 5\r
-1 => `181:-666] λ`207. i:2 h:1 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46116\r
-86018427387904 `198:-4611686018427387904) with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) `120:-461168601842\r
-7387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `197:3 (λ`207. `207:2 (λ`208. [match(d:1) `208:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`209. [match(`30:-666) `209:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`210. [match(`35:-666) `210:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`211. [match(`40:-6\r
-66) `211:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`212. [match(`45:-666) `212:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`213. [\r
-match(`50:-666) `213:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`214. [match(`72:-666) `214:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`214. [match(`73:-666) `214:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`213. [match(`51:-666) `213:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`214. [match(`57:-666) `214:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`209.\r
- [match(`61:-666) `209:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`210. [match(`191:-666) `210:-461168\r
-6018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `1\r
-98:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-666] )] ))) (λ`207. [m\r
-atch(`80:1) `207:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-46\r
-11686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )) `132:-4611686018427387904 `131:-4611\r
-686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: 36\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: 36\r
-| 39: h:2 (λ`207. λ`208. [match(n:1) `208:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`209. [match(s:-666) `209:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: `134:-4611686018427387904 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611\r
-686018427387904 `153:-4611686018427387904\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: 44\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: `105:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 50: `144:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-| 53: `62:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-4611686018427387904 `189:-46116\r
-86018427387904 `188:-4611686018427387904\r
-| 54: `192:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 55: 55\r
-| 56: `191:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 58: u:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686\r
-018427387904 `198:-4611686018427387904\r
-| 59: `79:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46116\r
-86018427387904 `198:-4611686018427387904\r
-| 60: `202:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-46116860\r
-18427387904 `89:-4611686018427387904\r
-| 61: `205:0 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904\r
-|\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-dangerous_conv lenght:5\r
-`37 `192 `191 `190 `189 `188 `36 `35 `34 `74 `37 `192 `191 `190 `189 `188 `193 `202 `201 `200 `199 `198 `203 `204 `206 `\r
-197 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `76 `75 `126 `125 `124 `123 `122\r
- `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151 h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-# INST_IN_EAT: `95 := λ`207. λ`208. λ`209. λ`210. 18\r
-# INST_IN_EAT: `102 := λ`207. λ`208. λ`209. λ`210. 9\r
-# INST_IN_EAT: `105 := λ`207. λ`208. λ`209. λ`210. λ`211. 49\r
-# INST_IN_EAT: `113 := λ`207. λ`208. λ`209. 30\r
-# INST_IN_EAT: `134 := λ`207. λ`208. λ`209. λ`210. λ`211. 40\r
-# INST_IN_EAT: `144 := λ`207. λ`208. λ`209. λ`210. λ`211. 50\r
-# INST_IN_EAT: `152 := λ`207. 4\r
-# INST_IN_EAT: `205 := λ`207. λ`208. λ`209. λ`210. 61\r
-dangerous_conv lenght:5\r
-`37 `192 `191 `190 `189 `188 `36 `35 `34 `74 `37 `192 `191 `190 `189 `188 `193 `202 `201 `200 `199 `198 `203 `204 `206 `\r
-197 `36 `35 `34 `44 `43 `42 `41 `40 `50 `49 `48 `47 `46 `56 `55 `54 `53 `52 `79 `78 `77 `76 `75 `126 `125 `124 `123 `122\r
- `127 `86 `85 `84 `83 `82 `87 `88 `63 `62 `61 `60 `59 `70 `69 `68 `67 `66 `72 `73 `74 `151 h\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=50 freshno = 206\r
-|> DISCRIMINATING SETS (deltas)\r
-| 58 <> 59 <> 61\r
-| 53 <> 55 <> 57\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) [match(`64:1) `37:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`207. [match(`19\r
-4:-666) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46\r
-11686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-66\r
-6] `36:-4611686018427387904 `35:-4611686018427387904 `34:-4611686018427387904) with 9 => λ`207. [match(`38:-666) `207:-4\r
-611686018427387904 `44:-4611686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `\r
-40:-4611686018427387904 with 10 => λ`208. [match(`43:-666) `208:-4611686018427387904 `50:-4611686018427387904 `49:-46116\r
-86018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`209. [match(`48:-\r
-666) `209:-4611686018427387904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-461168601\r
-8427387904 `52:-4611686018427387904 with 12 => λ`210. [match(`53:-666) `210:-4611686018427387904 `79:-461168601842738790\r
-4 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`211.\r
-[match(`75:-666) `211:-4611686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904\r
- `123:-4611686018427387904 `122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`211. [match(`76:-666) `211:-46116\r
-86018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-\r
-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`210. [match(`54:-666) `210:-4611686018427387904\r
- `63:-4611686018427387904 `62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-46116860184273\r
-87904 with 15 => λ`211. [match(`60:-666) `211:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68\r
-:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:\r
--666] ) | 36 => `151:-666] )] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`207. [match(`17\r
-6:-666) `207:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-) with 26 => λ`207. [match(`100:-666) `207:-4611686018427387904 `107:-4611686018427387904 `106:-4611686018427387904 `105\r
-:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`208. [match(`106:-666) `208:-4611\r
-686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-4611686018427387904\r
-`128:-4611686018427387904 with 33 => λ`209. [match(`130:-666) `209:-4611686018427387904 `138:-4611686018427387904 `137:-\r
-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with 34 => λ`210. [mat\r
-ch(`135:-666) `210:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611686018427387904 `1\r
-41:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`211. [match(`140:-666) `211:-4611686018427387904 `150:-46\r
-11686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-461168601842738790\r
-4 with 37 => `152:-666] )] )] )] ) | 29 => λ`208. [match(`107:-666) `208:-4611686018427387904 `114:-4611686018427387904\r
-`113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-4611686018427387904 with 30 => λ`209\r
-. [match(`112:-666) `209:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387\r
-904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-666] λ`207. [match(`\r
-194:1) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-461\r
-1686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: 8\r
-| 9: 9\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `193:0 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `203:0 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (λ`207. [match(`194:1) `207:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4\r
-611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `2\r
-06:-666] )) `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904\r
-| 18: 18\r
-| 19: 6\r
-| 20: `204:0 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: 29\r
-| 30: 30\r
-| 31: `206:2 [match(`195:2) [match(e:3) [match(f:1) `174:-4611686018427387904 `32:-4611686018427387904 `31:-461168601842\r
-7387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`207. [match(`32:-666) `20\r
-7:-4611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-46116860184273879\r
-04 `34:-4611686018427387904 with 9 => λ`208. [match(`37:-666) `208:-4611686018427387904 `44:-4611686018427387904 `43:-46\r
-11686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`209. [match(`4\r
-2:-666) `209:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-461168\r
-6018427387904 `46:-4611686018427387904 with 11 => λ`210. [match(`47:-666) `210:-4611686018427387904 `56:-461168601842738\r
-7904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`21\r
-1. [match(`52:-666) `211:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904\r
- `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`212. [match(`74:-666) `212:-4611686018427387904 `126:-46\r
-11686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-461168601842738790\r
-4 with 32 => `127:-666] ) | 21 => λ`212. [match(`75:-666) `212:-4611686018427387904 `86:-4611686018427387904 `85:-461168\r
-6018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88\r
-:-666] )] ) | 13 => λ`211. [match(`53:-666) `211:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904\r
-`61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`212. [match(`59:-666) `212:-4611\r
-686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:\r
--4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`\r
-207. [match(`63:-666) `207:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-46116860184273\r
-87904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`208. [match(`193:-666) `208:-46\r
-11686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-461168601842738790\r
-4 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-666] )] `173:-4611\r
-686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with 46 => `176:-666 | 47 => λ`207. [match(`176:-66\r
-6) `207:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686\r
-018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-666 | 5\r
-1 => `181:-666] λ`207. i:2 h:1 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46116\r
-86018427387904 `198:-4611686018427387904) with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) `120:-461168601842\r
-7387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `197:3 (λ`207. `207:2 (λ`208. [match(d:1) `208:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`209. [match(`30:-666) `209:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`210. [match(`35:-666) `210:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`211. [match(`40:-6\r
-66) `211:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`212. [match(`45:-666) `212:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`213. [\r
-match(`50:-666) `213:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`214. [match(`72:-666) `214:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`214. [match(`73:-666) `214:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`213. [match(`51:-666) `213:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`214. [match(`57:-666) `214:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`209.\r
- [match(`61:-666) `209:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`210. [match(`191:-666) `210:-461168\r
-6018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `1\r
-98:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => `206:-666] ) | 57 => `197:-666] )] ))) (λ`207. [m\r
-atch(`80:1) `207:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-46\r
-11686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )) `132:-4611686018427387904 `131:-4611\r
-686018427387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: 36\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: 36\r
-| 39: h:2 (λ`207. λ`208. [match(n:1) `208:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`209. [match(s:-666) `209:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: 40\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: 44\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-| 53: `62:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-4611686018427387904 `189:-46116\r
-86018427387904 `188:-4611686018427387904\r
-| 54: `192:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 55: 55\r
-| 56: `191:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 58: u:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686\r
-018427387904 `198:-4611686018427387904\r
-| 59: `79:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46116\r
-86018427387904 `198:-4611686018427387904\r
-| 60: `202:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-46116860\r
-18427387904 `89:-4611686018427387904\r
-| 61: 61\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 50 58= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-INSTANTIATING CRITICAL TO EAT h\r
-INSTANTIATING AND HOPING `206\r
-WARNING: using constant initialSpecialK\r
-# INST: `206 := λ`216. [match(`205:666) `216:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `2\r
-09:-4611686018427387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=49 freshno = 215\r
-|> DISCRIMINATING SETS (deltas)\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 52\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: `74:2 [match(`33:3) [match(`64:1) `37:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190\r
-:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`216. [match(`19\r
-4:-666) `216:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46\r
-11686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`217. [match(`204:-666) `217\r
-:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `208:-46116860184273\r
-87904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] ) | 57 => `197:-666] `36:-4611686018427387904\r
- `35:-4611686018427387904 `34:-4611686018427387904) with 9 => λ`216. [match(`38:-666) `216:-4611686018427387904 `44:-461\r
-1686018427387904 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 wit\r
-h 10 => λ`217. [match(`43:-666) `217:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686\r
-018427387904 `47:-4611686018427387904 `46:-4611686018427387904 with 11 => λ`218. [match(`48:-666) `218:-4611686018427387\r
-904 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116860184\r
-27387904 with 12 => λ`219. [match(`53:-666) `219:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904\r
-`77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`220. [match(`75:-666) `220:-4611\r
-686018427387904 `126:-4611686018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904\r
-`122:-4611686018427387904 with 32 => `127:-666] ) | 21 => λ`220. [match(`76:-666) `220:-4611686018427387904 `86:-4611686\r
-018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22\r
- => `87:-666 | 23 => `88:-666] )] ) | 13 => λ`219. [match(`54:-666) `219:-4611686018427387904 `63:-4611686018427387904 `\r
-62:-4611686018427387904 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`220. [ma\r
-tch(`60:-666) `220:-4611686018427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-\r
-4611686018427387904 `66:-4611686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666]\r
-)] )] )] )] h:1)\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`216. [match(`17\r
-6:-666) `216:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 52 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`216. [match(`100:-666) `216:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`217. [match(`10\r
-6:-666) `217:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`218. [match(`130:-666) `218:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`219. [match(`135:-666) `219:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`220. [match(`140:-666) `220:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`217. [match(`107:-666) `217:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`218. [match(`112:-666) `218:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`216. [match(`194:1) `216:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`217. [matc\r
-h(`204:-666) `217:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: `127:1 a:0\r
-| 1: `87:0\r
-| 2: `72:1 a:0\r
-| 3: `73:1 a:0\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: `176:0 x:-4611686018427387904 w:-4611686018427387904\r
-| 8: 8\r
-| 9: 9\r
-| 10: i:2 h:1 `43:-4611686018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904\r
-| 11: `187:1 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018427387904 `46:-4611686018427387904\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: `178:0 `31:-4611686018427387904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904\r
-| 15: `193:0 `61:-4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904\r
-| 16: `203:0 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (λ`216. [match(`194:1) `216:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4\r
-611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`\r
-217. [match(`204:-666) `217:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427\r
-387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `70:-4611686018\r
-427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: 18\r
-| 19: 6\r
-| 20: `204:0 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: a:0 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-46116\r
-86018427387904\r
-| 23: `85:1 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: `38:-4611686018427387904 `100:-4611686018427387904 `99:-4611686018427387904 `98:-4611686018427387904 `97:-46116860\r
-18427387904 `96:-4611686018427387904\r
-| 28: `179:0 `104:-4611686018427387904 `103:-4611686018427387904\r
-| 29: 29\r
-| 30: 30\r
-| 31: `215:1 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `11\r
-6:-4611686018427387904\r
-| 32: `126:2 `126:1 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904\r
-| 33: `197:3 (λ`216. `216:2 (λ`217. [match(d:1) `217:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387\r
-904 `30:-4611686018427387904 `29:-4611686018427387904 `28:-4611686018427387904 with 8 => λ`218. [match(`30:-666) `218:-4\r
-611686018427387904 `38:-4611686018427387904 `37:-4611686018427387904 `36:-4611686018427387904 `35:-4611686018427387904 `\r
-34:-4611686018427387904 with 9 => λ`219. [match(`35:-666) `219:-4611686018427387904 `44:-4611686018427387904 `43:-461168\r
-6018427387904 `42:-4611686018427387904 `41:-4611686018427387904 `40:-4611686018427387904 with 10 => λ`220. [match(`40:-6\r
-66) `220:-4611686018427387904 `50:-4611686018427387904 `49:-4611686018427387904 `48:-4611686018427387904 `47:-4611686018\r
-427387904 `46:-4611686018427387904 with 11 => λ`221. [match(`45:-666) `221:-4611686018427387904 `56:-4611686018427387904\r
- `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904 with 12 => λ`222. [\r
-match(`50:-666) `222:-4611686018427387904 `79:-4611686018427387904 `78:-4611686018427387904 `77:-4611686018427387904 `76\r
-:-4611686018427387904 `75:-4611686018427387904 with 20 => λ`223. [match(`72:-666) `223:-4611686018427387904 `126:-461168\r
-6018427387904 `125:-4611686018427387904 `124:-4611686018427387904 `123:-4611686018427387904 `122:-4611686018427387904 wi\r
-th 32 => `127:-666] ) | 21 => λ`223. [match(`73:-666) `223:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018\r
-427387904 `84:-4611686018427387904 `83:-4611686018427387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-66\r
-6] )] ) | 13 => λ`222. [match(`51:-666) `222:-4611686018427387904 `63:-4611686018427387904 `62:-4611686018427387904 `61:\r
--4611686018427387904 `60:-4611686018427387904 `59:-4611686018427387904 with 15 => λ`223. [match(`57:-666) `223:-46116860\r
-18427387904 `70:-4611686018427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-461\r
-1686018427387904 with 17 => `72:-666 | 18 => `73:-666 | 6 => `74:-666] ) | 36 => `151:-666] )] )] )] )] ) | 14 => λ`218.\r
- [match(`61:-666) `218:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-461168601842738790\r
-4 `189:-4611686018427387904 `188:-4611686018427387904 with 53 => `193:-666 | 55 => λ`219. [match(`191:-666) `219:-461168\r
-6018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `1\r
-98:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`220. [match(`201:-666) `220:-461168601842738790\r
-4 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `208:-4611686018427387904 `207:-46116860\r
-18427387904 with 65 => `215:-666] ) | 64 => `214:-666] ) | 57 => `197:-666] ) | 62 => `212:-666] ))) (λ`216. [match(`80:\r
-1) `216:-4611686018427387904 `86:-4611686018427387904 `85:-4611686018427387904 `84:-4611686018427387904 `83:-46116860184\r
-27387904 `82:-4611686018427387904 with 22 => `87:-666 | 23 => `88:-666] )) `132:-4611686018427387904 `131:-4611686018427\r
-387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904\r
-| 34: 34\r
-| 35: `180:0 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904\r
-| 36: 36\r
-| 37: `151:1 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `14\r
-6:-4611686018427387904\r
-| 38: 36\r
-| 39: h:2 (λ`216. λ`217. [match(n:1) `217:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`218. [match(s:-666) `218:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: 40\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: `165:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 44: 44\r
-| 45: `181:0 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: `50:1 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: i:2 h:1 `185:-4611686018427387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904\r
-| 53: `62:-4611686018427387904 `192:-4611686018427387904 `191:-4611686018427387904 `190:-4611686018427387904 `189:-46116\r
-86018427387904 `188:-4611686018427387904\r
-| 54: `192:-4611686018427387904 `165:-4611686018427387904 `164:-4611686018427387904 `163:-4611686018427387904 `162:-4611\r
-686018427387904 `161:-4611686018427387904\r
-| 55: 55\r
-| 56: `191:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 58: u:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686\r
-018427387904 `198:-4611686018427387904\r
-| 59: `79:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-46116\r
-86018427387904 `198:-4611686018427387904\r
-| 60: `202:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-46116860\r
-18427387904 `89:-4611686018427387904\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: `212:0 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904\r
-| 64: `213:2 (λ`216. i:2 h:1) `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-461168\r
-6018427387904 `198:-4611686018427387904\r
-| 65: `214:1 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `208:-4611686018427387904 `20\r
-7:-4611686018427387904\r
-|\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-dangerous_inert_conv: ar=4 k=`100 listlenargs=9\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-# INST_IN_EAT: a := λ`216. λ`217. λ`218. λ`219. λ`220. 22\r
-# INST_IN_EAT: i := λ`216. λ`217. λ`218. λ`219. λ`220. 10\r
-# INST_IN_EAT: `38 := λ`216. λ`217. λ`218. λ`219. λ`220. 27\r
-# INST_IN_EAT: `50 := λ`216. λ`217. λ`218. λ`219. 47\r
-# INST_IN_EAT: `62 := λ`216. λ`217. λ`218. λ`219. λ`220. 53\r
-# INST_IN_EAT: `72 := λ`216. 2\r
-# INST_IN_EAT: `73 := λ`216. 3\r
-# INST_IN_EAT: `79 := λ`216. λ`217. λ`218. λ`219. λ`220. 59\r
-# INST_IN_EAT: `85 := λ`216. λ`217. λ`218. 23\r
-# INST_IN_EAT: `87 := 1\r
-# INST_IN_EAT: `126 := λ`216. λ`217. λ`218. λ`219. 32\r
-# INST_IN_EAT: `127 := λ`216. 0\r
-# INST_IN_EAT: `151 := λ`216. λ`217. λ`218. λ`219. λ`220. 37\r
-# INST_IN_EAT: `165 := λ`216. λ`217. λ`218. λ`219. λ`220. 43\r
-# INST_IN_EAT: `176 := λ`216. λ`217. 7\r
-# INST_IN_EAT: `178 := λ`216. λ`217. λ`218. λ`219. 14\r
-# INST_IN_EAT: `179 := λ`216. λ`217. 28\r
-# INST_IN_EAT: `180 := λ`216. λ`217. λ`218. λ`219. 35\r
-# INST_IN_EAT: `181 := λ`216. λ`217. λ`218. 45\r
-# INST_IN_EAT: `187 := λ`216. λ`217. λ`218. λ`219. 11\r
-# INST_IN_EAT: `191 := λ`216. λ`217. λ`218. λ`219. λ`220. 56\r
-# INST_IN_EAT: `192 := λ`216. λ`217. λ`218. λ`219. λ`220. 54\r
-# INST_IN_EAT: `193 := λ`216. λ`217. λ`218. 15\r
-# INST_IN_EAT: `197 := λ`216. λ`217. λ`218. λ`219. λ`220. λ`221. λ`222. 33\r
-# INST_IN_EAT: `212 := λ`216. λ`217. λ`218. 63\r
-# INST_IN_EAT: `213 := λ`216. λ`217. λ`218. λ`219. λ`220. λ`221. 64\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-FREEZING `74\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=18 freshno = 215\r
-|> DISCRIMINATING SETS (deltas)\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`216. [match(`17\r
-6:-666) `216:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`216. [match(`100:-666) `216:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`217. [match(`10\r
-6:-666) `217:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`218. [match(`130:-666) `218:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`219. [match(`135:-666) `219:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`220. [match(`140:-666) `220:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`217. [match(`107:-666) `217:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`218. [match(`112:-666) `218:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`216. [match(`194:1) `216:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`217. [matc\r
-h(`204:-666) `217:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: h:1 `56:-4611686018427387904 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-46116\r
-86018427387904\r
-| 14: 14\r
-| 15: 15\r
-| 16: `203:0 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (λ`216. [match(`194:1) `216:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4\r
-611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`\r
-217. [match(`204:-666) `217:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427\r
-387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `70:-4611686018\r
-427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: 18\r
-| 19: 6\r
-| 20: `204:0 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: 22\r
-| 23: 23\r
-| 24: h:1 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-46116\r
-86018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: `215:1 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `11\r
-6:-4611686018427387904\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: h:2 (λ`216. λ`217. [match(n:1) `217:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-46116860\r
-18427387904 r:-4611686018427387904 q:-4611686018427387904 with 6 => λ`218. [match(s:-666) `218:-4611686018427387904 `26:\r
--4611686018427387904 z:-4611686018427387904 y:-4611686018427387904 x:-4611686018427387904 w:-4611686018427387904 with 7\r
-=> `27:-666] ) | 16 => `71:-666 | 56 => `196:-666] )) `157:-4611686018427387904 `156:-4611686018427387904 `155:-46116860\r
-18427387904 `154:-4611686018427387904 `153:-4611686018427387904\r
-| 40: 40\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 58: u:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686\r
-018427387904 `198:-4611686018427387904\r
-| 59: 59\r
-| 60: `202:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-46116860\r
-18427387904 `89:-4611686018427387904\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: `214:1 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `208:-4611686018427387904 `20\r
-7:-4611686018427387904\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 18 50= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: h\r
-DANGEROUS EAT: `164\r
-INSTANTIATING CRITICAL TO EAT h\r
-INSTANTIATING AND HOPING h\r
-WARNING: using constant initialSpecialK\r
-# INST: h := λ`225. [match(g:666) `225:-4611686018427387904 `220:-4611686018427387904 `219:-4611686018427387904 `218:-46\r
-11686018427387904 `217:-4611686018427387904 `216:-4611686018427387904 with 66 => `221:-666 | 67 => `222:-666 | 69 => `22\r
-4:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=15 freshno = 224\r
-|> DISCRIMINATING SETS (deltas)\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: `27:1\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`225. [match(`17\r
-6:-666) `225:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`225. [match(`100:-666) `225:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`226. [match(`10\r
-6:-666) `226:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`227. [match(`130:-666) `227:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`228. [match(`135:-666) `228:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`229. [match(`140:-666) `229:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`226. [match(`107:-666) `226:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`227. [match(`112:-666) `227:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`225. [match(`194:1) `225:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`226. [matc\r
-h(`204:-666) `226:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: `221:0 `55:-4611686018427387904 `54:-4611686018427387904 `53:-4611686018427387904 `52:-4611686018427387904\r
-| 14: 14\r
-| 15: 15\r
-| 16: `203:0 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387904 q:-4611686018427387904\r
-| 17: `71:2 (λ`225. [match(`194:1) `225:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4\r
-611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`\r
-226. [match(`204:-666) `226:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427\r
-387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `70:-4611686018\r
-427387904 `69:-4611686018427387904 `68:-4611686018427387904 `67:-4611686018427387904 `66:-4611686018427387904\r
-| 18: 18\r
-| 19: 6\r
-| 20: `204:0 `78:-4611686018427387904 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 21: `78:1 `77:-4611686018427387904 `76:-4611686018427387904 `75:-4611686018427387904\r
-| 22: 22\r
-| 23: 23\r
-| 24: `222:0 `92:-4611686018427387904 `91:-4611686018427387904 `90:-4611686018427387904 `89:-4611686018427387904\r
-| 25: `70:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-461168601\r
-8427387904 `89:-4611686018427387904\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: `215:1 `120:-4611686018427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `11\r
-6:-4611686018427387904\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: `224:1 `157:-4611686018427387904 `156:-4611686018427387904 `155:-4611686018427387904 `154:-4611686018427387904 `15\r
-3:-4611686018427387904\r
-| 40: 40\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: y:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686\r
-018427387904 `171:-4611686018427387904\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: `196:0 `190:-4611686018427387904 `189:-4611686018427387904 `188:-4611686018427387904\r
-| 58: u:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-4611686018427387904 `199:-4611686\r
-018427387904 `198:-4611686018427387904\r
-| 59: 59\r
-| 60: `202:-4611686018427387904 `93:-4611686018427387904 `92:-4611686018427387904 `91:-4611686018427387904 `90:-46116860\r
-18427387904 `89:-4611686018427387904\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: `214:1 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `208:-4611686018427387904 `20\r
-7:-4611686018427387904\r
-| 66: `56:-4611686018427387904 `220:-4611686018427387904 `219:-4611686018427387904 `218:-4611686018427387904 `217:-46116\r
-86018427387904 `216:-4611686018427387904\r
-| 67: `93:-4611686018427387904 `220:-4611686018427387904 `219:-4611686018427387904 `218:-4611686018427387904 `217:-46116\r
-86018427387904 `216:-4611686018427387904\r
-| 68: `219:-4611686018427387904 u:-4611686018427387904 t:-4611686018427387904 s:-4611686018427387904 r:-4611686018427387\r
-904 q:-4611686018427387904\r
-| 69: `223:0 `218:-4611686018427387904 `217:-4611686018427387904 `216:-4611686018427387904\r
-|\r
-DANGEROUS EAT: `164\r
-dangerous_inert_conv: ar=4 k=`100 listlenargs=9\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-# INST_IN_EAT: u := λ`225. λ`226. λ`227. λ`228. λ`229. 58\r
-# INST_IN_EAT: y := λ`225. λ`226. λ`227. λ`228. λ`229. 46\r
-# INST_IN_EAT: `56 := λ`225. λ`226. λ`227. λ`228. λ`229. 66\r
-# INST_IN_EAT: `70 := λ`225. λ`226. λ`227. λ`228. λ`229. 25\r
-# INST_IN_EAT: `71 := λ`225. λ`226. λ`227. λ`228. λ`229. λ`230. 17\r
-# INST_IN_EAT: `78 := λ`225. λ`226. λ`227. 21\r
-# INST_IN_EAT: `93 := λ`225. λ`226. λ`227. λ`228. λ`229. 67\r
-# INST_IN_EAT: `196 := λ`225. λ`226. λ`227. 57\r
-# INST_IN_EAT: `202 := λ`225. λ`226. λ`227. λ`228. λ`229. 60\r
-# INST_IN_EAT: `203 := λ`225. λ`226. λ`227. λ`228. 16\r
-# INST_IN_EAT: `204 := λ`225. λ`226. λ`227. λ`228. 20\r
-# INST_IN_EAT: `214 := λ`225. λ`226. λ`227. λ`228. λ`229. 65\r
-# INST_IN_EAT: `215 := λ`225. λ`226. λ`227. λ`228. λ`229. 31\r
-# INST_IN_EAT: `219 := λ`225. λ`226. λ`227. λ`228. λ`229. 68\r
-# INST_IN_EAT: `221 := λ`225. λ`226. λ`227. λ`228. 13\r
-# INST_IN_EAT: `222 := λ`225. λ`226. λ`227. λ`228. 24\r
-# INST_IN_EAT: `223 := λ`225. λ`226. λ`227. 69\r
-# INST_IN_EAT: `224 := λ`225. λ`226. λ`227. λ`228. λ`229. 39\r
-Just created bomb var: x-226:-666\r
-# INST (div): `27 := x-226:-666\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=8 freshno = 225\r
-|> DISCRIMINATING SETS (deltas)\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: *\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`226. [match(`17\r
-6:-666) `226:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`226. [match(`100:-666) `226:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`227. [match(`10\r
-6:-666) `227:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`228. [match(`130:-666) `228:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`229. [match(`135:-666) `229:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`230. [match(`140:-666) `230:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`227. [match(`107:-666) `227:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`228. [match(`112:-666) `228:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`226. [match(`194:1) `226:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`227. [matc\r
-h(`204:-666) `227:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: 13\r
-| 14: 14\r
-| 15: 15\r
-| 16: 16\r
-| 17: 17\r
-| 18: 18\r
-| 19: 6\r
-| 20: 20\r
-| 21: 21\r
-| 22: 22\r
-| 23: 23\r
-| 24: 24\r
-| 25: 25\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: 31\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: 39\r
-| 40: 40\r
-| 41: 41\r
-| 42: `164:1 `163:-4611686018427387904 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: 46\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `164:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611\r
-686018427387904 `171:-4611686018427387904\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: 57\r
-| 58: 58\r
-| 59: 59\r
-| 60: 60\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: 65\r
-| 66: 66\r
-| 67: 67\r
-| 68: 68\r
-| 69: 69\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 8 18= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-DANGEROUS EAT: `164\r
-INSTANTIATING CRITICAL TO EAT `164\r
-@@@@ NEW INSTANTIATE PHASE (0) @@@@\r
-WARNING: using constant initialSpecialK\r
-# INST: `164 := λ`233. [match(`163:666) `233:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `2\r
-28:-4611686018427387904 `227:-4611686018427387904 `226:-4611686018427387904 with 70 => `231:-666 | 71 => `232:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=7 freshno = 232\r
-|> DISCRIMINATING SETS (deltas)\r
-| 70 <> 71\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: *\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`233. [match(`17\r
-6:-666) `233:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`233. [match(`100:-666) `233:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`234. [match(`10\r
-6:-666) `234:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`235. [match(`130:-666) `235:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`236. [match(`135:-666) `236:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`237. [match(`140:-666) `237:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`234. [match(`107:-666) `234:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`235. [match(`112:-666) `235:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`233. [match(`194:1) `233:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`234. [matc\r
-h(`204:-666) `234:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: 13\r
-| 14: 14\r
-| 15: 15\r
-| 16: 16\r
-| 17: 17\r
-| 18: 18\r
-| 19: 6\r
-| 20: 20\r
-| 21: 21\r
-| 22: 22\r
-| 23: 23\r
-| 24: 24\r
-| 25: 25\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: 31\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: 39\r
-| 40: 40\r
-| 41: 41\r
-| 42: `231:0 `162:-4611686018427387904 `161:-4611686018427387904\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: 46\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: `232:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611\r
-686018427387904\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: 57\r
-| 58: 58\r
-| 59: 59\r
-| 60: 60\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: 65\r
-| 66: 66\r
-| 67: 67\r
-| 68: 68\r
-| 69: 69\r
-| 70: `163:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `228:-4611686018427387904 `227:-4611\r
-686018427387904 `226:-4611686018427387904\r
-| 71: `175:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `228:-4611686018427387904 `227:-4611\r
-686018427387904 `226:-4611686018427387904\r
-|\r
-dangerous_inert_conv: ar=4 k=`100 listlenargs=9\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-# INST_IN_EAT: `163 := λ`233. λ`234. λ`235. λ`236. λ`237. 70\r
-# INST_IN_EAT: `231 := λ`233. λ`234. 42\r
-# INST_IN_EAT: `232 := λ`233. λ`234. λ`235. λ`236. 51\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`100 `175 `174 `173 `172 `171 `99 `98 `97 `96\r
-\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=7 freshno = 232\r
-|> DISCRIMINATING SETS (deltas)\r
-| 70 <> 71\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: *\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) `100:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173\r
-:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904 with 46 => `176:-666 | 47 => λ`233. [match(`17\r
-6:-666) `233:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427387904 `184:-4611686018427387904 `183:-46\r
-11686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `178:-666 | 49 => `179:-666 | 50 => `180:-66\r
-6 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4\r
-611686018427387904) with 26 => λ`233. [match(`100:-666) `233:-4611686018427387904 `107:-4611686018427387904 `106:-461168\r
-6018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686018427387904 with 28 => λ`234. [match(`10\r
-6:-666) `234:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427387904 `130:-4611686018427387904 `129:-46\r
-11686018427387904 `128:-4611686018427387904 with 33 => λ`235. [match(`130:-666) `235:-4611686018427387904 `138:-46116860\r
-18427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-4611686018427387904 `134:-4611686018427387904 with\r
- 34 => λ`236. [match(`135:-666) `236:-4611686018427387904 `144:-4611686018427387904 `143:-4611686018427387904 `142:-4611\r
-686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 => λ`237. [match(`140:-666) `237:-4611686018\r
-427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-4611686018427387904 `147:-4611686018427387904 `146:-\r
-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`234. [match(`107:-666) `234:-4611686018427387904 `114:-46\r
-11686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-4611686018427387904 `110:-461168601842738790\r
-4 with 30 => λ`235. [match(`112:-666) `235:-4611686018427387904 `120:-4611686018427387904 `119:-4611686018427387904 `118\r
-:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with 31 => `121:-666] )] )] ) | 27 => `102:-66\r
-6] λ`233. [match(`194:1) `233:-4611686018427387904 `202:-4611686018427387904 `201:-4611686018427387904 `200:-46116860184\r
-27387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-666 | 59 => `204:-666 | 61 => λ`234. [matc\r
-h(`204:-666) `234:-4611686018427387904 `211:-4611686018427387904 `210:-4611686018427387904 `209:-4611686018427387904 `20\r
-8:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 => `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: 13\r
-| 14: 14\r
-| 15: 15\r
-| 16: 16\r
-| 17: 17\r
-| 18: 18\r
-| 19: 6\r
-| 20: 20\r
-| 21: 21\r
-| 22: 22\r
-| 23: 23\r
-| 24: 24\r
-| 25: 25\r
-| 26: `100:1 `99:-4611686018427387904 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: 31\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: 39\r
-| 40: 40\r
-| 41: 41\r
-| 42: 42\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: 46\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: 51\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: 57\r
-| 58: 58\r
-| 59: 59\r
-| 60: 60\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: 65\r
-| 66: 66\r
-| 67: 67\r
-| 68: 68\r
-| 69: 69\r
-| 70: 70\r
-| 71: `175:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `228:-4611686018427387904 `227:-4611\r
-686018427387904 `226:-4611686018427387904\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 7 8= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-INSTANTIATING TO EAT `100\r
-WARNING: using constant initialSpecialK\r
-# INST: `100 := λ`239. [match(`99:666) `239:-4611686018427387904 `237:-4611686018427387904 `236:-4611686018427387904 `23\r
-5:-4611686018427387904 `234:-4611686018427387904 `233:-4611686018427387904 with 72 => `238:-666] )\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: instantiate |||||\r
-\r
-| measure=6 freshno = 238\r
-|> DISCRIMINATING SETS (deltas)\r
-| 72\r
-| 70 <> 71\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: *\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) [match(`100:-4611686018427387904) `175:-4611686018427387904 `237:-4611686018427387\r
-904 `236:-4611686018427387904 `235:-4611686018427387904 `234:-4611686018427387904 `233:-4611686018427387904 with 72 => `\r
-238:-666] `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with\r
-46 => `176:-666 | 47 => λ`239. [match(`176:-666) `239:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427\r
-387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `17\r
-8:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018\r
-427387904 `97:-4611686018427387904 `96:-4611686018427387904) with 26 => λ`239. [match(`100:-666) `239:-46116860184273879\r
-04 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686\r
-018427387904 with 28 => λ`240. [match(`106:-666) `240:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427\r
-387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`241. [match(`130:-666)\r
- `241:-4611686018427387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-461168601\r
-8427387904 `134:-4611686018427387904 with 34 => λ`242. [match(`135:-666) `242:-4611686018427387904 `144:-461168601842738\r
-7904 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 =>\r
-λ`243. [match(`140:-666) `243:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-46116860184\r
-27387904 `147:-4611686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`240. [match(`107\r
-:-666) `240:-4611686018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-461\r
-1686018427387904 `110:-4611686018427387904 with 30 => λ`241. [match(`112:-666) `241:-4611686018427387904 `120:-461168601\r
-8427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with\r
-31 => `121:-666] )] )] ) | 27 => `102:-666] λ`239. [match(`194:1) `239:-4611686018427387904 `202:-4611686018427387904 `2\r
-01:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-6\r
-66 | 59 => `204:-666 | 61 => λ`240. [match(`204:-666) `240:-4611686018427387904 `211:-4611686018427387904 `210:-46116860\r
-18427387904 `209:-4611686018427387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 =\r
-> `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: 13\r
-| 14: 14\r
-| 15: 15\r
-| 16: 16\r
-| 17: 17\r
-| 18: 18\r
-| 19: 6\r
-| 20: 20\r
-| 21: 21\r
-| 22: 22\r
-| 23: 23\r
-| 24: 24\r
-| 25: 25\r
-| 26: `238:0 `98:-4611686018427387904 `97:-4611686018427387904 `96:-4611686018427387904\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: 31\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: 39\r
-| 40: 40\r
-| 41: 41\r
-| 42: 42\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: 46\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: 51\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: 57\r
-| 58: 58\r
-| 59: 59\r
-| 60: 60\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: 65\r
-| 66: 66\r
-| 67: 67\r
-| 68: 68\r
-| 69: 69\r
-| 70: 70\r
-| 71: `175:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `228:-4611686018427387904 `227:-4611\r
-686018427387904 `226:-4611686018427387904\r
-| 72: `99:-4611686018427387904 `237:-4611686018427387904 `236:-4611686018427387904 `235:-4611686018427387904 `234:-46116\r
-86018427387904 `233:-4611686018427387904\r
-|\r
-dangerous_inert_conv: ar=5 k=`175 listlenargs=9\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`175 `237 `236 `235 `234 `233 `174 `173 `172 `171\r
-\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`175 `237 `236 `235 `234 `233 `174 `173 `172 `171\r
-\r
-# INST_IN_EAT: `99 := λ`239. λ`240. λ`241. λ`242. λ`243. 72\r
-# INST_IN_EAT: `238 := λ`239. λ`240. λ`241. 26\r
-dangerous_conv lenght:5\r
-\r
-\r
-\r
-`175 `237 `236 `235 `234 `233 `174 `173 `172 `171\r
-\r
-------------------------------------------------------------------------------------------------------------------------\r
-\r
-||||| Displaying problem: eat |||||\r
-\r
-| measure=6 freshno = 238\r
-|> DISCRIMINATING SETS (deltas)\r
-| 72\r
-| 70 <> 71\r
-| 66 <> 67 <> 69\r
-| 65\r
-| 58 <> 59 <> 61 <> 64\r
-| 53 <> 55 <> 57\r
-| 10\r
-| 46 <> 47 <> 48 <> 49 <> 50 <> 51 <> 63\r
-| 41 <> 42 <> 43 <> 44 <> 45 <> 54\r
-| 36 <> 39 <> 40\r
-| 37\r
-| 35\r
-| 34\r
-| 33\r
-| 32\r
-| 31\r
-| 30\r
-| 28 <> 29\r
-| 26 <> 27\r
-| 24 <> 25 <> 60\r
-| 22 <> 23\r
-| 20 <> 21\r
-| 17 <> 18 <> 6\r
-| 15 <> 36\r
-| 12 <> 13\r
-| 11\r
-| 10\r
-| 9\r
-| 8 <> 14 <> 62\r
-| 7\r
-| 6 <> 16 <> 56 <> 68\r
-| 5\r
-| 0 <> 1 <> 2 <> 3 <> 4\r
-|> DIVERGENT\r
-| *: *\r
-|> CONVERGENT\r
-| _: _\r
-| _: _\r
-| _: _\r
-| _: `121:3 [match(`94:3) [match(e:1) [match(`100:-4611686018427387904) `175:-4611686018427387904 `237:-4611686018427387\r
-904 `236:-4611686018427387904 `235:-4611686018427387904 `234:-4611686018427387904 `233:-4611686018427387904 with 72 => `\r
-238:-666] `174:-4611686018427387904 `173:-4611686018427387904 `172:-4611686018427387904 `171:-4611686018427387904) with\r
-46 => `176:-666 | 47 => λ`239. [match(`176:-666) `239:-4611686018427387904 `186:-4611686018427387904 `185:-4611686018427\r
-387904 `184:-4611686018427387904 `183:-4611686018427387904 `182:-4611686018427387904 with 10 => `187:-666] ) | 48 => `17\r
-8:-666 | 49 => `179:-666 | 50 => `180:-666 | 51 => `181:-666 | 63 => `213:-666] `99:-4611686018427387904 `98:-4611686018\r
-427387904 `97:-4611686018427387904 `96:-4611686018427387904) with 26 => λ`239. [match(`100:-666) `239:-46116860184273879\r
-04 `107:-4611686018427387904 `106:-4611686018427387904 `105:-4611686018427387904 `104:-4611686018427387904 `103:-4611686\r
-018427387904 with 28 => λ`240. [match(`106:-666) `240:-4611686018427387904 `132:-4611686018427387904 `131:-4611686018427\r
-387904 `130:-4611686018427387904 `129:-4611686018427387904 `128:-4611686018427387904 with 33 => λ`241. [match(`130:-666)\r
- `241:-4611686018427387904 `138:-4611686018427387904 `137:-4611686018427387904 `136:-4611686018427387904 `135:-461168601\r
-8427387904 `134:-4611686018427387904 with 34 => λ`242. [match(`135:-666) `242:-4611686018427387904 `144:-461168601842738\r
-7904 `143:-4611686018427387904 `142:-4611686018427387904 `141:-4611686018427387904 `140:-4611686018427387904 with 35 =>\r
-λ`243. [match(`140:-666) `243:-4611686018427387904 `150:-4611686018427387904 `149:-4611686018427387904 `148:-46116860184\r
-27387904 `147:-4611686018427387904 `146:-4611686018427387904 with 37 => `152:-666] )] )] )] ) | 29 => λ`240. [match(`107\r
-:-666) `240:-4611686018427387904 `114:-4611686018427387904 `113:-4611686018427387904 `112:-4611686018427387904 `111:-461\r
-1686018427387904 `110:-4611686018427387904 with 30 => λ`241. [match(`112:-666) `241:-4611686018427387904 `120:-461168601\r
-8427387904 `119:-4611686018427387904 `118:-4611686018427387904 `117:-4611686018427387904 `116:-4611686018427387904 with\r
-31 => `121:-666] )] )] ) | 27 => `102:-666] λ`239. [match(`194:1) `239:-4611686018427387904 `202:-4611686018427387904 `2\r
-01:-4611686018427387904 `200:-4611686018427387904 `199:-4611686018427387904 `198:-4611686018427387904 with 58 => `203:-6\r
-66 | 59 => `204:-666 | 61 => λ`240. [match(`204:-666) `240:-4611686018427387904 `211:-4611686018427387904 `210:-46116860\r
-18427387904 `209:-4611686018427387904 `208:-4611686018427387904 `207:-4611686018427387904 with 65 => `215:-666] ) | 64 =\r
-> `214:-666] )) `121:1\r
-| _: _\r
-|> NUMERIC\r
-| 0: 0\r
-| 1: 1\r
-| 2: 2\r
-| 3: 3\r
-| 4: 4\r
-| 5: 5\r
-| 6: 6\r
-| 7: 7\r
-| 8: 8\r
-| 9: 9\r
-| 10: 10\r
-| 11: 11\r
-| 12: 12\r
-| 13: 13\r
-| 14: 14\r
-| 15: 15\r
-| 16: 16\r
-| 17: 17\r
-| 18: 18\r
-| 19: 6\r
-| 20: 20\r
-| 21: 21\r
-| 22: 22\r
-| 23: 23\r
-| 24: 24\r
-| 25: 25\r
-| 26: 26\r
-| 27: 27\r
-| 28: 28\r
-| 29: 29\r
-| 30: 30\r
-| 31: 31\r
-| 32: 32\r
-| 33: 33\r
-| 34: 34\r
-| 35: 35\r
-| 36: 36\r
-| 37: 37\r
-| 38: 36\r
-| 39: 39\r
-| 40: 40\r
-| 41: 41\r
-| 42: 42\r
-| 43: 43\r
-| 44: 44\r
-| 45: 45\r
-| 46: 46\r
-| 47: 47\r
-| 48: `32:-4611686018427387904 `175:-4611686018427387904 `174:-4611686018427387904 `173:-4611686018427387904 `172:-46116\r
-86018427387904 `171:-4611686018427387904\r
-| 49: 49\r
-| 50: 50\r
-| 51: 51\r
-| 52: 10\r
-| 53: 53\r
-| 54: 54\r
-| 55: 55\r
-| 56: 56\r
-| 57: 57\r
-| 58: 58\r
-| 59: 59\r
-| 60: 60\r
-| 61: 61\r
-| 62: `174:-4611686018427387904 `32:-4611686018427387904 `31:-4611686018427387904 `30:-4611686018427387904 `29:-46116860\r
-18427387904 `28:-4611686018427387904\r
-| 63: 63\r
-| 64: 64\r
-| 65: 65\r
-| 66: 66\r
-| 67: 67\r
-| 68: 68\r
-| 69: 69\r
-| 70: 70\r
-| 71: `175:-4611686018427387904 `230:-4611686018427387904 `229:-4611686018427387904 `228:-4611686018427387904 `227:-4611\r
-686018427387904 `226:-4611686018427387904\r
-| 72: 72\r
-|\r
-{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}\r
-compare 6 7= 1\r
-$ Measure decreased by 1\r
-{{{{{{{{ Computing measure before auto_instantiate }}}}}}\r
-Fatal error: exception Assert_failure("lambda4.ml", 490, 15)\r
diff --git a/ocaml/measure.ml b/ocaml/measure.ml
deleted file mode 100644 (file)
index 53b0fbc..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-open Num;;\r
-open Lambda4;;\r
-\r
-(* type var = int;;\r
-\r
-type state = {\r
- terms : nf list;\r
- arities : (var * int) list;\r
- freshno : int;\r
- apps : (var * (var list)) list;\r
-}\r
-\r
-let replace =\r
- function\r
- | `Var _ | `Lam _ as t -> t\r
- | `I(v,tms) ->\r
-   try\r
-    let apps = List.assoc v p.apps in\r
-    let hd, tl = ... in\r
-    let s, freshvar = mk_freshvar s\r
-    []\r
-    aux (mk_apps v (Listx.map ))\r
-   with\r
-   | Not_found -> `I(v, Listx.map (replace s) tms)\r
- | _ -> assert false\r
-;;\r
-\r
-\r
-let iteration : state -> state  = fun s ->\r
- let terms = Util.concat_map (replace s) s.terms in\r
- s;;\r
-*)\r
diff --git a/ocaml/num.ml b/ocaml/num.ml
deleted file mode 100644 (file)
index aa9338c..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-open Util
-open Util.Vars
-open Pure
-
-(* debug options *)
-let debug_display_arities = false;;
-
-(************ Syntax ************************************)
-
-(* Normal forms*)
-
-(* Var n = n-th De Bruijn index, 0-based *)
-
-(*type nf =
-  | Lam of nf
-  | Var of int
-  | i
-and i =
-  | I of int * nf listx
-;;*)
-type var = int * (* arity of variable*) int;;
-type 'nf_nob i_var_ = [ `I of var * 'nf_nob Listx.listx | `Var of var ]
-type 'nf_nob i_n_var_ = [ `N of int | 'nf_nob i_var_ ]
-type ('nf_nob,'nf) i_num_var_ = [
-  | 'nf_nob i_n_var_
-  | `Match of ('nf_nob,'nf) i_num_var_ * (* originating var *) var * (*lift*) int * (*branches*)(int * 'nf) list ref * (*args*)'nf_nob list
-]
-type 'nf nf_nob_ = [ `Lam of (* was_unpacked *) bool * 'nf | `Pacman | ('nf nf_nob_,'nf) i_num_var_ ]
-type nf = [ nf nf_nob_ | `Bottom  ]
-type nf_nob = nf nf_nob_
-type i_var = nf_nob i_var_;;
-type i_n_var = nf_nob i_n_var_;;
-type i_num_var = (nf_nob,nf) i_num_var_;;
-
-let hd_of_i_var =
- function
-   `I ((v,_),_)
- | `Var (v,_) -> v
-
-let hd_of =
- function
-   `I ((v,_),_)
- | `Var(v,_) -> Some v
- | `N _ -> None
- | `Match _ -> assert false
-
-let arity_of_hd =
-function
-  `I ((_,a),_)
-| `Var(_,a) -> a
-| _ -> 0 (* FIXME? *)
-
-let lift m (t : nf) =
- let aux_var l (n, ar) = (if n < l then n else n+m), ar in
- let rec aux_i_num_var l =
-  function
-    `I(v,args) -> `I(aux_var l v, Listx.map (aux_nob l) args)
-   | `Var v -> `Var(aux_var l v)
-   | `N _ as x -> x
-   | `Match(t,v,lift,bs,args) ->
-      `Match(aux_i_num_var l t, v, lift + m, bs, List.map (aux_nob l) args)
- and aux_nob l =
-  function
-     #i_num_var as x -> (aux_i_num_var l x :> nf_nob)
-   | `Lam(b,nf) -> `Lam (b, aux (l+1) nf)
-   | `Pacman -> `Pacman
- and aux l =
-  function
-     #nf_nob as x -> (aux_nob l x :> nf)
-   | `Bottom -> `Bottom
- in
-  (aux 0 t : nf)
-;;
-
-(* put t under n lambdas, lifting t accordingtly *)
-let rec make_lams t =
- function
-   0 -> t
- | n when n > 0 -> `Lam (false, lift 1 (make_lams t (n-1)))
- | _ -> assert false
-
-let free_vars' =
- let rec aux n = function
-    `N _ -> []
-  | `Var(x,ar) -> if x < n then [] else [(x-n,ar)]
-  | `I((x,ar),args) ->
-      (if x < n then [] else [(x-n,ar)]) @
-      List.concat (List.map (aux n) (Listx.to_list args :> nf list))
-  | `Lam(_,t) -> aux (n+1) t
-  | `Match(t,_,liftno,bs,args) ->
-      aux n (t :> nf) @
-      List.concat (List.map (fun (_,t) -> aux (n-liftno) t) !bs) @
-      List.concat (List.map (aux n) (args :> nf list))
-  | `Bottom | `Pacman -> []
-  in aux 0
-;;
-let free_vars = (List.map fst) ++ free_vars';;
-
-module ToScott =
-struct
-
-let rec scott_of_nf = function
- | `N n -> Scott.mk_n n
- | `Var(v,_) -> Pure.V v
- | `Match(t,_,liftno,bs,args) ->
- let bs = List.map (fun (n,t) -> n, scott_of_nf (lift liftno (t :> nf))) !bs in
-     let t = scott_of_nf (t :> nf) in
-     let m = Scott.mk_match t bs in
-     List.fold_left (fun acc t -> Pure.A(acc,scott_of_nf t)) m (args :> nf list)
- | `I((v,_), args) -> Listx.fold_left (fun acc t -> Pure.A(acc,scott_of_nf t)) (Pure.V v) (args :> nf Listx.listx)
- | `Lam(_,t) -> Pure.L (scott_of_nf t)
- | `Bottom -> Pure.B
- | `Pacman -> let f x = Pure.A (x,x) in f (Pure.L (Pure.L (f (Pure.V 0))))
-end
-
-
-(************ Pretty-printing ************************************)
-
-(* let rec string_of_term l  = fun _ -> "";; *)
-
-let rec string_of_term =
- let boundvar x = "v" ^ string_of_int x in
- let varname lev l n =
-  if n < lev then boundvar (lev-n-1)
-   else if n < List.length l then List.nth l (n-lev)
-    else "`" ^ string_of_int (n-lev) in
- let rec string_of_term_w_pars lev l  = function
-  | `Var(n,ar) -> varname lev l n ^ (if debug_display_arities then ":" ^ string_of_int ar else "")
-  | `N n -> string_of_int n
-  | `I _ as t -> "(" ^ string_of_term_no_pars_app lev l t ^ ")"
-  | `Lam(_,`Bottom) -> "BOMB"
-  | `Lam _ as t -> "(" ^ string_of_term_no_pars_lam lev l t ^ ")"
-  | `Match(t,(v,ar),bs_lift,bs,args) ->
-      (* assert (bs_lift = lev); *)
-     "(["^ varname lev l v ^ (if debug_display_arities then ":"^ string_of_int ar else "") ^",match " ^ string_of_term_no_pars lev l (t :> nf) ^
-     " with " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ string_of_term l (t :> nf)) !bs) ^ "] " ^
-     String.concat " " (List.map (string_of_term l) (args :> nf list)) ^ ")"
-  | `Bottom -> "BOT"
-  | `Pacman -> "PAC"
- and string_of_term_no_pars_app lev l  = function
-  | `I((n,ar), args) -> varname lev l n ^ (if debug_display_arities then ":" ^ string_of_int ar else "") ^ " " ^ String.concat " " (List.map (string_of_term_w_pars lev l) (Listx.to_list args :> nf list))
-  | #nf as t -> string_of_term_w_pars lev l t
- and string_of_term_no_pars_lam lev l  = function
-  | `Lam(_,`Bottom) -> "BOMB"
-  | `Lam(_,t) -> "λ" ^ boundvar lev ^ ". " ^ (string_of_term_no_pars_lam (lev+1) l t)
-  | _ as t -> string_of_term_no_pars lev l t
- and string_of_term_no_pars lev l = function
-  | `Lam _ as t -> string_of_term_no_pars_lam lev l t
-  | #nf as t -> string_of_term_no_pars_app lev l t
- in string_of_term_no_pars 0
-;;
-
-let print ?(l=[]) = string_of_term l;;
-let string_of_nf t = string_of_term [] (t :> nf);;
-
-(************ Hereditary substitutions ************************************)
-
-let cast_to_i_var =
- function
-    #i_var as y -> (y : i_var)
-  | t ->
-    prerr_endline (print (t :> nf));
-    assert false (* algorithm failed *)
-
-let cast_to_i_n_var =
- function
-    #i_n_var as y -> (y : i_n_var)
-  | t ->
-    prerr_endline (print (t :> nf));
-    assert false (* algorithm failed *)
-
-let cast_to_i_num_var =
- function
-    #i_num_var as y -> (y : i_num_var)
-  | t ->
-    prerr_endline (print (t :> nf));
-    assert false (* algorithm failed *)
-
-let rec set_arity arity = function
-(* FIXME because onlt variables should be in branches of matches, one day *)
-| `Var(n,_) -> `Var(n,arity)
-| `N _ | `Bottom | `Pacman as t -> t
-| `Lam(false, t) -> `Lam(false, set_arity arity t)
-| `Match(t,(n,_),bs_lift,bs,args) -> `Match(t,(n,arity),bs_lift,bs,args)
-| `I _ | `Lam _ -> assert false
-
-let minus1 n = if n = min_int then n else n - 1;;
-
-let rec mk_app (h : nf) (arg : nf) =
- match arg with
-  | `Bottom -> `Bottom
-  | #nf_nob as arg ->
-    match h with
-     | `I(v,args) -> `I(v,Listx.append (Listx.Nil arg) args)
-     | `Var v -> `I(v, Listx.Nil arg)
-     | `Lam(truelam,nf) -> subst truelam true 0 arg (nf : nf) (* AC FIXME sanity check on arity *)
-     | `Match(t,v,lift,bs,args) -> `Match(t,v,lift,bs,List.append args [arg])
-     | `Bottom | `Pacman as t -> t
-     | `N _ -> assert false (* Numbers cannot be applied *)
-(*in let l = ["v0";"v1";"v2"] in
-prerr_endline ("mk_app h:" ^ print ~l h ^ " arg:" ^ print ~l:l arg ^ " res:" ^ print ~l:l res); res*)
-
-and mk_appl h args =
- (*prerr_endline ("MK_APPL: " ^ print h ^ " " ^ String.concat " " (List.map print args));*)
- List.fold_left mk_app h args
-
-and mk_appx h args = Listx.fold_left mk_app h args
-
-and mk_match t (n,ar) bs_lift bs args =
- (*prerr_endline ("MK_MATCH: ([" ^ print t ^ "] " ^ String.concat " " (Listx.to_list (Listx.map (fun (n,t) -> string_of_int n ^ " => " ^ print t) bs)) ^ ") " ^ String.concat " " (List.map print args));*)
- let m =
-  match t with
-    `N m as t ->
-      (try
-        let h = List.assoc m !bs in
-        let h = set_arity (minus1 ar) h in
-        let h = lift bs_lift h in
-         h
-       with Not_found ->
-        `Match (t,(n,ar),bs_lift,bs,[]))
-   (* We are assuming that the econding of matches is s.t.:
-      - match PAC.. --> PAC
-      - match BOT.. --> BOT *)
-   | `Bottom -> `Bottom
-   | `Pacman -> `Pacman
-   | `Lam _ -> assert false
-   | `I _ | `Var _ | `Match _ as t -> `Match(t,(n,ar),bs_lift,bs,[]) in
- mk_appl m args
-
-and subst truelam delift_by_one what (with_what : nf(*_nob*)) (where : nf) =
- let rec aux_propagate_arity ar = function
- | `Lam(false, t) when not delift_by_one -> `Lam(false, aux_propagate_arity ar t)
- | `Match(`I(v,args),(x,_),liftno,bs,args') when not delift_by_one ->
-    `Match(`I(v,args),(x,ar),liftno,bs,args')
- | `Var(i,oldar) -> `Var(i, if truelam then (assert (oldar = min_int); ar) else oldar)
- | _ as t -> t in
- let rec aux_i_num_var l =
-  function
-     `I((n,ar),args) ->
-       if n = what + l then
-       let args = Listx.map (aux l) (args :> nf Listx.listx) in
-        mk_appx (lift l (aux_propagate_arity ar (with_what :> nf))) args
-       else
-        mk_appl (`Var ((if delift_by_one && n >= l then n-1 else n), ar)) (List.map (aux l) (Listx.to_list (args :> nf Listx.listx)))
-   | `Var(n,ar) ->
-       if n = what + l then
-        lift l (aux_propagate_arity ar (with_what :> nf))
-       else
-        `Var((if delift_by_one && n >= l then n-1 else n), ar)
-   | `N _ as x -> x
-   | `Match(t,v,bs_lift,bs,args) ->
-       let bs_lift = bs_lift + if delift_by_one then -1 else 0 in
-       (* Warning! It now applies again the substitution in branches of matches.
-          But careful, it does it many times, for every occurrence of
-          the match. This is okay because what does not occur in with_what. *)
-       let l' = l - bs_lift  in
-       let with_what' = lift l' (with_what :> nf) in
-       (* The following line should be the identity when delift_by_one = true because we
-          are assuming the ts to not contain lambda-bound variables. *)
-       bs := List.map (fun (n,t) -> n,subst truelam false what with_what' t) !bs ;
-       let body = aux_i_num_var l t in
-       mk_match body v bs_lift bs (List.map (aux l) (args :> nf list))
- and aux l(*lift*) =
-(*function iii -> let res = match iii with*)
-  function
-   | #i_num_var as x -> aux_i_num_var l x
-   | `Lam(b, nf) -> `Lam(b, aux (l+1) nf)
-   | `Bottom -> `Bottom
-   | `Pacman -> `Pacman
-(*in let ll = ["v0";"v1";"v2"] in
-prerr_endline ("subst l:" ^ string_of_int l ^ " delift_by_one:" ^ string_of_bool delift_by_one ^ " what:" ^ (List.nth ll what) ^ " with_what:" ^ print ~l:ll with_what ^ " where:" ^ print ~l:ll iii ^ " res:" ^ print ~l:ll res); res*)
- in
-  aux 0 where
-;;
-
-(************ Parsing ************************************)
-
-(************** Algorithm(s) ************************)
-
-let eta_compare x y =
- (* let clex a b = let diff = ? a b in if diff = 0 then cont () else 0 in *)
- let clex aux1 aux2 (a1,a2) (b1,b2) =
-  let diff = aux1 a1 b1 in if diff = 0 then aux2 a2 b2 else diff in
- let rec lex aux l1 l2 =
-  match l1,l2 with
- | [], [] -> 0
- | [], _ -> -1
- | _, [] -> 1
- | x::xs, y::ys -> clex aux (lex aux) (x,xs) (y,ys) in
- let rec aux t1 t2 = match t1, t2 with
-  | `Var(n,_) , `Var(m,_) -> compare n m
-  | `I((n1,_), l1), `I((n2,_), l2) ->
-    clex compare (lex aux) (n1, (Listx.to_list l1 :> nf list)) (n2, (Listx.to_list l2 :> nf list))
-  | `Bottom, `Bottom
-  | `Pacman, `Pacman -> 0
-  | `Lam _, `N _ -> -1
-  | `N _, `Lam _ -> 1
-  | `Bottom, `Lam(_,t) -> -1
-  | `Lam(_,t), `Bottom ->  1
-  | `Lam(_,t1), `Lam(_,t2) -> aux t1 t2
-  | `Lam(_,t1), t2 -> - aux t1 (mk_app (lift 1 t2) (`Var(0,-666)))
-  | t2, `Lam(_,t1) ->   aux t1 (mk_app (lift 1 t2) (`Var(0,-666)))
-  | `N n1, `N n2 -> compare n1 n2
-  | `Match(u,_,bs_lift,bs,args), `Match(u',_,bs_lift',bs',args') ->
-    let bs = List.sort (fun (n,_) (m,_) -> compare n m) !bs in
-    let bs' = List.sort (fun (n,_) (m,_) -> compare n m) !bs' in
-    clex aux (clex (lex (clex compare aux)) (lex aux)) ((u :> nf), (bs, (args :> nf list))) ((u' :> nf), (bs', (args' :> nf list)))
-  | `Match _, _ -> -1
-  | _, `Match _ -> 1
-  | `N _, _ -> -1
-  | _, `N _ -> 1
-  | `I _, _ -> -1
-  | _, `I _ -> 1
-  | `Bottom, _ -> -1
-  | _, `Bottom -> 1
-  | `Pacman, _ -> -1
-  | _, `Pacman -> 1
-  in aux x y
-;;
-
-let eta_eq (#nf as x) (#nf as y) = 0 = eta_compare x y ;;
-
-let rec eta_subterm sub t =
- if eta_eq sub t then true else
-  match t with
-  | `Lam(_,t') -> eta_subterm (lift 1 sub) t'
-  | `Bottom
-  | `Pacman  -> false
-  | `Match(u,ar,liftno,bs,args) ->
-     eta_subterm sub (u :> nf)
-     || List.exists (fun (_, t) -> eta_subterm sub (lift liftno t)) !bs
-     || List.exists (eta_subterm sub) (args :> nf list)
-  | `I((v,_), args) -> List.exists (eta_subterm sub) ((Listx.to_list args) :> nf list) || (match sub with
-   | `Var(v',_) -> v = v'
-   | `I((v',_), args') -> v = v'
-    && Listx.length args' < Listx.length args
-    && List.for_all (fun (x,y) -> eta_eq x y) (List.combine (Util.take (Listx.length args') (Listx.to_list args :> nf list)) (Listx.to_list args' :> nf list))
-   | _ -> false
-   )
-  | `N _ | `Var _ -> false
-;;
-
-let eta_subterm (#nf as x) (#nf as y) = eta_subterm x y;;
-
-let max_arity_tms n =
- let max a b = match a, b with
-  | None, None -> None
-  | None, Some x
-  | Some x, None -> Some x
-  | Some x, Some y -> Some (Pervasives.max x y) in
- let aux_var l (m,a) = if n + l = m then Some a else None in
- let rec aux l = function
-  | `Var v -> aux_var l v
-  | `I(v,tms) -> max (aux_var l v) (aux_tms l (Listx.to_list tms :> nf list))
-  | `Lam(_,t) -> aux (l+1) t
-  | `Match(u,_,_,bs,args) -> max (max (aux l (u :> nf)) (aux_tms l (args :> nf list))) (aux_tms l (List.map snd !bs))
-  | `N _ | `Bottom | `Pacman -> None
- and aux_tms l =
-  List.fold_left (fun acc t -> max acc (aux l t)) None in
- fun tms -> aux_tms 0 (tms :> nf list)
-;;
diff --git a/ocaml/num.mli b/ocaml/num.mli
deleted file mode 100644 (file)
index 39637bf..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-type var = int * (* arity of variable*) int;;
-type 'nf_nob i_var_ = [ `I of var * 'nf_nob Listx.listx | `Var of var ]
-type 'nf_nob i_n_var_ = [ `N of int | 'nf_nob i_var_ ]
-type ('nf_nob,'nf) i_num_var_ = [
-  | 'nf_nob i_n_var_
-  | `Match of ('nf_nob,'nf) i_num_var_ * (* originating var *) var * (*lift*) int * (*branches*)(int * 'nf) list ref * (*args*)'nf_nob list
-]
-type 'nf nf_nob_ = [ `Lam of (* was_unpacked *) bool * 'nf | `Pacman | ('nf nf_nob_,'nf) i_num_var_ ]
-type nf = [ nf nf_nob_ | `Bottom  ]
-type nf_nob = nf nf_nob_
-type i_var = nf_nob i_var_;;
-type i_n_var = nf_nob i_n_var_;;
-type i_num_var = (nf_nob,nf) i_num_var_;;
-val hd_of_i_var : i_var -> int
-val hd_of : i_n_var -> int option
-val arity_of_hd : i_n_var -> int
-(* put t under n lambdas, lifting t accordingtly *)
-val make_lams : nf -> int -> nf
-val lift : int -> nf -> nf
-val free_vars' : nf -> var list
-val free_vars : nf -> int list
-module ToScott :
-  sig
-    val scott_of_nf : nf -> Pure.Pure.t
-  end
-val print : ?l:string list -> nf -> string
-val cast_to_i_var : [< nf > `I `Var] -> i_var
-val cast_to_i_n_var : [< nf > `I `N `Var] -> i_n_var
-val cast_to_i_num_var : [< nf > `I `N `Match `Var] -> i_num_var
-val set_arity : int -> nf -> nf
-val mk_app : nf -> nf -> nf
-val mk_appl : nf -> nf list -> nf
-val mk_appx : nf -> nf Listx.listx -> nf
-val mk_match : nf -> var -> int -> (int * nf) list ref -> nf list -> nf
-val subst : bool -> bool -> int -> nf -> nf -> nf
-val eta_compare : nf -> nf -> int
-val eta_eq : [< nf ] -> [< nf ] -> bool
-val eta_subterm : [< nf ] -> [< nf ] -> bool
-val max_arity_tms : int -> [< nf] list -> int option
-val minus1 : int -> int
diff --git a/ocaml/num.mli.ar b/ocaml/num.mli.ar
deleted file mode 100644 (file)
index 46bf51e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-type 'nf i_var_ = [ `I of int * int * 'nf Listx.listx | `Var of int * int ]
-type 'nf i_n_var_ = [ `N of int | 'nf i_var_ ]
-type 'nf i_num_var_ =
-    [ `I of int * int * 'nf Listx.listx
-    | `Match of int * 'nf i_num_var_ * int * (int * 'nf) list ref * 'nf list
-    | `N of int
-    | `Var of int * int ]
-type 'nf nf_ =
-    [ `I of int * int * 'nf Listx.listx
-    | `Lam of bool * 'nf nf_
-    | `Match of int * 'nf i_num_var_ * int * (int * 'nf) list ref * 'nf list
-    | `N of int
-    | `Var of int * int ]
-type nf = nf nf_
-type i_var = nf i_var_
-type i_n_var = nf i_n_var_
-type i_num_var = nf i_num_var_
-val hd_of_i_var : i_var -> int
-val hd_of :
-  [< `I of 'c * 'a * 'b | `Match of 'c | `N of 'd | `Var of 'e * 'a ] -> 'a option
-(* put t under n lambdas, lifting t accordingtly *)
-val make_lams : nf -> int -> nf
-val lift : int -> nf -> nf
-val free_vars : nf -> int list
-module ToScott :
-  sig
-    val t_of_i_num_var : nf i_num_var_ -> Pure.Pure.t
-    val t_of_nf : nf -> Pure.Pure.t
-  end
-val print : ?l:string list -> nf -> string
-val string_of_nf : [<nf] -> string
-val cast_to_i_var : [< nf > `I `Var] -> i_var
-val cast_to_i_n_var : [< nf > `I `N `Var] -> i_n_var
-val cast_to_i_num_var : [< nf > `I `N `Match `Var] -> i_num_var
-val mk_app : nf -> nf -> nf
-val mk_appl : nf -> nf list -> nf
-val mk_appx : nf -> nf Listx.listx -> nf
-val mk_match : int -> nf i_num_var_ -> int -> (int * nf) list ref -> nf list -> nf
-val subst : bool -> int -> nf -> nf -> nf
-val parse' : string list -> nf list * string list
-val eta_compare : nf -> nf -> int
-val eta_eq : [< nf ] -> [< nf ] -> bool
-val eta_subterm : [< nf ] -> [< nf ] -> bool
diff --git a/ocaml/parser.ml b/ocaml/parser.ml
deleted file mode 100644 (file)
index ea885d2..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-exception ParsingError of string;;\r
-\r
-let mk_app x y = Num.mk_app x y;;\r
-let mk_lam x = `Lam(true, x);;\r
-let mk_var x = `Var(x, -666);;\r
-\r
-let isAlphaNum c = let n = Char.code c in\r
- (48 <= n && n <= 90) || (95 <= n && n <= 122) ;;\r
-let isSpace c = c = ' ' || c = '\n' || c = '\t' ;;\r
-\r
-(* FIXME *)\r
-let mk_var' (bound, free) x =\r
-  if x <> "@" && List.mem x bound\r
-  then free, mk_var (Util.index_of x bound)\r
-  else if x <> "@" && List.mem x free\r
-       then free, mk_var (List.length bound + Util.index_of x free)\r
-       else (free @ [x]), mk_var (List.length bound + List.length free)\r
-;;\r
-\r
-let mk_app' = function\r
-  | [] ->  assert false\r
-  | t :: ts -> List.fold_left mk_app t ts\r
-;;\r
-\r
-let explode s =\r
- let len = String.length s in\r
-  let rec aux i l =\r
-    if i >= len || s.[i] = '#' then l else aux (i+1) (s.[i] :: l)\r
-  in List.rev (aux 0 [])\r
-;;\r
-\r
-let implode l =\r
-  let res = Bytes.create (List.length l) in\r
-  let rec aux i = function\r
-    | [] -> res\r
-    | c :: l -> Bytes.set res i c; aux (i + 1) l in\r
-  aux 0 l\r
-;;\r
-\r
-let rec strip_spaces = function\r
-  | c::cs when isSpace c -> strip_spaces cs\r
-  | cs -> cs\r
-;;\r
-\r
-let read_var s =\r
-  let rec aux = function\r
-  | [] -> None, []\r
-  | c::cs as x ->\r
-    if c = '@' then\r
-     (if cs <> [] && (let hd = List.hd cs in hd = '@' || isAlphaNum hd)\r
-     then raise (ParsingError ("Unexpected `"^String.make 1 (List.hd cs)^"` after `@`."))\r
-     else Some['@'], cs)\r
-    else if isAlphaNum c\r
-    then match aux cs with\r
-         | (Some x), cs' -> Some (c :: x), cs'\r
-         | None, cs' -> (Some [c]), cs'\r
-    else None, x\r
-  in match aux s with\r
-    | None, y -> None, y\r
-    | Some x, y -> Some (implode x), y\r
-;;\r
-\r
-let read_var' (bound, free as vars) s =\r
-  match read_var s with\r
-  | Some varname, cs ->\r
-    let free, v = mk_var' vars varname in\r
-    Some [v], cs, (bound, free)\r
-  | None, _ -> raise (ParsingError ("Can't read variable"))\r
-;;\r
-\r
-let rec read_smt vars =\r
-  let check_if_lambda cs = match read_var cs with\r
-    | None, _ -> false\r
-    | Some x, cs -> match strip_spaces cs with\r
-      | [] -> false\r
-      | c::_ -> c = '.'\r
-  in let read_lambda (bound, free) cs = (\r
-    match read_var (strip_spaces cs) with\r
-      | Some varname, cs ->\r
-      let vars' = (varname::bound, free) in\r
-      (match strip_spaces cs with\r
-        | [] -> raise (ParsingError "Lambda expression incomplete")\r
-        | c::cs -> (if c = '.' then (match read_smt vars' cs with\r
-          | None, _, _ -> raise (ParsingError "Lambda body expected")\r
-          | Some [x], y, (_, free) -> Some [mk_lam x], y, (bound, free)\r
-          | Some _, _, _ -> assert false\r
-          ) else raise (ParsingError "Expected `.` after variable in lambda")\r
-        ))\r
-      | _, _ -> assert false\r
- ) in let rec aux vars cs =\r
-  match strip_spaces cs with\r
-  | [] -> None, [], vars\r
-  | c::_ as x ->\r
-      let tms, cs, vars = (\r
-           if c = '(' then read_pars vars x\r
-      else if c = ')' then (None, x, vars)\r
-      else if check_if_lambda x then read_lambda vars x\r
-      else read_var' vars x) in\r
-      match tms with\r
-      | Some [tm] -> (\r
-        match aux vars cs with\r
-          | None, cs, vars -> Some [tm], cs, vars\r
-          | Some ts, cs, vars -> Some (tm :: ts), cs, vars\r
-        )\r
-      | Some _ -> assert false\r
-      | None -> None, x, vars\r
-  in fun cs -> match aux vars cs with\r
-    | None, cs, vars -> None, cs, vars\r
-    | Some ts, cs, vars -> Some [mk_app' ts], cs, vars\r
-and read_pars vars = function\r
-  | [] -> None, [], vars\r
-  | c::cs -> if c = '(' then (\r
-    let tm, cs, vars = read_smt vars cs in\r
-    let cs = strip_spaces cs in\r
-    match cs with\r
-      | [] -> None, [], vars\r
-      | c::cs -> if c = ')' then tm, cs, vars else raise (ParsingError "Missing `)`")\r
-    ) else assert false\r
-;;\r
-\r
-let parse x =\r
-  match read_smt ([],[]) (explode x) with\r
-  | Some [y], [], _ -> y\r
-  | _, _, _ -> assert false\r
-;;\r
-\r
-let parse_many strs =\r
-  let f (x, y) z = match read_smt y (explode z) with\r
-  | Some[tm], [], vars -> (tm :: x, vars)\r
-  | _, _, _ -> assert false\r
-  in let aux = List.fold_left f ([], ([], []))\r
-  in let (tms, (_, free)) = aux strs\r
-  in (List.rev tms, free)\r
-;;\r
-\r
-(**********************************************************************\r
-\r
-let rec string_of_term = function\r
-  | Tvar n -> string_of_int n\r
-  | Tapp(t1, t2) -> "(" ^ string_of_term t1 ^ " " ^ string_of_term t2 ^ ")"\r
-  | Tlam(t1) -> "(\\" ^ string_of_term t1 ^ ")"\r
-;;\r
-\r
-let _ = prerr_endline (">>>" ^ string_of_term (parse "(\\x. x y z z1 k) z1 z j"));;\r
-\r
-\r
-*******************************************************************************)\r
-\r
-let problem_of_string s =\r
- let lines = Str.split (Str.regexp "[\n\r\x0c\t;]+") s in\r
- let head, lines = List.hd lines, List.tl lines in\r
- let name = String.trim (String.sub head 1 (String.length head - 1)) in\r
- let lines = List.filter ((<>) "") lines in\r
- let aux (last, div, conv, ps) line =\r
-  let chr = String.sub line 0 1 in\r
-  let line = String.trim (String.sub line 1 (String.length line - 1)) in\r
-  if line = "" then chr, div, conv, ps else\r
-  let rec aux' chr line =\r
-   if chr = "#"\r
-    then chr, div, conv, ps\r
-   else if chr = "D"\r
-    then chr, line, conv, ps\r
-   else if chr = "C"\r
-    then chr, div, line::conv, ps\r
-   else if chr = "N"\r
-    then chr, div, conv, line::ps\r
-   else if chr = " "\r
-    then aux' last line\r
-   else raise (ParsingError\r
-     ("Unexpected at beginning of problem: `" ^ chr ^ "` " ^ line)) in\r
-  aux' chr line in\r
- let _, div, conv, ps = List.fold_left aux ("#", "", [], []) lines in\r
- let div_provided = div <> "" in\r
- let div = if div_provided then div else "BOT" in\r
- let strs = [div] @ ps @ conv in\r
-\r
- if List.length ps = 0 && List.length conv = 0\r
-  then raise (ParsingError "Parsed empty problem");\r
-\r
- (* parse' *)\r
- let (tms, free) = parse_many strs in\r
- (* Replace pacmans and bottoms *)\r
- let n_bot = try Util.index_of "BOT" free with Not_found -> min_int in\r
- let n_pac = try Util.index_of "PAC" free with Not_found -> min_int in\r
- let n_bomb = try Util.index_of "BOMB" free with Not_found -> min_int in\r
- let fix lev v =\r
-  if v = lev + n_bot then `Bottom\r
-   else if v = lev + n_pac then `Pacman\r
-    else if v = lev + n_bomb then `Lam(true, `Bottom)\r
-    else if v = lev then `Var(v, min_int) (* zero *)\r
-     else `Var(v,1) in (* 1 by default when variable not applied *)\r
- (* Fix arity *)\r
- let open Num in\r
- let exclude_bottom = function\r
- | #nf_nob as t -> t\r
- (* actually, the following may be assert false *)\r
- | `Bottom -> raise (ParsingError "Input term not in normal form") in\r
- let rec aux_nob lev : nf_nob -> nf = function\r
- | `I((n,_), args) -> `I((n,(if lev = 0 then 0 else 1) + Listx.length args), Listx.map (fun t -> exclude_bottom (aux_nob lev t)) args)\r
- | `Var(n,_) -> fix lev n\r
- | `Lam(_,t) -> `Lam (true, aux (lev+1) t)\r
- | `Match _ | `N _ -> assert false\r
- | `Pacman -> `Pacman\r
- and aux lev : Num.nf -> Num.nf = function\r
-  | #nf_nob as t -> aux_nob lev t\r
-  | `Bottom -> assert false in\r
-let all_tms = List.map (aux 0) (tms :> Num.nf list) in\r
-\r
-(* problem_of *)\r
-let div, (ps, conv) = List.hd all_tms, Util.list_cut (List.length ps, List.tl all_tms) in\r
-\r
-let div = if not div_provided || div = `Bottom\r
- then None\r
- else match div with\r
-  | `I _ as t -> Some t\r
-  | _ -> raise (ParsingError "D is not an inert in the initial problem") in\r
-let conv = Util.filter_map (\r
- function\r
- | #i_n_var as t -> Some t\r
- | `Lam _ -> None\r
- | _ -> raise (ParsingError "A C-term is not i_n_var")\r
- ) conv in\r
-let ps = List.map (\r
- function\r
-  | #i_n_var as y -> y\r
-  | _ -> raise (ParsingError "An N-term is not i_n_var")\r
- ) ps in\r
- name, div, conv, ps, free\r
-;;\r
-\r
-\r
-let from_file path =\r
- let lines = ref ["#"] in\r
- let chan = open_in path in\r
- let _ = try\r
-  while true; do\r
-    lines := input_line chan :: !lines\r
-  done\r
- with End_of_file ->\r
-  close_in chan in\r
- let txt = String.concat "\n" (List.rev !lines) in\r
- let problems = Str.split (Str.regexp "[\n\r]+\\$") txt in\r
- List.map problem_of_string (List.tl (List.map ((^) "$") problems))\r
-;;\r
diff --git a/ocaml/parser.mli b/ocaml/parser.mli
deleted file mode 100644 (file)
index d131edb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-exception ParsingError of string\r
-\r
-val problem_of_string:\r
- string ->\r
-  string (* problem label *)\r
-  * Num.i_var option (* div *)\r
-  * Num.i_n_var list (* conv *)\r
-  * Num.i_n_var list (* ps *)\r
-  * string list (* names of free variables *)\r
-val from_file : string ->\r
- (string (* problem label *)\r
- * Num.i_var option (* div *)\r
- * Num.i_n_var list (* conv *)\r
- * Num.i_n_var list (* ps *)\r
- * string list (* names of free variables *)) list\r
diff --git a/ocaml/problems.ml b/ocaml/problems.ml
deleted file mode 100644 (file)
index eda359a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-open Lambda4;;
-open Util;;
-
-(* Syntax for problem files in problem/ folder:
-
-- dollar ($) on newline
-  begin new problem
-  $! means that the problem is expected to be separable,
-  $? means that it is expected to be unseparable
-
-- (#) on new line
-  comment line
-
-- (D) (C) (N) stand respectively for divergent, convergent, numeric
-
-- lines starting with spaces inherit the type from the last line
-
-*)
-
-(* assert_depends solves the problem, and checks if the result was expected *)
-let assert_depends x =
- let c = String.sub (label_of_problem (fst x)) 0 1 in
- match solve x with
- | _, `Unseparable s when c = "!" ->
-    failwith ("assert_depends: unseparable because: " ^ s ^ ".")
- | _, `Separable _  when c = "?" ->
-    failwith ("assert_depends: separable.")
- | _ -> ()
-;;
-
-(* TODO *)
-(* div under a lambda in conv *)
-
-if Array.length Sys.argv = 1
- then failwith "no command line args. Please use e.g. ./a.out problems/*"
-else Array.iteri (fun i filename -> if i > 0 then
- List.iter (assert_depends ++ problem_of) (Parser.from_file filename)
- ) Sys.argv
-;;
diff --git a/ocaml/problems.mli b/ocaml/problems.mli
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/ocaml/problems/3col b/ocaml/problems/3col
deleted file mode 100644 (file)
index df0045e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-\r
-$! 3col: 0<>1\r
-C x (_.x y BOMB BOMB y y y b) (_.x BOMB y BOMB y y y b) (_.x BOMB BOMB y y y y b) BOMB BOMB BOMB a\r
-C x y y y (_.x BOMB y y y BOMB BOMB b) (_.x y BOMB y BOMB y BOMB b) (_.x y y BOMB BOMB BOMB y b) a\r
-D x y y y y y y a\r
-C x z z z BOMB BOMB BOMB BOMB\r
-C x y y y z z z BOMB\r
-\r
-$? 3col: 0<>1 1<>1\r
-C x (_.x y BOMB BOMB y y y b) (_.x BOMB y BOMB y y y b) (_.x BOMB BOMB y y y y b) BOMB BOMB BOMB a\r
-C x y y y (_.x BOMB y y BOMB BOMB BOMB b) (_.x y BOMB y BOMB BOMB BOMB b) (_.x y y BOMB BOMB BOMB BOMB b) a\r
-D x y y y y y y a\r
-C x z z z BOMB BOMB BOMB BOMB\r
-C x y y y z z z BOMB\r
-\r
-$? 3col: 0<>1<>2 0<>3 1<>3 2<>3\r
-C x (_.x y BOMB BOMB y y y y y y y y y b) (_.x BOMB y BOMB y y y y y y y y y b) (_.x BOMB BOMB y y y y y y y y y y b) BOMB BOMB BOMB BOMB BOMB BOMB BOMB BOMB BOMB a\r
-C x y y y (_.x BOMB y y y BOMB BOMB y y y y y y b) (_.x y BOMB y BOMB y BOMB y y y y y y b) (_.x y y BOMB BOMB BOMB y y y y y y y b) BOMB BOMB BOMB BOMB BOMB BOMB a\r
-C x y y y y y y (_.x BOMB y y BOMB y y y BOMB BOMB y y y b) (_.x y BOMB y y BOMB y BOMB y BOMB y y y b) (_.x y y BOMB y y BOMB BOMB BOMB y y y y b) BOMB BOMB BOMB a\r
-C x y y y y y y y y y (_.x BOMB y y BOMB y y BOMB y y y BOMB BOMB b) (_.x y BOMB y y BOMB y y BOMB y BOMB y BOMB b) (_.x y y BOMB y y BOMB y y BOMB BOMB BOMB y b) a\r
-D x y y y y y y y y y y y y a\r
-C x z z z BOMB BOMB BOMB BOMB BOMB BOMB BOMB BOMB BOMB BOMB\r
-C x y y y z z z BOMB BOMB BOMB BOMB BOMB BOMB BOMB\r
-C x y y y y y y z z z BOMB BOMB BOMB BOMB\r
-C x y y y y y y y y y z z z BOMB\r
diff --git a/ocaml/problems/bugs b/ocaml/problems/bugs
deleted file mode 100644 (file)
index 610b6b8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-$! bugs 1
-# bug with eating firing reduction of matches
-D z (_. (v y))
-C u (z (_. (v x)))
-
-$! bugs 2
-# algorithm tries to eat z, but should first step on x, w
-D z PAC
-C x y PAC PAC
-N x (w z) Z
diff --git a/ocaml/problems/m b/ocaml/problems/m
deleted file mode 100644 (file)
index 716e4d4..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-$! m1\r
-N y z Z\r
-  x z Z\r
-  x (a k) u Z\r
-  x (a r) Z\r
-  x (a k) v Z\r
-\r
-$! m2\r
-N y z Z\r
-  x z Z\r
-  x (a k) u Z\r
-  x (a r) Z\r
-  x (a k) v Z\r
diff --git a/ocaml/problems/n b/ocaml/problems/n
deleted file mode 100644 (file)
index 25d5378..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-$! n1\r
-D b (c b) (k. l. c b d) (c e) (k. l. m. f) (g (k. c e) (b (c b) (k. l. c b d) (c e) b)) (f c (h (k. c c g))) (g (k. c e) (k. i) f e (g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d)) (k. e c (k (l. f))) (g (k. c e) (k. i) e)) (g (k. c e) (k. i) (c b) (f c) b)\r
-C b (c b) (k. l. c b d) (c e) (k. l. m. f) (g (k. c e) (b (c b) (k. l. c b d) (c e) b)) (f c (h (k. c c g))) (g (k. c e) (k. i) f e (g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d)) (k. e c (k (l. f))) (g (k. c e) (k. i) e)) (b (k. f) (g (k. c e) (k. i) (c b) (c (c e))) (k. l. m. f) (g (k. c e) (k. i) f e) (k. i))\r
-  g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d) (k. l. g (m. c e) (m. i) (c b) (l c) b) (e c (d d (d c)) (c e (k. f)) (b (c b) (k. l. c b d) (c e) (k. l. m. f)))\r
-  b (c b) (k. l. c b d) (c e) (k. l. m. f) (g (k. c e) (b (c b) (k. l. c b d) (c e) b)) (f c (h (k. c c g))) (g (k. c e) (k. i) f e (g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d)) (k. e c (k (l. f))) (g (k. c e) (k. i) e))\r
-  b (k. f) (g (k. c e) (k. i) (c b) (c (c e))) (k. l. m. f) (g (k. c e) (k. i) f e) (k. l. m. c c g) (e c (b (k. f))) (k. f c)\r
-  c (c e) (e c (d d (d c)) (k. c e (f c))) (g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d) (k. c e (l. f) (k (l. c e) (l. i)))) (k. l. l (m. c e) (m. i) (c b) (f c) b) (k. l. c k) (f (f c) (b (c b) (k. l. c b d) (c e)) (b (k. f) (g (k. c e) (k. i) (c b) (c (c e))) (k. l. m. f) (g (k. c e) (k. i) f e) (k. l. m. c c g) (e c (b (k. f)))))\r
-N b (c b) (k. l. c b d) (c e) b (g (k. c e) (k. i) (c b)) (h (g (k. c e) (k. i) (c b) (c (c e)))) (g (k. c e) (b (c b) (k. l. c b d) (c e) b) (g (k. c e) (k. i) (g (k. c e) (k. i) e) (e c (d d (d c)) (k. c e (f c))))) a Z\r
-  c c g (k. b (c b) (l. m. c b k) (c e)) (k. b (c b) (l. m. c b d) (c k) b) (k. e c (d h) k) (g (k. c e) (b (c b) (k. l. c b d) (c e) b) (g (k. c e) (k. i) (g (k. c e) (k. i) e) (e c (d d (d c)) (k. c e (f c))))) a Z\r
-  d h (b (c b) (k. l. c b d) (c e)) (k. g (l. c e) (l. i) (c b) (k c) b) d b (b (c b) (k. l. c b d) (c e) b (g (k. c e) (k. i) (c b)) (k. c)) a Z\r
-  g (k. c e) (k. d d) (k. k k) (e c (d d (d c)) i) (k. g (l. k e) (l. d d)) (g i (b (c b) (k. l. c b d) (e c (d d (d c)) (k. c e (f c)) (k. k (c k) (l. m. c k d) (c e) k (g (l. c e) (l. i) (c k)) (l. c))))) (c b) a Z\r
-  g (k. c e) (k. i) f e (g (k. c e) (k. i) (c b) (c (c e)) (k. l. c b d)) (k. e c (k (l. f))) (g (k. c e) (k. i) e) a Z\r
-\r
-$! n2\r
-D b b (c d) (k. d e) (k. k) (k. l. b)\r
-C b b (d e (k. d e)) (g (k. e) (k. k)) (b (b b) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h))) (k. k (k k) (l. l))) (f (e (c d))) (b b (d e (k. d e)) (b b) (b (b b) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h))))) (d e (k. d e) g (i (k. k)))\r
-  f (g (k. e)) (k. b b) (c d (k. k d) (k. l. l) c) (k. c d) (k. c) (d (g (de) (g (k. e)) h) (g (k. b b)))\r
-  f (g (k. e)) (k. b b) (c d (k. k d) (k. l. l) c) (k. c d) (k. l. l) (k. g (d e) (l. m. m))\r
-  b b (d e (k. d e)) (g (k. e) (k. k)) (b (b b) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h))) (k. k (k k) (l. l))) (f (e (c d))) (b b (d e (k. d e)) (b b) (b (b b) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h)))))\r
-  d (g (d e) (g (k. e)) h) (g (g (d e)) (d e (k. d e) (k. b (l. h)) (k. l. d e))) (b (k. h) (k. k e (l. m. b b)) (k. k (k k) (l. l))) (k. b) (b b (k. l. i)(k. c))\r
-N b (b b) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h))) (e (b b (c d))) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (g (k. e) (k. k))) (k. l. d (g (d k) (g (m. k)) h) (d k (m. n. b b))) (e (c d) (e (c d))) Z\r
-  d (g (d e) (g (k. e)) h) (d e (k. l. b b)) (b b) h (k. g (l. e) (l. l)) Z\r
-  d e (k. d e) (k. b (l. h)) (k. l. d e) (d (g (d e) (g (k. e)) h) (g (d e) (k. l. l))) Z\r
-  f (g (k. e)) (k. b b) (c d (k. k d) (k. l. l) c) (k. c d) (k. c) (k. l. m. b b) Z\r
-  f (g (k. e)) (k. b b) (c d (k. k d) (k. l. l) c) (k. c d) (b (b b) (d (g(d e) (g (k. e)) h) (b b (c d) (k. l. b)) (b (k. h))) (e (b b (c d))) (d (g (d e) (g (k. e)) h) (b b (c d) (k. l. b)) (g (k. e) (k. k)))) (k. d e (l. d e) f) Z\r
-\r
-$! n3\r
-D b (k. c (c d e f)) (k. l. f (m. f) (m. f) (m. n. n))\r
-C b (g (k. e e)) (k. b (g (l. e e))) (g (h (k. i)) (k. e)) (f (k. f) (k. f) i) (i (k. c (c d e f)) (k. l. l) (k. g (h (l. i)) (k d) f) e) (k. l. h) (k. f (l. f) (l. f) (l. e)) (k. l. l (m. l))\r
-  c d e (f i) (e e) (g e) (k. l. e) (k. c (g (k (l. i)))) (c d e (k. k))\r
-  f (k. f) (k. f) (f h) (f h (c d e (f i))) (k. b) (c d e (f i) (e e) (f (k. h))) (g e (b (k. i)) (e e (e e)))\r
-  f (k. f) (k. f) (k. e) (c d e (f i) (e e) (g e)) (k. e e) (k. l. m. e) (k. e)\r
-  g e f (f (k. f) (f (k. f) (k. l. f)) (c d e b)) (f (k. f) (k. f) (k. l. l) b) (f (k. h)) (c d e (f i) (e e) (g e) (k. l. e)) (f (k. f) f)\r
-N b (g (k. e e)) (k. b (g (l. e e))) (g (h (k. i)) (k. e)) (f (k. f) (k. f) i) (i (k. c (c d e f)) (k. l. l) (k. g (h (l. i)) (k d) f) e) (k. l. h) (k. f (l. f) (l. f) (l. e)) Z\r
-  c d e (f i) (e e) (g e) (b (g (k. e e)) (k. c (g (h (l. i))) (l. f l))) (k. f (l. f) (l. f)) Z\r
-  e e (k. k d e (l. l)) (g e) (c d e b (e e (c (c d e f)))) (d (e e (k. k d e (l. l))) (k. k i)) (k. i (l. c (c d e f))) (k. h) Z\r
-  f (k. f) (k. f) (f h) (f h (c d e (f i))) (k. b) (f i (c d e)) (k. h) Z\r
-  g e f (f (k. f) (f (k. f) (k. l. f)) (c d e b)) (f (k. f) (k. f) (k. l. l) b) (f (k. h)) (c d e (f i) (e e) (g e) (k. l. e)) (f (k. f) f) (f (k. f) (k. f) (k. l. l) (c (k. i (l. c (c d e f))))) Z\r
diff --git a/ocaml/problems/o b/ocaml/problems/o
deleted file mode 100644 (file)
index d85ca2e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-$! o1\r
-N x a b Z\r
-  x (_. BOT) c Z\r
-\r
-$! o2\r
-N x (y (_. BOT) a) c Z\r
-  x (y a PAC) d Z\r
-\r
-$! o3\r
-D y (x a1 BOMB c) (x BOMB b1 d)\r
-C y (x a2 BOMB c) (x BOMB b1 d)\r
-  y (x a1 BOMB c) (x BOMB b2 d)\r
-\r
-\r
-$! o4\r
-D x BOMB a1 c\r
-C x y BOMB d\r
-\r
-$! o6\r
-D x BOMB\r
-C x y\r
diff --git a/ocaml/problems/p b/ocaml/problems/p
deleted file mode 100644 (file)
index 27315d0..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-\r
-$! p2\r
-N x y Z\r
-  x z Z\r
-  x (y z) Z\r
-\r
-$! p4\r
-N x y Z\r
-  x (a. a x) Z\r
-  y (y z) Z\r
-\r
-$! p5\r
-N a (x. x a) b Z\r
-  b (x. x b) a Z\r
-\r
-$! p6\r
-N a (x. x a) b Z\r
-  b (x. x b) (c a) Z\r
-\r
-$! p7\r
-N a (x. (x a) (a x x a) (x x) ) Z\r
-\r
-$! p8\r
-N x x (x x) Z\r
-\r
-$! p9\r
-N x x (x x x) (x x (x x)) (x x (x x x)) x x Z\r
-\r
-$! p10\r
-N x (y (x a b c)) Z\r
-\r
-$! p11\r
-N x x Z\r
-  x (y.y) Z\r
-\r
-$! p12\r
-N x x (x x) Z\r
-  x x (x (y.y)) Z\r
-\r
-$! p13\r
-N x x (x x (x x x x x (x x))) Z\r
-\r
-$! p14\r
-N a (a a (a (a a)) (a (a a))) Z\r
-\r
-$! p15\r
-N a (a (a a)) (a a (a a) (a (a (a a))) (a (a a)) (a a (a a) (a (a (a a))) (a (a a)))) (a a (a a) (a (a (a a))) (a (a a))) Z\r
-\r
-$! p16:\r
-N a (a a) (a a (a (a a)) (a (a a)) (a a (a (a a)) a)) Z\r
-\r
-$! p17\r
-N b a Z\r
-  b (c.a) Z\r
-\r
-$! p18\r
-N a (a a) (a a a (a (a (a a) a)) (a a a (a (a (a a) a)))) Z\r
-  a a Z\r
-  a (a a) Z\r
-\r
-$! p19\r
-N a (a a) (a a a (a (a (a a) a)) a) Z\r
-\r
-$! p20\r
-N a (a b) (b (a b) (a (a b))) (a (a b) (a (a b)) (a (a b)) c) (a (a b) (a (a b)) (b (a b)) c (a a (a (a b) (a (a b)) b)) (a (a b) (a (a b)) (b (a b)) (a a) (a c (b (a b))))) Z\r
-\r
-$! p21\r
-N (((y z) (y z)) ((z (y z)) ((y z) (z z)))) Z\r
-  (((z z) x) (y z)) Z\r
-  ((z (y z)) ((y z) (z z))) Z\r
-\r
-$! p22\r
-N ((z y) ((((y (z y)) x) (y (z y))) ((y (z y)) (z z)))) Z\r
-  ((z y) (((((y (z y)) x) (y (z y))) ((y (z y)) (z z))) (((((y (z y)) x) (y (z y))) ((y (z y)) (z z))) ((x y) (z z))))) Z\r
-  (y ((((y (z y)) x) (y (z y))) ((y (z y)) (z z)))) Z\r
-\r
-$! p23\r
-# (* diverging tests *) (* test p23 leads to test p24 *)\r
-N z z z Z\r
-  z (z z) (x. x) Z\r
-\r
-$! p24\r
-# (* because of the last term, the magic number is 1 and we diverge\r
-     but setting the magic number to 0 allows to solve the problem\r
-     thus our strategy is incomplete *)\r
-N b b Z\r
-  b f Z\r
-  f b Z\r
-  a (x.x) Z\r
-\r
-$! p25\r
-# (* because of the last term, the magic number is 1 and we diverge\r
-     but setting the magic number to 0 allows to solve the problem\r
-     thus our strategy is incomplete *)\r
-N b b Z\r
-  b f Z\r
-  f b Z\r
-  f (x.x) Z\r
-\r
-$! p26\r
-  (* BUG:\r
-     0 (n (d (o.n) ...)))\r
-     After instantiating n, the magic number (for d) should be 2, not 1! *)\r
-N (((x y) (z. (y. (y. z)))) (z. y)) Z\r
-  (((x y) x) (y y)) Z\r
-\r
-$! p27\r
-N (((((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y)) (((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y))) ((((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y)) (((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y)))) Z\r
-  ((((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y)) (((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y))) Z\r
-  (((((z y) (z (z y))) (z (z y))) ((z y) (((z y) (z (z y))) ((z y) x)))) (((((z y) (z (z y))) (z (z y))) x) y)) Z\r
-\r
-$! p28\r
-N ((((z (x. (z. (x. x)))) (z x)) x) (z (x. (z. (x. x))))) Z\r
-  (((z (x. (z. (x. x)))) (z x)) ((z x) (x. (z. (x. x))))) Z\r
-\r
-$! p29\r
-N ((((((x x) (x x)) (z. (y x))) (z. ((x x) y))) y) ((x x) y)) Z\r
-  (((((x x) (x x)) (z. (y x))) (z. ((x x) y))) y) Z\r
-\r
-$! p30\r
-N ((b c) (b. (z a))) Z\r
-  ((v (a. (z v))) ((y (b c)) ((z a) (v y)))) Z\r
-  ((v (v. c)) z) Z\r
-  ((v y) (v (a. (z v)))) Z\r
-  ((y (b c)) ((z a) (v y))) Z\r
-\r
-$! p31\r
-N  (((((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a)) (x. (w. (w. c)))) (((a (y c)) ((y c) ((a v) (w (z. a))))) (w. c))) Z\r
-   ((((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a)) (x. (w. (w. c)))) Z\r
-   (((((b (a v)) (a. (y c))) z) (w. w)) ((a c) c)) Z\r
-    (((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a)) Z\r
-      ((((a (y c)) ((y c) ((a v) (w (z. a))))) (w. c)) (x. w)) Z\r
-\r
-$? p32\r
-# should fail because the first and second terms are eta-eq\r
-N (((((a y) v) (z a)) (z (((z a) (z a)) (w. v)))) (y. (a y))) Z\r
-  (((((a y) v) (z a)) (z (((z a) (z a)) (w. v)))) a) Z\r
-  (((((z a) (z a)) b) (v. (v. (z a)))) (v. ((a y) v))) Z\r
-  ((((a y) v) (z a)) (z (((z a) (z a)) (w. v)))) Z\r
-  ((((w (a. (z. ((z a) (z a))))) (v. ((a y) v))) (((z a) (z a)) b)) (w. (((z a) (z a)) (c. (c ((z a) (z a))))))) Z\r
-\r
-$! p33\r
-  (* Shows an error when the strategy that minimizes special_k is NOT used *)\r
-N ((((((v (y. v)) (w. (c. y))) ((((a (c. y)) (v w)) ((b (z (a (c. y)))) (b (z (a (c. y)))))) ((a (c. y)) b))) (((y (y (v w))) z) ((((a (c. y)) (v w)) ((b (z (a (c. y)))) (b (z (a (c. y)))))) ((a (c. y)) b)))) (b c)) (((v w) (z (a (c. y)))) ((y b) (b (z (a (c. y))))))) Z\r
-  ((((((a (c. y)) (v w)) ((b (z (a (c. y)))) (b (z (a (c. y)))))) ((a (c. y)) b)) (c. y)) (c. y)) Z\r
-  (((((a (c. y)) (v w)) ((b (z (a (c. y)))) (b (z (a (c. y)))))) ((a (c. y)) b)) (c. y)) Z\r
-  (((((a (c. y)) (v w)) ((b (z (a (c. y)))) (b (z (a (c. y)))))) (b (z (a (c. y))))) ((c b) (b. (b w)))) Z\r
-#  (* "(((((a (c. y)) b) v) (z (a (c. y)))) (a. (b (z (a (c. y))))))" *)\r
-\r
-$! p34\r
-N b c (b c) (c (d (j. e))) (b c (b c) (j.c f)) (b f (j. k. d)) (b (j. k. l. b c (b c)) (b g)) a Z\r
-  d (j. e) e (j. c f) (j. c j) b a Z\r
-  d (j. e) e (j. c f) b (b c (b c) (j. c f)) a Z\r
-  d (j. e) e (j. c f) b (b c (b c) (j. c f) (g b)) a Z\r
-  d (j. e) e (j. c f) b (j. k. j (l. e) e (l. k f) b) a Z\r
-\r
-$! p35\r
-N (((((((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) ((w ((a b) z)) (a ((v (y y)) (v (y y)))))) (z ((y (v (y y))) b))) (((y (v (y y))) ((y (v (y y))) x)) ((((c (a b)) (y y)) ((y (v (y y))) b)) (((c (a b)) (y y)) ((y (v (y y))) b))))) (z (z b))) ((y y) (((b z) v) (a ((v (y y)) (v (y y))))))) Z\r
-  ((((((((a b) z) w) (((b z) v) (a ((v (y y)) (v (y y)))))) ((y y) ((y (v (y y))) b))) ((((((c (a b)) (y y)) ((y (v (y y))) b)) (((c (a b)) (y y)) ((y (v (y y))) b))) (((((c (a b)) (y y)) (y (v (y y)))) (z w)) ((w (((v (y y)) (v (y y))) a)) (w (z ((y (v (y y))) b)))))) (z w))) (((((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) ((w ((a b) z)) (a ((v (y y)) (v (y y)))))) (z ((y (v (y y))) b))) (c (a b)))) (((((b z) (c b)) (c ((v (y y)) (v (y y))))) (((((c (a b)) (y y)) ((y (v (y y))) b)) Z (((c (a b)) (y y)) ((y (v (y y))) b))) ((c b) (z (z b))))) (((((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) (b (((v (y y)) (v (y y))) ((y y) (z (z b)))))) (((((w ((a b) z)) (a ((v (y y)) (v (y y))))) (((v (y y)) (v (y y))) a)) (((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) (b (((v (y y)) (v (y y))) ((y y) (z (z b))))))) (b z))) ((x ((c b) (c b))) (((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) ((w ((a b) z)) (a ((v (y y)) (v (y y)))))))))) Z\r
-  ((((((((b z) v) (a ((v (y y)) (v (y y))))) (y (v (y y)))) ((w ((a b) z)) (a ((v (y y)) (v (y y)))))) (z ((y (v (y y))) b))) (((y (v (y y))) ((y (v (y y))) x)) ((((c (a b)) (y y)) ((y (v (y y))) b)) (((c (a b)) (y y)) ((y (v (y y))) b))))) (v (y y))) Z\r
-\r
-$! p36\r
-N (((((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (((y c) (x a)) (v (((y a) (((z v) (y a)) (b a))) z)))) ((b a) (b a))) ((a c) (b (((y a) (((z v) (y a)) (b a))) (z a))))) ((((((b (((y a) (((z v) (y a)) (b a))) z)) (c ((y (x a)) ((z v) (y a))))) (v (((y a) (((z v) (y a)) (b a))) z))) (((((y a) (((z v) (y a)) (b a))) z) (((z v) (y a)) (c y))) ((x a) (((y a) (((z v) (y a)) (b a))) z)))) ((c ((y (x a)) ((z v) (y a)))) (b (((y a) (((z v) (y a)) (b a))) z)))) ((((b (z a)) (y a)) (y c)) (a (((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a)) ((((y a) (((z v) (y a)) (b a))) z) (((z v) (y a)) (c y)))))))) Z\r
-  (((((((z v) (y a)) (b a)) w) b) (((b a) ((((z v) (y a)) (b a)) w)) ((((z v) (y a)) (b a)) w))) (((b a) ((((y a) (((z v) (y a)) (b a))) ((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a))) w)) (((c y) a) v))) Z\r
-  (((((((z v) (y a)) (b a)) w) b) (a (((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a)) ((((y a) (((z v) (y a)) (b a))) z) (((z v) (y a)) (c y)))))) ((((y a) (((z v) (y a)) (b a))) ((((y a) (((z v) (y a)) (b a))) ((b a) (b a))) (x a))) x)) Z\r
-\r
-\r
-$! p37\r
-  issue with eta-equality of terms in ps\r
-N x (a y) z Z\r
-  x (a z. y z) w Z\r
-  a c Z\r
diff --git a/ocaml/problems/q b/ocaml/problems/q
deleted file mode 100644 (file)
index a641409..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-$! q1\r
-C a d e\r
-N a b Z\r
-  a c Z\r
-\r
-$! q2\r
-C a d e\r
-N a b Z\r
-\r
-$! q3\r
-D x y\r
-C a d e f\r
-N a b Z\r
-\r
-$! q4\r
-C f (x.a b c d)\r
-N a b Z\r
-\r
-$! q5\r
-D x y\r
-C (y. x)\r
-N x Z\r
-\r
-$! q6\r
-D x w\r
-C (y. x z)\r
-N y Z\r
-\r
-$! q7\r
-D (b (c d (e f f k.(g e))) f)\r
-C (g (e f) (g e h) (f d (e f) k.e) k.(c d l.(c d)) (f d k.g (b (g (e f)) (b (g (e f)) (e f)) (g (e f) (g e h)))) k.l.(h f (b i)))\r
-  (g (e f) (g e h) (f d (e f) k.e) k.(c d l.(c d)) (b (g (e f))) k.l.(g f (k f f (k f f m.(g k)))))\r
-  (b (g (e f)) f k.e k.l.(f d (e f)) (c d (e f f k.(g e)) (g k.(e f f))) (h f (i (h k.(i b l.m.n.e)))))\r
-N (f d (e f) k.e k.l.(c d) (b (g e) k.h) (i b k.l.m.e b) a) Z\r
-  (f d (e f) k.e k.l.(c d) (b (g e) k.h) (d k.e) (f d (e f) k.e) a) Z\r
-  (g (e f) (g e h) (f d (e f) k.e) k.(c d l.(c d)) (g e h) (g f (e f f (e f f k.(g e))) (g (e f)) (b (c d (e f f k.(g e))) (b (g (e f)) (e f)) (b (g (e f)) k.l.e))) a) Z\r
-\r
-################################################################################\r
-\r
-$! q8\r
-D x a\r
-C y (x b c)\r
-N j Z\r
-\r
-$! q9\r
-D x a\r
-C y x\r
-N a (y a b b b) Z\r
-\r
-$! q11\r
-D x y\r
-C a (x z)\r
-\r
-$! q10\r
-D b (k. c) d (e (f g) (k. g)) (k. l. c) (k. l. b (m. c)) (k. l. c) (b (k. c) (k. l. b (m. c)) (k. c f) (k. e (f g))) (b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f)) (b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f))) (k. b (l. c) b (l. b (m. c))) (k. b (l. c)))\r
-C e (f g) (k. g) (c f) (k. e) (k. b (l. c) d (b (l. c))) (c f (k. b (l. c)) (k. l. b (m. c))) (k. l. b (m. c) d (l (f k) (m. k)) (m. n. c)) (c f (k. b (l. c)) (k. b (l. c) d) (k. c k))\r
-  e (f g) (k. g) (c f) (k. i) (k. l. h) (k. l. m. n. m) (b (k. c) (k. l. b (m. c)) (k. c f)) (k. l. m. k (f g) (n. g) (c f) (n. k))\r
-  b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f)) (b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f))) (k. b (l. c) b (l. b (m. c))) (k. b (l. c))\r
-  b (k. c) d (e (f g) (k. g)) (k. l. m. n. m) (k. l. m. b (n. k) d (b (n. k))) (b (k. c) (k. e) (k. l. m. b (n. c))) (e (f g) (k. g) (c f) (k. i) (k. l. h) (k. l. m. n. m) (b (k. c) (k. l. b (m. c)) (k. c f)) (k. l. m. k (f g) (n. g) (c f) (n. k)))\r
-  b (k. c) d (e (f g) (k. g)) (k. l. c) (k. l. b (m. c)) (k. l. c) (b (k. c) (k. l. b (m. c)) (k. c f) (k. e (f g)))\r
-\r
-N b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f)) (b (k. c) (k. e) f (b (k. c) (k. l. b (m. c)) (k. c f))) (k. b (l. c) b (l. b (m. c))) (e (f g) (k. g) (c f) (c f (k. b (l. c)) (k. e))) Z\r
-  b (k. c) d (e (f g) (k. g)) (k. l. m. n. m) (k. l. m. b (n. k) d (b (n. k))) (e (f g) (k. g) (c f) (k. e) (k. b (l. c) d (b (l. c)))) (k. e (f g) (l. g) (c f) (l. k) (l. m. h)) Z\r
-  b (k. c) d (e (f g) (k. g)) (k. l. c) (k. l. b (m. c)) (k. l. m. n. o. p. o) (e (f g) (k. g) (c f) (k. i) f) Z\r
-  b (k. c) d (e (f g) (k. g)) (k. l. c) (k. l. b (m. c)) (k. l. c) (k. b) Z\r
-  e (f g) (k. g) (c f) (k. e) (k. b (l. c)) (c f (k. b (l. c)) (k. l. b (m. k))) (k. b (l. k)) (e (f g) (k. g) (c f) (c f (k. b (l. c)) (k. e))) Z\r
diff --git a/ocaml/problems/solved b/ocaml/problems/solved
deleted file mode 100644 (file)
index 6ea3dd2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-$! Scott mk_math with empty bs\r
-D b (_. _. BOT)\r
-C b\r
diff --git a/ocaml/problems/w b/ocaml/problems/w
deleted file mode 100644 (file)
index e3a5dd2..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-$? w1\r
-D x y\r
-C x BOMB\r
-\r
-$? w2\r
-D x y z\r
-C x BOMB z\r
-  x y y\r
-\r
-$! w3\r
-D b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (k. b c d (l. c (l k)) (b c (l. e e) (b c d (l. e l) (e e (b (l. m. b)) d (l. d))) (l. c)))\r
-C b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) (k. e e) (k. g (l. g (m. b c)) (l. i (f g)))\r
-C b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (d b (k. b)) (k. d k (k (l. m. k)) (c (e h))) (b c (k. c (e h)))\r
-C b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) (k. e e)\r
-C b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (d b (k. b)) (k. d k (k (l. m. k)) (c (e h)))\r
-C b (k. l. b) (e f) (b c d) (e e (b (k. l. b)) d) (e (k. l. b c) (k. l. b k) (b c)) d (e e (e e) (d (k. f)) (b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))))) (e e (b (k. l. b)) (b (k. l. b) (e f) (b c d)) (e e (b (k. l. b)) d (k. d) (b (k. l. b))) (k. b c k (l. e l) (e e (b (l. m. b)) k (l. k)) (f g (c (e h))) (k b (l. b) (f g (e f))) (c (e h))) (k. i (f g) (l. l)))\r
-N b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (d b (k. b)) (k. l. c (l k)) Z\r
-  b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) Z\r
-  b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) (k. l. c (k h)) Z\r
-  b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) (k. l. c (k h)) (d b (b c d (k. c (k h))) (b c d (k. e k) (b c))) Z\r
-  b c d (k. e k) (e e (b (k. l. b)) d (k. d)) (f g (c (e h))) (d b (k. b) (f g (e f))) (c (e h)) (e e (b (k. l. b)) (k. e k)) (k. b k d (l. e l) (e e (b (l. m. b)) d (l. d)) (f g (k (e h)))) Z\r
-\r
-$! w4\r
-D b (c b) (k. d) (e f (k. e) (k. b) (f d)) (e f (k. g k) d) (k. c k (c k g))\r
-C c (k. l. l b k) (k. l. d) (e f (k. k) (g e)) (k. l. m. n. n b m) (k. b (b (k e))) (k. g) (e f (k. k (g e) h) b (e (k. g) (h c (g c) f)))\r
-  e f (k. k) (k. l. c b) (k. l. l (k b) g) (k. e f (l. l)) (h c (c (k. l. l b k) (k. l. d) (e f (k. k) (g e))) (k. g e (g e))) (k. g (l. e f g) (l. h c) (g (l. e f g) (l. h c)))\r
-  e f (k. k (g e) h) (g (k. e f g) (c (c b g) (k. l. l b g))) (k. k (g e) h) (k. h) (b (b (g e)) (k. c (l. m. m b l))) (k. l. g l (g l) (m. c b))\r
-  c (k. l. l b k) (k. l. d) (e f (k. k) (g e)) (k. l. m. n. n b m) (k. b (b (k e))) (k. g)\r
-  e f (k. k) (g e) (e f (k. e)) (e f (k. e)) (h c (b (g e) h (k. c (l. m. m k l))))\r
-N c (k. l. l b k) (k. l. d) (e f (k. k) (g e)) (k. l. m. n. n b m) (k. b (b (k e))) (k. i) Z\r
-  e f (k. k (g e) h) (g (k. e f g) (c (c b g) (k. l. l b g))) (k. k (g e) h) (k. h) (b (b (g e)) (k. c (l. m. m b l))) (h (c b) g i) Z\r
-  e f (k. k) (g e) (e f (k. e)) (h (k. g e (g e)) (h (k. g e (g e)))) (k. d) Z\r
-  e f (k. k) (g e) (e f (k. e)) (h (k. g e (g e)) (h (k. g e (g e)))) (k. d) (k. l. m. c k) Z\r
-  g (k. e f g) (k. h c) (b (g e) h (k. c (l. m. m k l))) (k. c b g) (k. e f (l. l) (g e) (e f (l. e))) f Z\r
-\r
-# This was failing because special_k was too low\r
-$! low special_k\r
-D x PAC PAC PAC PAC PAC a\r
-C x PAC PAC PAC PAC PAC b\r
-N y x\r
-  y z\r
-# In general:\r
-  DIV x (n times PAC) a\r
-  CON x (n times PAC) b\r
-  1 y (m times lambda. x) 0\r
-  2 y z 0\r
-  when x steps on the n+1-th argument,\r
-  y must apply n+m+1 variables\r
-  Thus special_k must be >=n+m+1\r
-\r
-$! eatable right away\r
-D y y\r
-C x (_. y y)\r
-\r
-\r
-#$? should raise a parsing error\r
-# (div occurs as subterm at top-level in conv and ps)\r
- D (a b)\r
- C ((((((((a (v (y. y))) (v c)) ((x ((a (v (y. y))) (v c))) y)) (((a (v (y. y))) (((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y))))))) (((v (x. (v c))) (v (x. (v c)))) (((((z z) b) (c. a)) (z z)) (b c))))) (a. ((((z z) b)(c. a)) (z z)))) (y. (z z))) (((a (v (y. y))) w) (z. x))) (w. (z. (v (y. y)))))\r
- C ((((((((z z) b) (c. a)) (z z)) ((v (y. y)) a)) (v (y. y))) ((((a (v (y. y))) (v c)) (z z)) ((a (v (y. y))) (((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y))))))))) (z. ((v (y. y)) a)))\r
- C (((((((a (v (y. y))) w) (a b)) ((b (x. (b. a))) (b. (v. ((((z z) b) (c. a)) (z z)))))) (a. (z. (b. w)))) (x. (((w v) ((z z) (a (v (y. y))))) ((a (v (y. y))) (v c))))) (((z z) (a (v (y. y)))) (b. a)))\r
- C (((((((z z) b) (c. a)) (z z)) (b c)) (b. a)) (((v (x. (v c))) (((v (x. (v c))) ((z z) b)) (a. (w. (v. (z. (v (y. y)))))))) ((x ((a (v (y. y))) (v c))) (b. (c. y)))))\r
- C (((((((z z) b) (c. a)) (z z)) (b c)) (b. a)) (y. (x. z)))\r
- N ((((((((a (v (y. y))) w) (a b)) ((b (x. (b. a))) (b. (v. ((((z z) b) (c. a)) (z z)))))) (a. (z. (b. w)))) (x. (((w v)((z z) (a (v (y. y))))) ((a (v (y. y))) (v c))))) (((z z) (a (v (y. y)))) (b. a))) (w. ((((w v) ((z z) (a (v (y. y)))))((a (v (y. y))) (v c))) (((((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y)))))) ((z z) a)) (y. ((v c)((((z z) b) (c. a)) (w (c. (v c)))))))))) Z\r
- N (((((((a (v (y. y))) (v c)) ((x ((a (v (y. y))) (v c))) y)) (((a (v (y. y))) (((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y))))))) (((v (x. (v c))) (v (x. (v c)))) (((((z z) b) (c. a)) (z z)) (b c))))) (a. ((((z z) b) (c. a)) (z z)))) (y. (z z))) (((a (v (y. y))) w) (z. x))) Z\r
- N (((((((z z) b) (c. a)) (z z)) ((v (y. y)) a)) (v (y. y))) ((((a (v (y. y))) (v c)) (z z)) ((a (v (y. y))) (((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y))))))))) Z\r
- N (((((((z z) b) (c. a)) (z z)) (b c)) (b. a)) (y. (x ((z z) a)))) Z\r
- N (((((((z z) b) (c. a)) (z z)) (b c)) (x. (((z z) b) (c. a)))) (((v c) ((((z z) b) (c. a)) (w (c. (v c))))) (w. (v. (z. (v (y. y))))))) Z\r
diff --git a/ocaml/ptest.ml b/ocaml/ptest.ml
deleted file mode 100644 (file)
index 8a21229..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-open Unix;;
-let process_output_to_list2 = fun command ->
-  let chan = open_process_in command in
-  let res = ref ([] : string list) in
-  let rec process_otl_aux () =
-    let e = input_line chan in
-    res := e::!res;
-    process_otl_aux() in
-  try process_otl_aux ()
-  with End_of_file ->
-    let stat = close_process_in chan in (List.rev !res,stat)
-let cmd_to_list command =
-  let (l,_) = process_output_to_list2 command in l;;
-
-let lines = cmd_to_list "tput cols" in
-prerr_endline (List.hd (lines));;
diff --git a/ocaml/pure.ml b/ocaml/pure.ml
deleted file mode 100644 (file)
index 51d1feb..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-open Util.Vars
-
-module Pure =
-struct
-
-type t =
-  | V of int
-  | A of t * t
-  | L of t
-  | B
-
-let rec print ?(l=[]) =
- function
-    V n -> print_name l n
-  | A(t1,t2) -> "(" ^ print ~l t1 ^ " " ^ print ~l t2 ^ ")"
-  | L t ->
-     let name = string_of_var (List.length l) in
-     "λ" ^ name ^ "." ^ print ~l:(name::l) t
-  | B -> "B"
-
-let lift m =
- let rec aux l =
-  function
-   | V n -> V (if n < l then n else n+m)
-   | A (t1,t2) -> A (aux l t1, aux l t2)
-   | L t -> L (aux (l+1) t)
-   | B -> B
- in
-  aux 0
-
-(* Reference implementation.
-   Reduction machine used below
-let subst delift_by_one what with_what =
- let rec aux l =
-  function
-   | A(t1,t2) -> A(aux l t1, aux l t2)
-   | V n ->
-       if n = what + l then
-        lift l with_what
-       else
-        V (if delift_by_one && n >= l then n-1 else n)
-   | L t -> L (aux (l+1) t)
- in
-  aux 0
-
-let rec whd =
- function
-  | A(t1, t2) ->
-     let t2 = whd t2 in
-     let t1 = whd t1 in
-      (match t1 with
-        | L f -> whd (subst true 0 t2 f)
-        | V _
-        | A _ -> A(t1,t2))
-  | V _
-  | L _ as t -> t
-*)
-
-let unwind ?(tbl = Hashtbl.create 317) m =
- let rec unwind (e,t,s) =
-  let cache_unwind m =
-   try
-    Hashtbl.find tbl m
-   with
-    Not_found ->
-     let t = unwind m in
-      Hashtbl.add tbl m t ;
-      t in
-  let s = List.map cache_unwind s in
-  let rec aux l =
-   function
-    | A(t1,t2) -> A(aux l t1, aux l t2)
-    | V n as x when n < l -> x
-    | V n ->
-       (try
-         lift l (cache_unwind (List.nth e (n - l)))
-        with Failure _ -> V (n - l))
-    | L t -> L (aux (l+1) t)
-    | B -> B in
-  let t = aux 0 t in
-  List.fold_left (fun f a -> A(f,a)) t s
-in
- unwind m
-
-let mwhd m =
- let rec aux =
-  function
-   | (e,A(t1,t2),s) ->
-       let t2' = aux (e,t2,[]) in
-       let (_,t,_) = t2' in
-       if t = B
-        then t2'
-        else aux (e,t1,t2'::s)
-   | (e,L t,x::s) -> aux (x::e,t,s)
-   | (e,V n,s) as m ->
-      (try
-        let e,t,s' = List.nth e n in
-        aux (e,t,s'@s)
-       with Failure _ -> m)
-   | (e, B, _) -> (e, B, [])
-   | (_,L _,[]) as m -> m
- in
-  unwind (aux m)
-
-end
-
-module Scott =
-struct
-
-open Pure
-
-let rec mk_n n =
- if n = 0 then L (L (A (V 1, L (V 0)))) else L (L (A (V 0, mk_n (n-1))))
-
-let dummy = V (max_int / 2)
-
-let mk_match t bs =
- let bs = List.sort (fun (n1,_) (n2,_) -> compare n1 n2) bs in
- let rec aux m t =
-  function
-     [] -> A (L dummy, t)
-   | (n,p)::tl as l ->
-      if n = m then
-       A (A (t, L (lift (m+1) p)), L (aux (m+1) (V 0) tl))
-      else
-       A (A (t, dummy), L (aux (m+1) (V 0) l))
- in
-  aux 0 t bs
-
-end
diff --git a/ocaml/pure.mli b/ocaml/pure.mli
deleted file mode 100644 (file)
index a6b90ac..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-module Pure :
-  sig
-    type t = V of int | A of t * t | L of t | B
-    val print : ?l:string list -> t -> string
-    val lift : int -> t -> t
-    val unwind : ?tbl:('a list * t * 'a list as 'a, t) Hashtbl.t -> 'a -> t
-    val mwhd : (('a * t * ('b list as 'c) as 'b) list as 'a) * t * 'c -> t
-  end
-
-module Scott :
-  sig
-    val mk_n : int -> Pure.t
-    val dummy : Pure.t
-    val mk_match : Pure.t -> (int * Pure.t) list -> Pure.t
-  end
diff --git a/ocaml/run b/ocaml/run
deleted file mode 100644 (file)
index 77957cd..0000000
--- a/ocaml/run
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-
-file=`mktemp`
-
-echo
-echo "Running test. Log file: $file."
-echo
-
-trap 'echo' SIGINT
-
-
-./test4.out 2>&1 | tee $file | stdbuf -o0 grep -Po '(?<=measure=)[^ ]*' | stdbuf -o0 tr '\n' ' '
-
-if [ $? -eq 0 ]
-then
- rm $file
- echo
- echo 'Test succeeded'
-else
- echo ''
- echo 'Test failed or interrupted'
- echo "Please have a look at log file: $file ."
-fi
diff --git a/ocaml/sat.ml b/ocaml/sat.ml
deleted file mode 100644 (file)
index 01d7398..0000000
+++ /dev/null
@@ -1,535 +0,0 @@
-(*\r
- Reductions from SAT and 3-colorability of graphs to separation\r
- of lambda-terms. Commented out the encoding from SAT.\r
-*)\r
-\r
-open Util;;\r
-\r
-(* type cnf = int list list;;\r
-\r
-let (++) f g x = f (g x);;\r
-\r
-let maxvar : cnf -> int =\r
- let aux f = List.fold_left (fun acc x -> max acc (f x)) 0 in\r
- aux (aux abs)\r
-;; *)\r
-\r
-type graph = (int * int) list;;\r
-type color = int;;\r
-\r
-let arc x y = min x y, max x y;;\r
-let mem g x y = List.mem (arc x y) g;;\r
-\r
-(* let reduction_sat_3col p =\r
- let triangle a0 a1 a2 = [arc a0 a1; arc a0 a2; arc a1 a2] in\r
- let init0 = triangle 0 1 2 in\r
- (* 0false; 1true; 2base*)\r
- let n = maxvar p in\r
- let init1 = Array.to_list (Array.mapi (fun i () -> triangle (2*i+1) (2*(i+1)) 2) (Array.make n ())) in\r
- let freshno = ref (2 * n + 3) in\r
- let mk_triangle () =\r
-  let i = !freshno in\r
-  freshno := i+3; i, i+1, i+2 in\r
- let rec translate = function\r
- | [] -> assert false\r
- | x::[] -> [triangle 0 2 x]\r
- | x::y::l ->\r
-    let a,b,c = mk_triangle () in\r
-    triangle a b c :: [arc x a; arc y b] :: translate (c::l) in\r
- let p = List.map (List.map (fun x ->\r
-   if x = 0 then assert false\r
-    else if x < 0 then 2 * (abs x + 1)\r
-    else 2 * x + 1\r
-  )) p in\r
- let init2 = List.map (List.concat ++ translate) p in\r
- !freshno, init0 @ List.concat (init1 @ init2)\r
-;;\r
-\r
-let string_of_graph g =\r
- String.concat " " (List.map (fun (x,y) -> string_of_int x ^ "<>" ^ string_of_int y) g)\r
-;; *)\r
-\r
-(* let main p =\r
- let mv = maxvar p in\r
- prerr_endline (string_of_int mv);\r
- let _, g = reduction_sat_3col p in\r
- prerr_endline (string_of_graph g);\r
- generate ;;\r
-\r
-prerr_endline (main[\r
- [1; -2; 3];\r
- [2; 4; -5]\r
-]);; *)\r
-\r
-let p_ = "BOMB ";;\r
-let x_ = "x ";;\r
-(* y, z dummies *)\r
-let y_ = "y ";;\r
-let z_ = "z ";;\r
-(* a, b endline separators *)\r
-let a_ = "a ";;\r
-let b_ = "b ";;\r
-\r
-let generate g n max =\r
- (* 0 <= n <= max+1 *)\r
- let three f sep =\r
-  String.concat sep (List.map f [0;1;2]) in\r
- let rec aux' n m color =\r
-  if m = -1 then x_\r
-  else aux' n (m-1) color ^\r
-   if n = m then\r
-     (if List.mem (n,n) g then p_^p_^p_ (* cappio nel grafo *)\r
-      else three (fun c -> if color = c then y_ else p_) "")\r
-   else if n < m then y_^y_^y_\r
-   else if List.mem (m,n) g then\r
-    three (fun c -> if color = c then p_ else y_) ""\r
-   else y_^y_^y_ in\r
- let rec aux m =\r
-  if m = -1 then x_\r
-   else aux (m-1) ^\r
-    if n < m then p_^p_^p_\r
-    else if n = m then\r
-      "(_." ^ three (aux' n max) "b) (_." ^ "b) "\r
-    else y_^y_^y_\r
- in aux max ^ a_\r
-;;\r
-\r
-let generate2 g n max =\r
- let rec aux m =\r
-  if m = -1 then x_\r
-   else aux (m-1) ^\r
-    if n < m then p_^p_^p_\r
-    else if n = m\r
-    then z_^z_^z_\r
-    else y_^y_^y_\r
- in aux max ^ p_\r
-;;\r
-\r
-\r
-let encode_graph g =\r
- let g = List.map (fun (x,y) -> min x y, max x y) g in\r
- let mapi f a = Array.to_list (Array.mapi f a) in\r
- let nodex_no =\r
-  List.fold_left (fun acc (a,b) -> Pervasives.max acc (Pervasives.max a b)) 0 in\r
- String.concat "\n" ("\n$ problem from 3-colorability" ::\r
-  let no = nodex_no g in\r
-  mapi (fun i () ->\r
-    (if i = no+1 then "D " else "C ") ^ generate g i no\r
-  ) (Array.make (no+2) ()) @\r
-  mapi (fun i () ->\r
-    "C " ^ generate2 g i no\r
-  ) (Array.make (no+1) ());\r
- )\r
-;;\r
-\r
-print_endline "Three example encodings:";;\r
-\r
-(* easy one *)\r
-prerr_endline (encode_graph [0,1;]);;\r
-\r
-(* two imopssible problems *)\r
-prerr_endline (\r
- encode_graph [0,1; 1,1]\r
-);;\r
-prerr_endline (\r
- encode_graph [0,1; 0,2; 1,2; 0,3; 1,3; 2,3]\r
-);;\r
-\r
-(******************************************************************************)\r
-\r
-print_endline "\nIt will now run some problems and decode the solutions";;\r
-print_endline "Press ENTER to continue.";;\r
-let _ = read_line ();;\r
-\r
-let strip_lambda_matches =\r
- let getvar = function\r
-  | `Var(n,_) -> n\r
-  | _ -> assert false in\r
- let rec aux n = function\r
-  | `Lam(_,t) -> aux (n+1) t\r
-  | `Match(_,_,_,bs,_) -> Some (n, List.map (getvar ++ snd) !bs)\r
-  | _ -> None\r
- in aux 0\r
-;;\r
-\r
-let next_candidates sigma cands =\r
- let sigma = Util.filter_map\r
-  (fun x -> try Some (List.assoc x sigma) with Not_found -> None) cands in\r
- match Util.find_opt strip_lambda_matches sigma with\r
- | None -> -1, []\r
- | Some x -> x\r
-;;\r
-\r
-let fix_numbers l =\r
- let rec aux n = function\r
- | [] -> []\r
- | x::xs -> (x - 2*n - 1) :: (aux (n+1) xs)\r
- in aux 0 l\r
-;;\r
-\r
-let color (g:graph) =\r
- let p = encode_graph g in\r
- let (_, _, _, _, vars as p) = Parser.problem_of_string p in\r
- let _, result = Lambda4.solve (Lambda4.problem_of p) in\r
- match result with\r
- | `Unseparable _ -> prerr_endline "Graph not colorable"; None\r
- | `Separable sigma -> (\r
-  (* start from variable x *)\r
-  let x = Util.index_of "x" vars in\r
-  (* List.iter (fun x -> prerr_endline (string_of_int (fst x) ^ ":" ^ Num.print ~l:vars (snd x))) sigma; *)\r
-  let rec iter f x =\r
-   let n, x = f x in if x = [] then [] else n :: iter f x in\r
-  let numbers = iter (next_candidates sigma) [x] in\r
-  let numbers = fix_numbers numbers in\r
-  (* display solution *)\r
-  let colors = ["r"; "g"; "b"] in\r
-  prerr_endline ("\nSolution found:\n " ^ String.concat "\n "\r
-   (List.mapi (fun i x ->\r
-     string_of_int i ^ " := " ^ List.nth colors x) numbers));\r
-  assert (List.for_all (fun (a,b) -> List.nth numbers a <> List.nth numbers b) g);\r
-  Some numbers)\r
-;;\r
-\r
-let bruteforce g =\r
- let nodes_no = 1+\r
-  List.fold_left (fun acc (a,b) -> Pervasives.max acc (Pervasives.max a b)) 0 g in\r
- let check x = if List.for_all (fun (a,b) -> List.nth x a <> List.nth x b) g\r
-  then failwith "bruteforce: sat" in\r
- let rec guess l = prerr_string "+";\r
-  if List.length l = nodes_no\r
-   then check l\r
-    else (guess (0::l); guess (1::l); guess (2::l)) in\r
- guess [];\r
- prerr_endline "bruteforce: unsat"\r
-;;\r
-\r
-assert (color [0,1;0,2;1,2;2,3;3,0] <> None);;\r
-assert (color [0,1;0,2;1,2;2,3;3,0;0,4;4,2] <> None);;\r
-\r
-(* assert (color [\r
- 1,2; 1,4; 1,7; 1,9; 2,3; 2,6; 2,8; 3,5;\r
- 3,7; 3,0; 4,5; 4,6; 4,0; 5,8; 5,9; 6,11;\r
- 7,11; 8,11; 9,11; 0,11;\r
-] = None);; *)\r
-\r
-(* https://turing.cs.hbg.psu.edu/txn131/file_instances/coloring/graph_color/queen5_5.col *)\r
-color [1,7\r
-; 1,13\r
-; 1,19\r
-; 1,25\r
-; 1,2\r
-; 1,3\r
-; 1,4\r
-; 1,5\r
-; 1,6\r
-; 1,11\r
-; 1,16\r
-; 1,21\r
-; 2,8\r
-; 2,14\r
-; 2,20\r
-; 2,6\r
-; 2,3\r
-; 2,4\r
-; 2,5\r
-; 2,7\r
-; 2,12\r
-; 2,17\r
-; 2,22\r
-; 2,1\r
-; 3,9\r
-; 3,15\r
-; 3,7\r
-; 3,11\r
-; 3,4\r
-; 3,5\r
-; 3,8\r
-; 3,13\r
-; 3,18\r
-; 3,23\r
-; 3,2\r
-; 3,1\r
-; 4,10\r
-; 4,8\r
-; 4,12\r
-; 4,16\r
-; 4,5\r
-; 4,9\r
-; 4,14\r
-; 4,19\r
-; 4,24\r
-; 4,3\r
-; 4,2\r
-; 4,1\r
-; 5,9\r
-; 5,13\r
-; 5,17\r
-; 5,21\r
-; 5,10\r
-; 5,15\r
-; 5,20\r
-; 5,25\r
-; 5,4\r
-; 5,3\r
-; 5,2\r
-; 5,1\r
-; 6,12\r
-; 6,18\r
-; 6,24\r
-; 6,7\r
-; 6,8\r
-; 6,9\r
-; 6,10\r
-; 6,11\r
-; 6,16\r
-; 6,21\r
-; 6,2\r
-; 6,1\r
-; 7,13\r
-; 7,19\r
-; 7,25\r
-; 7,11\r
-; 7,8\r
-; 7,9\r
-; 7,10\r
-; 7,12\r
-; 7,17\r
-; 7,22\r
-; 7,6\r
-; 7,3\r
-; 7,2\r
-; 7,1\r
-; 8,14\r
-; 8,20\r
-; 8,12\r
-; 8,16\r
-; 8,9\r
-; 8,10\r
-; 8,13\r
-; 8,18\r
-; 8,23\r
-; 8,7\r
-; 8,6\r
-; 8,4\r
-; 8,3\r
-; 8,2\r
-; 9,15\r
-; 9,13\r
-; 9,17\r
-; 9,21\r
-; 9,10\r
-; 9,14\r
-; 9,19\r
-; 9,24\r
-; 9,8\r
-; 9,7\r
-; 9,6\r
-; 9,5\r
-; 9,4\r
-; 9,3\r
-; 10,14\r
-; 10,18\r
-; 10,22\r
-; 10,15\r
-; 10,20\r
-; 10,25\r
-; 10,9\r
-; 10,8\r
-; 10,7\r
-; 10,6\r
-; 10,5\r
-; 10,4\r
-; 11,17\r
-; 11,23\r
-; 11,12\r
-; 11,13\r
-; 11,14\r
-; 11,15\r
-; 11,16\r
-; 11,21\r
-; 11,7\r
-; 11,6\r
-; 11,3\r
-; 11,1\r
-; 12,18\r
-; 12,24\r
-; 12,16\r
-; 12,13\r
-; 12,14\r
-; 12,15\r
-; 12,17\r
-; 12,22\r
-; 12,11\r
-; 12,8\r
-; 12,7\r
-; 12,6\r
-; 12,4\r
-; 12,2\r
-; 13,19\r
-; 13,25\r
-; 13,17\r
-; 13,21\r
-; 13,14\r
-; 13,15\r
-; 13,18\r
-; 13,23\r
-; 13,12\r
-; 13,11\r
-; 13,9\r
-; 13,8\r
-; 13,7\r
-; 13,5\r
-; 13,3\r
-; 13,1\r
-; 14,20\r
-; 14,18\r
-; 14,22\r
-; 14,15\r
-; 14,19\r
-; 14,24\r
-; 14,13\r
-; 14,12\r
-; 14,11\r
-; 14,10\r
-; 14,9\r
-; 14,8\r
-; 14,4\r
-; 14,2\r
-; 15,19\r
-; 15,23\r
-; 15,20\r
-; 15,25\r
-; 15,14\r
-; 15,13\r
-; 15,12\r
-; 15,11\r
-; 15,10\r
-; 15,9\r
-; 15,5\r
-; 15,3\r
-; 16,22\r
-; 16,17\r
-; 16,18\r
-; 16,19\r
-; 16,20\r
-; 16,21\r
-; 16,12\r
-; 16,11\r
-; 16,8\r
-; 16,6\r
-; 16,4\r
-; 16,1\r
-; 17,23\r
-; 17,21\r
-; 17,18\r
-; 17,19\r
-; 17,20\r
-; 17,22\r
-; 17,16\r
-; 17,13\r
-; 17,12\r
-; 17,11\r
-; 17,9\r
-; 17,7\r
-; 17,5\r
-; 17,2\r
-; 18,24\r
-; 18,22\r
-; 18,19\r
-; 18,20\r
-; 18,23\r
-; 18,17\r
-; 18,16\r
-; 18,14\r
-; 18,13\r
-; 18,12\r
-; 18,10\r
-; 18,8\r
-; 18,6\r
-; 18,3\r
-; 19,25\r
-; 19,23\r
-; 19,20\r
-; 19,24\r
-; 19,18\r
-; 19,17\r
-; 19,16\r
-; 19,15\r
-; 19,14\r
-; 19,13\r
-; 19,9\r
-; 19,7\r
-; 19,4\r
-; 19,1\r
-; 20,24\r
-; 20,25\r
-; 20,19\r
-; 20,18\r
-; 20,17\r
-; 20,16\r
-; 20,15\r
-; 20,14\r
-; 20,10\r
-; 20,8\r
-; 20,5\r
-; 20,2\r
-; 21,22\r
-; 21,23\r
-; 21,24\r
-; 21,25\r
-; 21,17\r
-; 21,16\r
-; 21,13\r
-; 21,11\r
-; 21,9\r
-; 21,6\r
-; 21,5\r
-; 21,1\r
-; 22,23\r
-; 22,24\r
-; 22,25\r
-; 22,21\r
-; 22,18\r
-; 22,17\r
-; 22,16\r
-; 22,14\r
-; 22,12\r
-; 22,10\r
-; 22,7\r
-; 22,2\r
-; 23,24\r
-; 23,25\r
-; 23,22\r
-; 23,21\r
-; 23,19\r
-; 23,18\r
-; 23,17\r
-; 23,15\r
-; 23,13\r
-; 23,11\r
-; 23,8\r
-; 23,3\r
-; 24,25\r
-; 24,23\r
-; 24,22\r
-; 24,21\r
-; 24,20\r
-; 24,19\r
-; 24,18\r
-; 24,14\r
-; 24,12\r
-; 24,9\r
-; 24,6\r
-; 24,4\r
-; 25,24\r
-; 25,23\r
-; 25,22\r
-; 25,21\r
-; 25,20\r
-; 25,19\r
-; 25,15\r
-; 25,13\r
-; 25,10\r
-; 25,7\r
-; 25,5\r
-; 25,1];;\r
diff --git a/ocaml/sat.mli b/ocaml/sat.mli
deleted file mode 100644 (file)
index 81d7ee7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-type graph = (int * int) list\r
-type color\r
-\r
-val encode_graph : graph -> string\r
-val color: graph -> (color list) option\r
diff --git a/ocaml/test.ml b/ocaml/test.ml
deleted file mode 100644 (file)
index 629bf89..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-open Lambda4;;
-open Util;;
-
-let acaso l =
-    let n = Random.int (List.length l) in
-    List.nth l n
-;;
-
-let acaso2 l1 l2 =
-  let n1 = List.length l1 in
-  let n = Random.int (n1 + List.length l2) in
-  if n >= n1 then List.nth l2 (n - n1) else List.nth l1 n
-;;
-
-(** with bombs and pacmans too *)
-let acaso3 l1 l2 =
- if Random.int 10 = 0 then (
-  if Random.int 2 = 0 then "BOMB" else "PAC"
- ) else
-  let n1 = List.length l1 in
-  let n = Random.int (n1 + List.length l2) in
-  if n >= n1 then List.nth l2 (n - n1) else List.nth l1 n
-;;
-
-(* let rec take l n =
-  if n = 0 then []
-  else match l with
-  | [] -> []
-  | x::xs -> x :: (take xs (n-1))
-;; *)
-
-let gen n vars =
-  let rec take' l n =
-    if n = 0 then [], []
-    else match l with
-    | [] -> [], []
-    | [_] -> assert false
-    | x1::x2::xs -> let a, b = take' xs (n-1) in x1::a,x2::b in
-  let rec aux n inerts lams =
-    if n = 0 then List.hd inerts, take' (Util.sort_uniq (List.tl inerts)) 5
-    else let inerts, lams = if Random.int 2 = 0
-      then inerts, ("(" ^ acaso vars ^ ". " ^ acaso2 inerts lams ^ ")") :: lams
-      else ("(" ^ acaso inerts ^ " " ^ acaso2 inerts lams^ ")") :: inerts, lams
-    in aux (n-1) inerts lams
-  in aux (2*n) vars []
-;;
-
-let gen_pac n vars =
- let rec take' l n =
-  if n = 0 then [], []
-  else match l with
-  | [] -> [], []
-  | [_] -> assert false
-  | x1::x2::xs -> let a, b = take' xs (n-1) in x1::a,x2::b in
- let rec aux n inerts lams =
-  if n = 0 then List.hd inerts, take' (Util.sort_uniq (List.tl inerts)) 5
-  else let inerts, lams = if Random.int 2 = 0
-    then inerts, ("(" ^ acaso vars ^ ". " ^ acaso3 inerts lams ^ ")") :: lams
-    else ("(" ^ acaso inerts ^ " " ^ acaso3 inerts lams^ ")") :: inerts, lams
-  in aux (n-1) inerts lams
- in aux (2*n) vars []
-;;
-
-
-let rec repeat f n =
-  prerr_endline "\n########################### NEW TEST ###########################";
-  f () ;
-  if n > 0 then repeat f (n-1)
-;;
-
-let solve div convs nums label =
- let p = String.concat "\n" (
-  ("$! randomly generated test " ^ label) ::
-  ("D " ^ div) ::
-  List.map ((^) "C ") convs @
-  List.map (fun s -> "N " ^ s ^ " Z") nums
- ) in
- prerr_endline p;
- match (Lambda4.solve ++ Lambda4.problem_of ++ Parser.problem_of_string) p with
- | `Uncomplete, `Unseparable _ ->
-    failwith ("Test4.solve: unseparable, and cannot tell if that's right or not.")
- | _ -> ()
-;;
-
-let main =
- Random.self_init ();
- (* num = number of tests to run *)
- let num = 100 in
- (* if flag --with-pac active, then more general tests *)
- let with_pac = List.mem "--with-pac" (Array.to_list Sys.argv) in
-
- let label, f = if with_pac
-  then (
-   let complex = 10 in
-   let vars = ["x"; "y"; "z"; "v" ; "w"; "a"; "b"; "c"] in
-   "with pacmans & bombs", fun () -> gen_pac complex vars
-  ) else (
-   let complex = 200 in
-   let vars = ["x"; "y"; "z"; "v" ; "w"; "a"; "b"; "c"] in
-   "", fun () -> gen complex vars
-   ) in
-
- repeat (fun _ ->
-   let div, (conv, nums) = f () in
-   solve div conv nums label
- ) num;
-
- prerr_endline "\n---- ALL TESTS COMPLETED ----"
-;;
diff --git a/ocaml/tmp.ml b/ocaml/tmp.ml
deleted file mode 100644 (file)
index 624875f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-(((((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a)) (x. (w. (w. c)))) (((a (y c)) ((y c) ((a v) (w (z. a))))) (w. c)))\r
-((((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a)) (x. (w. (w. c))))\r
-(((((b (a v)) (a. (y c))) z) (w. w)) ((a c) c))\r
-(((((v (((a v) w) (((a v) w) v))) (w. c)) (b (a v))) c) (z. a))\r
-((((a (y c)) ((y c) ((a v) (w (z. a))))) (w. c)) (x. w))\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-let fancy_of_term : nf -> Console.fancyobj =\r
-  let open Console in\r
-  let of_var level n =\r
-    if n < level\r
-    then fancy_of_string (string_of_var n)\r
-    else (("x" ^ string_of_int (level-n-1)) / ("var<sup>" ^ string_of_int (n-level) ^ "</sup>"))\r
-  in let rec aux level = function\r
-    `Var n -> of_var level n\r
-  | `N n -> fancy_of_string (string_of_int n)\r
-  | `Match(t,bs_lift,bs,args) ->\r
-     "([" ^^ aux level (t :> nf) ^^\r
-     " ? " ^ String.concat " | " (List.map (fun (n,t) -> string_of_int n ^ " => " ^ print ~l (lift bs_lift t)) !bs) ^ "] " ^\r
-     String.concat " " (List.map (print ~l) args) ^ ")"\r
-  | `I(n,args) -> "(" ^ print_name l n ^ " " ^ String.concat " " (Listx.to_list (Listx.map (print ~l) args)) ^ ")"\r
-  | `Lam nf ->\r
-     let name = string_of_var (List.length l) in\r
-     "λ" ^ name ^ "." ^ print ~l:(name::l) (nf : nf)\r
-  in aux 0\r
-;;\r
diff --git a/ocaml/util.ml b/ocaml/util.ml
deleted file mode 100644 (file)
index a87b96f..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-(* Function composition *)
-let (++) f g x = f (g x);;
-
-let findi p =
- let rec aux n = function
- | [] -> raise Not_found
- | x::_ when p x -> n, x
- | _::xs -> aux (n+1) xs
- in aux 0
-;;
-
-let option_map f = function
- | None -> None
- | Some x -> Some (f x)
-;;
-
-let option_get = function
- | Some x -> x
- | None -> failwith "option_get: None"
-;;
-
-let rec find_opt f =
- function
-    [] -> None
-  | x::xs ->
-     match f x with
-        None -> find_opt f xs
-      | Some _ as res -> res
-
-let rec index_of ?(eq=(=)) x =
- function
-    [] -> raise Not_found
-  | y::_ when eq x y -> 0
-  | _::l -> 1 + index_of ~eq x l
-
-let index_of_opt ?eq l t =
- try
-  Some (index_of ?eq t l)
- with
-  Not_found -> None
-;;
-
-let rec filter_map f =
- function
-    [] -> []
-  | hd::tl ->
-     match f hd with
-        None -> filter_map f tl
-      | Some x -> x::filter_map f tl
-;;
-
-(* the input must be sorted *)
-let rec first_duplicate =
- function
-    []
-  | [_] -> None
-  | x::y::_ when x=y -> Some x
-  | _::tl -> first_duplicate tl
-
-(* the input must be sorted
-   output: list of non duplicates; list of duplicates *)
-let rec split_duplicates =
- function
-    [] -> [],[]
-  | [x] -> [x],[]
-  | x::(y::_ as tl) ->
-     let nondup,dup = split_duplicates tl in
-     if x = y then
-      List.filter ((<>) x) nondup, x::dup
-     else
-      x::nondup,dup
-
-(* Non c'e' nella vecchia versione di OCaml :( *)
-let uniq ?(compare=compare) =
-  let rec aux = function
-  | [] -> []
-  | [_] as ts -> ts
-  | t1 :: (t2 :: _ as ts) ->
-    if compare t1 t2 = 0 then aux ts else t1 :: (aux ts)
-  in aux
-
-let sort_uniq ?(compare=compare) l = uniq ~compare (List.sort compare l)
-
-let rec list_cut = function
-  | 0, lst -> [], lst
-  | n, x::xs -> let a, b = list_cut (n-1,xs) in x::a, b
-  | _ -> assert false
-;;
-
-let concat_map f l = List.concat (List.map f l);;
-
-let rec take n =
- function
- | [] -> assert (n = 0); []
- | _ when n = 0 -> []
- | x::xs -> x::(take (n-1) xs)
-;;
-
-module Vars =
-struct
-
-let string_of_var v =
-  if v > 25
-     then "`" ^ string_of_int v
-     else String.make 1 (char_of_int (v + int_of_char 'a'))
-;;
-
-let var_of_string s =
- if String.length s <> 1 then (
-   if s.[0] = '`' then int_of_string (String.sub s 1 (-1 + String.length s)) else assert false
- ) else int_of_char s.[0] - int_of_char 'a'
-
-let print_name l n =
- if n = -1
-  then "*"
-  else if n >= List.length l then "x" ^ string_of_int (List.length l - n - 1) else List.nth l n
-
-end
diff --git a/ocaml/util.mli b/ocaml/util.mli
deleted file mode 100644 (file)
index 96f03ed..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-val ( ++ ) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
-val findi : ('a -> bool) -> 'a list -> (int * 'a)
-val option_map : ('a -> 'b) -> 'a option -> 'b option
-val option_get : ('a option) -> 'a
-val find_opt : ('a -> 'b option) -> 'a list -> 'b option
-val index_of : ?eq:('a -> 'a -> bool) -> 'a -> 'a list -> int
-val index_of_opt : ?eq:('a -> 'a -> bool) -> 'a list -> 'a -> int option
-val filter_map : ('a -> 'b option) -> 'a list -> 'b list
-val first_duplicate : 'a list -> 'a option
-val split_duplicates : 'a list -> 'a list * 'a list
-val uniq : ?compare:('a -> 'a -> int) -> 'a list -> 'a list
-val sort_uniq : ?compare:('a -> 'a -> int) -> 'a list -> 'a list
-val list_cut : (int * 'a list) -> ('a list * 'a list)
-val concat_map : ('a -> 'b list) -> 'a list -> 'b list
-val take : int -> 'a list -> 'a list
-module Vars :
-  sig
-    val string_of_var : int -> string
-    val var_of_string : string -> int
-    val print_name : string list -> int -> string
-  end
diff --git a/ocaml_new/.depend b/ocaml_new/.depend
new file mode 100644 (file)
index 0000000..ca50e1f
--- /dev/null
@@ -0,0 +1,26 @@
+console.cmo : console.cmi
+console.cmx : console.cmi
+lambda4.cmo : util.cmi pure.cmi num.cmi listx.cmi console.cmi lambda4.cmi
+lambda4.cmx : util.cmx pure.cmx num.cmx listx.cmx console.cmx lambda4.cmi
+listx.cmo : listx.cmi
+listx.cmx : listx.cmi
+num.cmo : util.cmi pure.cmi listx.cmi num.cmi
+num.cmx : util.cmx pure.cmx listx.cmx num.cmi
+parser.cmo : util.cmi num.cmi listx.cmi parser.cmi
+parser.cmx : util.cmx num.cmx listx.cmx parser.cmi
+problems.cmo : util.cmi parser.cmi lambda4.cmi problems.cmi
+problems.cmx : util.cmx parser.cmx lambda4.cmx problems.cmi
+pure.cmo : util.cmi pure.cmi
+pure.cmx : util.cmx pure.cmi
+test.cmo : util.cmi parser.cmi lambda4.cmi
+test.cmx : util.cmx parser.cmx lambda4.cmx
+util.cmo : util.cmi
+util.cmx : util.cmi
+console.cmi :
+lambda4.cmi : num.cmi
+listx.cmi :
+num.cmi : pure.cmi listx.cmi
+parser.cmi : num.cmi
+problems.cmi : lambda4.cmi
+pure.cmi :
+util.cmi :
diff --git a/ocaml_new/Makefile b/ocaml_new/Makefile
new file mode 100644 (file)
index 0000000..b662428
--- /dev/null
@@ -0,0 +1,36 @@
+OCAMLC = ocamlopt -g -rectypes
+LIB = unix.cmxa str.cmxa
+UTILS = util.cmx console.cmx listx.cmx pure.cmx num.cmx parser.cmx
+
+all: a.out test4.out
+
+run: test4.out
+       bash run
+
+a.out: $(UTILS) lambda4.cmx problems.cmx
+       $(OCAMLC) -o a.out $(LIB) $^
+
+sat.out: $(UTILS) lambda4.cmx sat.ml
+       $(OCAMLC) -o sat.out $(LIB) $^
+#
+test4.out: $(UTILS) lambda4.cmx test.ml
+       $(OCAMLC) -o test4.out $(LIB) $^
+
+andrea.out: $(UTILS) andrea8.ml
+       $(OCAMLC) -o andrea.out $(LIB) $(UTILS) andrea8.ml
+
+%.cmi: %.mli
+       $(OCAMLC) -c $<
+
+%.cmx: %.ml %.cmi
+       $(OCAMLC) -c $<
+
+clean:
+       rm -f *.cm* *.out *.o .depend log
+
+.depend: *.ml *.mli
+       ocamldep *.ml *.mli > .depend
+
+include .depend
+
+.PHONY: clean all run
diff --git a/ocaml_new/console.ml b/ocaml_new/console.ml
new file mode 100644 (file)
index 0000000..696a74d
--- /dev/null
@@ -0,0 +1,141 @@
+type fancyobj = <
+  to_string : unit -> string;
+  to_html : unit -> string
+>;;
+
+let sepx = "\xe2\xbf\x96";;
+let endx = "\xe2\xbf\x97";;
+
+let socket_name = "/tmp/fancy.log";;
+
+let html_enabled = Sys.file_exists socket_name;;
+
+let socket = let open Unix in
+  if html_enabled
+  then socket PF_UNIX SOCK_STREAM 0
+  else socket PF_INET SOCK_STREAM 0;;
+
+let html_enabled = if html_enabled then
+  try
+    let _ = Unix.connect socket (Unix.ADDR_UNIX socket_name) in true
+  with Unix.Unix_error _ -> false
+  else false
+;;
+
+let cols =
+  let process_output_to_list2 = fun command ->
+    let chan = Unix.open_process_in command in
+    let res = ref ([] : string list) in
+    let rec process_otl_aux () =
+      let e = input_line chan in
+      res := e::!res;
+      process_otl_aux() in
+    try process_otl_aux ()
+    with End_of_file ->
+      let stat = Unix.close_process_in chan in (List.rev !res,stat)
+  in let cmd_to_list command =
+    let (l,_) = process_output_to_list2 command in l
+  in try let lines = cmd_to_list "tput cols" in int_of_string (List.hd (lines))
+  with _ -> 100 (* default value *)
+;;
+
+let writeall s =
+  let _ = Unix.send socket s 0 (String.length s) [] in ()
+;;
+
+let concat ls = (String.concat sepx ls) ^ endx;;
+
+(* HELO message *)
+if html_enabled then
+  writeall(concat["helo"; String.concat " " (Array.to_list Sys.argv)])
+;;
+
+
+(* let logs objs =
+  if html_enabled then (
+    let strs = (List.map (fun x -> x#to_html()) objs) in
+    writeall (concat ("log" :: strs))
+  ); prerr_endline (String.concat " " (List.map (fun x -> x#to_string()) objs))
+;; *)
+
+let html_escape s =
+  let m = [("&", "&amp;"); (">", "&gt;"); ("<", "&lt;"); ("&quot;", "\""); ("&#39;", "'")]
+  in let m = List.map (fun (x,y) -> Str.regexp x, y) m
+  in List.fold_right (fun (x,y) z -> Str.global_replace x y z) m s;; (* FIXME TODO *)
+
+let fancy_of_string s : fancyobj = object
+  method to_string () = s
+  method to_html () = html_escape s
+end;;
+
+let empty = fancy_of_string "";;
+
+let line = ref empty;;
+
+let (/) a b = object
+  method to_string () = a
+  method to_html () = b
+end;;
+
+let (^^) a b = object
+  method to_string () = (a#to_string () ^ "" ^ b#to_string ())
+  method to_html () = a#to_html () ^ " " ^ b#to_html ()
+end;;
+
+(* Output functions on standard output *)
+
+let print_string s =
+  line := !line ^^ fancy_of_string s
+;;
+
+let print_char c =
+  print_string (String.make 1 c)
+;;
+
+(* let print_bytes : bytes -> unit *)
+
+let print_int n =
+  print_string (string_of_int n)
+;;
+
+(* val print_float : float -> unit *)
+
+let print_newline () =
+  if !line <> empty then (
+  Pervasives.print_endline (!line#to_string());
+  if html_enabled then (writeall (concat ["log"; !line#to_html()]));
+  line := empty
+  )
+;;
+
+let print f =
+  line := !line ^^ f
+;;
+
+let print_string_endline f =
+  print (fancy_of_string f); print_newline ()
+;;
+
+let print_endline f =
+  print f; print_newline ()
+;;
+
+let print_hline () =
+  print_newline ();
+  print_endline ( String.make cols '-' / "<hr>")
+;;
+
+let print_heading s =
+  print_newline ();
+  print_endline (("# " ^ s) / ("<h2>" ^ html_escape s ^ "</h2>"))
+;;
+
+let print_bullet f =
+  print_newline ();
+  print_endline (("- " / "<ul><li>") ^^ f ^^ ("" / "</ul>"))
+;;
+
+let print_math s =
+  print_endline ( s / "" );
+  if html_enabled then (writeall (concat ["math"; s]))
+;;
diff --git a/ocaml_new/console.mli b/ocaml_new/console.mli
new file mode 100644 (file)
index 0000000..e3b769b
--- /dev/null
@@ -0,0 +1,24 @@
+type fancyobj\r
+\r
+val fancy_of_string: string -> fancyobj\r
+\r
+val (^^) : fancyobj -> fancyobj -> fancyobj\r
+val (/) : string -> string -> fancyobj\r
+\r
+\r
+val print_char : char -> unit\r
+val print_string : string -> unit\r
+val print_string_endline : string -> unit\r
+(* val print_bytes : bytes -> unit *)\r
+val print_int : int -> unit\r
+(* val print_float : float -> unit *)\r
+\r
+val print : fancyobj -> unit\r
+val print_endline : fancyobj -> unit\r
+\r
+val print_newline : unit -> unit\r
+\r
+val print_hline : unit -> unit\r
+val print_heading : string -> unit\r
+val print_bullet : fancyobj -> unit\r
+val print_math : string -> unit\r
diff --git a/ocaml_new/lambda4.ml b/ocaml_new/lambda4.ml
new file mode 100644 (file)
index 0000000..95dec1f
--- /dev/null
@@ -0,0 +1,566 @@
+open Util
+open Util.Vars
+open Pure
+open Num
+
+(* exceptions *)
+exception Pacman
+exception Bottom
+exception Lambda
+exception Backtrack of string
+
+(* verbosity *)
+let _very_verbose = true;;
+(** Display measure of every term when printing problem *)
+let _measure_of_terms = false;;
+
+let verbose s =
+ if _very_verbose then prerr_endline s
+;;
+
+type problem =
+ { freshno: int
+ ; div: i_var
+ ; conv: i_var list (* the inerts that must converge *)
+ ; sigma: (int * nf) list (* the computed substitution *)
+ ; initialSpecialK: int
+ ; label : string
+ ; var_names : string list (* names of the original free variables *)
+} ;;
+
+let label_of_problem {label} = label;;
+
+let string_of_var l x =
+ try
+  List.nth l x
+ with Failure "nth" -> "`" ^ string_of_int x
+;;
+let string_of_term p t = print ~l:p.var_names (t :> nf);;
+
+
+let first args p var f =
+ let rec aux = function
+ | [] ->
+   raise (Backtrack ("no more alternatives for " ^ string_of_var p.var_names var))
+ | i::is -> try
+    f p i
+   with Backtrack s ->
+prerr_endline (">>>>>> BACKTRACK (reason: " ^ s ^") measure=$ ");
+prerr_endline("Now trying var="^string_of_var p.var_names var^" i="^string_of_int (i+1));
+     aux is
+ in aux args
+
+let all_terms p = p.div :: p.conv ;;
+
+let measure_of_term, measure_of_terms =
+ let rec aux = function
+ | `Bottom | `Pacman -> 0
+ | `Var(_,ar) -> if ar = min_int then 0 else max 0 ar (*assert (ar >= 0); ar*)
+ | `Lam(_,t) -> aux t
+ | `I(v,args) -> aux (`Var v) + aux_many (Listx.to_list args :> nf list)
+ and aux_many tms = List.fold_right ((+) ++ aux) tms 0 in
+ (fun t -> aux (t :> nf)), (fun l -> aux_many (l :> nf list))
+;;
+
+let sum_arities p = measure_of_terms (all_terms p)
+
+let problem_measure p = sum_arities p;;
+let string_of_measure = string_of_int;;
+
+let string_of_problem label ({freshno; div; conv} as p) =
+ let aux_measure_terms t = if _measure_of_terms then "(" ^ string_of_int (measure_of_term t) ^ ") " else "" in
+ let l = p.var_names in
+ String.concat "\n" ([
+  "";
+  "# DISPLAY PROBLEM (" ^ label ^ ") " ^ "measure=" ^ string_of_measure (problem_measure p);
+  "#";
+  "$" ^ p.label;
+  "D " ^ aux_measure_terms div ^ print ~l (div :> nf);
+  ]
+  @ List.map (fun t -> "C " ^ aux_measure_terms t ^ print ~l (t :> nf)) conv
+  @ [""])
+;;
+
+
+let failwithProblem p reason =
+ print_endline (string_of_problem "FAIL" p);
+ failwith reason
+;;
+
+let make_fresh_var p arity =
+ let freshno = p.freshno + 1 in
+ {p with freshno}, `Var(freshno,arity)
+;;
+
+let make_fresh_vars p arities =
+ List.fold_right
+  (fun arity (p, vars) -> let p, var = make_fresh_var p arity in p, var::vars)
+  arities
+  (p, [])
+;;
+
+
+let fixpoint f =
+ let rec aux x = let x' = f x in if x <> x' then aux x' else x in aux
+;;
+
+
+let subst_in_problem x inst ({div; conv} as p) =
+prerr_endline ("# INST0: " ^ string_of_var p.var_names x ^ " := " ^ string_of_term p inst);
+ let aux t = match t with
+ | #i_var as t -> t
+ | `Lam _ | `Bottom | `Pacman -> assert false (* ??? *) in
+ let div = (aux ++ (subst false false x inst)) (div :> nf) in
+ let conv = List.map (subst false false x inst) (conv :> nf list) in
+ let conv = List.filter (function `Lam _ -> false | _ -> true) conv in
+ let conv = List.map aux conv in
+ {p with div; conv}
+;;
+
+exception Dangerous;;
+
+let arity_of arities hd =
+ let pos,_,nargs = List.find (fun (_,hd',_) -> hd=hd') arities in
+ nargs + if pos = -1 then - 1 else 0
+;;
+
+(* let rec dangerous arities showstoppers =
+ function
+    `N _
+  | `Var _
+  | `Lam _
+  | `Pacman -> ()
+  | `Match(t,_,liftno,bs,args) ->
+      (* CSC: XXX partial dependency on the encoding *)
+      (match t with
+          `N _ -> List.iter (dangerous arities showstoppers) args
+        | `Match _ as t -> dangerous arities showstoppers t ; List.iter (dangerous arities showstoppers) args
+        | `Var(x,_) -> dangerous_inert arities showstoppers x args 2
+        | `I((x,_),args') -> dangerous_inert arities showstoppers x (Listx.to_list args' @ args) 2
+      )
+  | `I((k,_),args) -> dangerous_inert arities showstoppers k (Listx.to_list args) 0
+
+and dangerous_inert arities showstoppers k args more_args =
+ List.iter (dangerous arities showstoppers) args ;
+ if List.mem k showstoppers then raise Dangerous else
+ try
+  let arity = arity_of arities k in
+  if List.length args + more_args > arity then raise Dangerous else ()
+ with
+  Not_found -> ()
+
+(* cut & paste from above *)
+let rec dangerous_conv p arities showstoppers =
+ function
+  | `N _
+  | `Var _
+  | `Lam _
+  | `Pacman -> ()
+  | `Match(t,_,liftno,bs,args) -> (
+      (* CSC: XXX partial dependency on the encoding *)
+       try (match t with
+        | `N _ -> List.iter (dangerous_conv p arities showstoppers) args
+        | `Match _ as t -> dangerous_conv p arities showstoppers t; List.iter (dangerous_conv p arities showstoppers) args
+        | `Var(x,_) -> dangerous_inert_conv p arities showstoppers x [] args 2
+        | `I((x,_),args') -> dangerous_inert_conv p arities showstoppers x (Listx.to_list args') args 2
+        ) with TriggerMatchReduction x -> (
+           match Util.find_opt (fun (n, t) -> if hd_of (List.nth p.ps n) = Some x then Some t else None) !bs with
+            | None -> ()
+            | Some t -> (
+               match t with
+                | `Bottom -> raise Dangerous
+                | #nf_nob as t -> dangerous_conv p arities showstoppers t
+               )
+           )
+       )
+  | `I((k,_),args) -> dangerous_inert_conv p arities showstoppers k (Listx.to_list args) [] 0
+
+and dangerous_inert_conv p arities showstoppers k args match_args more_args =
+ let all_args = args @ match_args in
+ List.iter (dangerous_conv p arities showstoppers) all_args;
+ let all_args = (all_args :> nf list) in
+ if List.mem k showstoppers then raise Dangerous else
+  try
+   let arity = arity_of arities k in
+prerr_endline ("dangerous_inert_conv: ar=" ^ string_of_int arity ^ " k="^string_of_var p.var_names k ^ " listlenargs=" ^ (string_of_int (List.length args)) ^ " more_args=" ^ string_of_int more_args);
+   if more_args > 0 (* match argument*) && List.length args = arity then raise (TriggerMatchReduction k)
+    else if List.length all_args + more_args > arity then raise Dangerous else ()
+  with
+   Not_found -> ()
+
+(* inefficient algorithm *)
+let rec edible p arities showstoppers =
+ let rec aux f showstoppers tms = function
+   | [] -> showstoppers
+   | x::xs when List.exists (fun y -> hd_of x = Some y) showstoppers ->
+      (* se la testa di x e' uno show-stopper *)
+      let new_showstoppers = sort_uniq (showstoppers @ free_vars (x :> nf)) in
+      (* aggiungi tutte le variabili libere di x *)
+      if List.length showstoppers <> List.length new_showstoppers then
+       aux f new_showstoppers tms tms
+      else
+       aux f showstoppers tms xs
+   | x::xs ->
+      match hd_of x with
+         None -> aux f showstoppers tms xs
+       | Some h ->
+          try
+           f showstoppers (x :> nf_nob) ;
+           aux f showstoppers tms xs
+          with
+           Dangerous ->
+            aux f (sort_uniq (h::showstoppers)) tms tms
+  in
+   let showstoppers = sort_uniq (aux (dangerous arities) showstoppers p.ps p.ps) in
+   let dangerous_conv = sort_uniq (aux (dangerous_conv p arities) showstoppers p.conv p.conv) in
+
+(* prerr_endline ("dangerous_conv lenght:" ^ string_of_int (List.length dangerous_conv));
+List.iter (fun l -> prerr_endline (String.concat " " (List.map (string_of_var p.var_names) l))) dangerous_conv; *)
+
+    let showstoppers' = showstoppers @ dangerous_conv in
+    let showstoppers' = sort_uniq (match p.div with
+     | None -> showstoppers'
+     | Some div ->
+       if List.exists ((=) (hd_of_i_var div)) showstoppers'
+       then showstoppers' @ free_vars (div :> nf) else showstoppers') in
+    if showstoppers <> showstoppers' then edible p arities showstoppers' else showstoppers', dangerous_conv
+;;
+
+let precompute_edible_data {ps; div} xs =
+ let aux t = match t with `Var _ -> 0 | `I(_, args) -> Listx.length args | `N _ -> assert false in
+ (fun l -> match div with
+  | None -> l
+  | Some div -> (-1, hd_of_i_var div, aux div) :: l)
+  (List.map (fun hd ->
+   let i, tm = Util.findi (fun y -> hd_of y = Some hd) ps in
+    i, hd, aux tm
+   ) xs)
+;;
+
+(** Returns (p, showstoppers_step, showstoppers_eat) where:
+    - showstoppers_step are the heads occurring twice
+      in the same discriminating set
+    - showstoppers_eat are the heads in ps having different number
+      of arguments *)
+let critical_showstoppers p =
+  let p = super_simplify p in
+  let hd_of_div = match p.div with None -> [] | Some t -> [hd_of_i_var t] in
+  let showstoppers_step =
+  concat_map (fun bs ->
+    let heads = List.map (fun (i,_) -> List.nth p.ps i) !bs in
+    let heads = List.sort compare (hd_of_div @ filter_map hd_of heads) in
+    snd (split_duplicates heads)
+    ) p.deltas @
+     if List.exists (fun t -> [hd_of t] = List.map (fun x -> Some x) hd_of_div) p.conv
+     then hd_of_div else [] in
+  let showstoppers_step = sort_uniq showstoppers_step in
+  let showstoppers_eat =
+   let heads_and_arities =
+    List.sort (fun (k,_) (h,_) -> compare k h)
+     (filter_map (function `Var(k,_) -> Some (k,0) | `I((k,_),args) -> Some (k,Listx.length args) | _ -> None ) p.ps) in
+   let rec multiple_arities =
+    function
+       []
+     | [_] -> []
+     | (x,i)::(y,j)::tl when x = y && i <> j ->
+         x::multiple_arities tl
+     | _::tl -> multiple_arities tl in
+   multiple_arities heads_and_arities in
+
+  let showstoppers_eat = sort_uniq showstoppers_eat in
+  let showstoppers_eat = List.filter
+    (fun x -> not (List.mem x showstoppers_step))
+    showstoppers_eat in
+  List.iter (fun v -> prerr_endline ("DANGEROUS STEP: " ^ (string_of_var p.var_names) v)) showstoppers_step;
+  List.iter (fun v -> prerr_endline ("DANGEROUS EAT: " ^ (string_of_var p.var_names) v)) showstoppers_eat;
+  p, showstoppers_step, showstoppers_eat
+  ;;
+
+let eat p =
+  let ({ps} as p), showstoppers_step, showstoppers_eat = critical_showstoppers p in
+  let showstoppers = showstoppers_step @ showstoppers_eat in
+  let heads = List.sort compare (filter_map hd_of ps) in
+  let arities = precompute_edible_data p (uniq heads) in
+  let inedible, showstoppers_conv = edible p arities showstoppers in
+  let l = List.filter (fun (_,hd,_) -> not (List.mem hd inedible)) arities in
+  let p =
+  List.fold_left (fun p (pos,hd,nargs) -> if pos = -1 then p else
+   let v = `N pos in
+   let inst = make_lams v nargs in
+prerr_endline ("# [INST_IN_EAT] eating: " ^ string_of_var p.var_names hd ^ " := " ^ string_of_term p inst);
+   { p with sigma = p.sigma @ [hd,inst] }
+   ) p l in
+  (* to avoid applied numbers in safe positions that
+     trigger assert failures subst_in_problem x inst p*)
+ let ps =
+  List.map (fun t ->
+   try
+    let j,_,_ = List.find (fun (_,hd,_) -> hd_of t = Some hd) l in
+    `N j
+   with Not_found -> t
+  ) ps in
+ let p = match p.div with
+  | None -> p
+  | Some div ->
+   if List.mem (hd_of_i_var div) inedible
+   then p
+   else
+    let n = match div with `I(_,args) -> Listx.length args | `Var _ -> 0 in
+    let x = hd_of_i_var div in
+    let inst = make_lams `Bottom n in
+    subst_in_problem x inst p in
+(*let dangerous_conv = showstoppers_conv in
+prerr_endline ("dangerous_conv lenght:" ^ string_of_int (List.length dangerous_conv));
+List.iter (fun l -> prerr_endline (String.concat " " (List.map (string_of_var p.var_names) l))) dangerous_conv; *)
+ let conv =
+   List.map (function t ->
+    try
+     if let hd = hd_of t in hd <> None && not (List.mem (Util.option_get hd) showstoppers_conv) then t else (
+     (match t with | `Var _ -> raise Not_found | _ -> ());
+     let _ = List.find (fun h -> hd_of t = Some h) inedible in
+      t)
+    with Not_found -> match hd_of t with
+     | None -> assert (t = convergent_dummy); t
+     | Some h ->
+      prerr_endline ("FREEZING " ^ string_of_var p.var_names h);
+      convergent_dummy
+   ) p.conv in
+ List.iter
+  (fun bs ->
+    bs :=
+     List.map
+      (fun (n,t as res) ->
+        match List.nth ps n with
+           `N m -> m,t
+         | _ -> res
+      ) !bs
+  ) p.deltas ;
+ let old_conv = p.conv in
+ let p = { p with ps; conv } in
+ if l <> [] || old_conv <> conv
+  then prerr_endline (string_of_problem "eat" p);
+ if List.for_all (function `N _ -> true | _ -> false) ps && p.div = None then
+  `Finished p
+ else
+  `Continue p
+
+
+let safe_arity_of_var p x =
+ (* Compute the minimum number of arguments when x is in head
+    position at p.div or p.ps *)
+ let aux = function
+ | `Var(y,_) -> if x = y then 0 else max_int
+ | `I((y,_),args) -> if x = y then Listx.length args else max_int
+ | _ -> max_int in
+ let tms = ((match p.div with None -> [] | Some t -> [(t :> i_n_var)]) @ p.ps) in
+ List.fold_left (fun acc t -> Pervasives.min acc (aux t)) max_int tms
+;; *)
+
+let instantiate p x perm =
+ let n = (prerr_endline ("WARNING: using constant initialSpecialK=" ^ string_of_int p.initialSpecialK)); p.initialSpecialK in
+ let arities = Array.to_list (Array.make (n+1) min_int) in
+ let p,vars = make_fresh_vars p arities in
+ (* manual lifting of vars by perm in next line *)
+ let vars = List.map (function `Var (n,ar) -> `Var (n+perm,ar)) vars in
+ (* other_vars are the variables which are delayed and re-applied to the match *)
+ let other_vars = Array.mapi (fun n () -> `Var(n+1,min_int)) (Array.make (perm-1) ()) in
+ let other_vars = Array.to_list other_vars in
+ (* 666, since it will be replaced anyway during subst: *)
+ (* let inst = `Match(`I((0,min_int),args),(x,-666),perm,bs,other_vars) in *)
+ let inst = `I((0,min_int),Listx.from_list (vars @ other_vars)) in (* FIXME *)
+ (* Add a number of 'perm' leading lambdas *)
+ let inst = Array.fold_left (fun t () -> `Lam(false, t)) inst (Array.make perm ()) in
+ let p = {p with sigma=(x,inst)::p.sigma} in
+ subst_in_problem x inst p
+;;
+
+let compute_special_k tms =
+ let rec aux k (t: nf) = Pervasives.max k (match t with
+ | `Lam(b,t) -> aux (k + if b then 1 else 0) t
+ | `I(n, tms) -> Listx.max (Listx.map (aux 0) (tms :> nf Listx.listx))
+ | `Bottom
+ | `Pacman
+ | `Var _ -> 0
+ ) in
+ let rec aux' top t = match t with
+ | `Lam(_,t) -> aux' false t
+ | `I((_,ar), tms) -> max ar
+     (Listx.max (Listx.map (aux' false) (tms :> nf Listx.listx)))
+ | `Bottom
+ | `Pacman
+ | `Var _ -> 0 in
+ Listx.max (Listx.map (aux 0) tms) + Listx.max (Listx.map (aux' true) tms)
+;;
+
+(* let choose_step p =
+ let p, showstoppers_step, showstoppers_eat = critical_showstoppers p in
+ let x =
+  match showstoppers_step, showstoppers_eat with
+  | [], y::_ ->
+     prerr_endline ("INSTANTIATING (critical eat) : " ^ string_of_var p.var_names y); y
+  | x::_, _ ->
+     prerr_endline ("INSTANTIATING (critical step): " ^ string_of_var p.var_names x); x
+  | [], [] ->
+     let heads =
+      (* Choose only variables still alive (with arity > 0) *)
+      List.sort compare (filter_map (
+       fun t -> match t with `Var _ -> None | x -> if arity_of_hd x <= 0 then None else hd_of x
+      ) ((match p.div with Some t -> [(t :> i_n_var)] | _ -> []) @ p.ps)) in
+     (match heads with
+      | [] ->
+         (try
+           fst (List.find (((<) 0) ++ snd) (concat_map free_vars' (p.conv :> nf list)))
+          with
+           Not_found -> assert false)
+      | x::_ ->
+         prerr_endline ("INSTANTIATING TO EAT " ^ string_of_var p.var_names x);
+         x) in
+ let arity_of_x = Util.option_get (max_arity_tms x (all_terms p)) in
+ let safe_arity_of_x = safe_arity_of_var p x in
+ x, min arity_of_x safe_arity_of_x
+;; *)
+
+let intersect l1 l2 =
+ let rec aux n l1 l2 = match l1, l2 with
+ | [], _ -> []
+ | _, [] -> assert false
+ | x::xs, y::ys -> if x <> y then n :: aux (n+1) xs ys else aux (n+1) xs ys
+ in aux 1 (Listx.to_list l1) (Listx.to_list l2);;
+
+exception Difference of int list;;
+let eat p =
+ let hd, args, n = match p.div with `Var _ -> assert false | `I((x,_), l) -> x, l, Listx.length l in
+ let rec aux = function
+ | `Var _ | `Lam _ -> ()
+ | `Pacman | `Bottom -> assert false
+ | `I((x,_),args') ->
+     if x = hd then
+      if Listx.length args' >= n then
+       (let diff = intersect args args' in
+       if diff <> [] then raise (Difference diff));
+     List.iter aux ((Listx.to_list args') :> nf list) in
+ try
+  List.iter aux (p.conv :> nf list) ;
+  `Finished {p with sigma=(hd,make_lams `Bottom n)::p.sigma}
+ with
+  Difference l -> `Continue (hd, l)
+;;
+
+let rec auto_eat p =
+ prerr_endline (string_of_problem "auto_eat" p);
+ prerr_endline "{{{{{{{{ Computing measure before auto_instantiate }}}}}}";
+ match eat p with
+ | `Finished p -> prerr_endline "finished"; p
+ | `Continue (x,positions) ->
+ let m = problem_measure p in
+ first positions p x (fun p j ->
+  let p = instantiate p x j in
+  prerr_endline "{{{{{{{{ Computing measure inafter auto_instantiate }}}}}}";
+  let delta = problem_measure p - m in
+  if delta >= 0
+   then
+    (prerr_endline
+    ("Measure did not decrease (+=" ^ string_of_int delta ^ ")"))
+   else prerr_endline ("$ Measure decreased: " ^ string_of_int delta);
+   auto_eat p)
+;;
+
+(******************************************************************************)
+let env_of_sigma freshno sigma =
+ let rec aux n =
+  if n > freshno then
+   []
+  else
+   let e = aux (n+1) in
+   (try
+    e,Pure.lift (-n-1) (snd (List.find (fun (i,_) -> i = n) sigma)),[]
+   with
+    Not_found -> ([],Pure.V n,[]))::e
+ in aux 0
+;;
+(* ************************************************************************** *)
+
+type response = [
+ | `CompleteSeparable of string
+ | `CompleteUnseparable of string
+ | `Uncomplete
+]
+
+type result = [
+ `Complete | `Uncomplete
+] * [
+ | `Separable of (int * Num.nf) list
+ | `Unseparable of string
+]
+
+
+let run p =
+ Console.print_hline();
+ prerr_endline (string_of_problem "main" p);
+ let p_finale = auto_eat p in
+ let freshno,sigma = p_finale.freshno, p_finale.sigma in
+ prerr_endline ("------- <DONE> ------ measure=. \n ");
+ List.iter (fun (x,inst) -> prerr_endline (string_of_var p_finale.var_names x ^ " := " ^ string_of_term p_finale inst)) sigma;
+
+ prerr_endline "---------<PURE>---------";
+ let scott_of_nf t = ToScott.scott_of_nf (t :> nf) in
+ let div = scott_of_nf p.div in
+ let conv = List.map scott_of_nf p.conv in
+
+ let sigma' = List.map (fun (x,inst) -> x, ToScott.scott_of_nf inst) sigma in
+ let e' = env_of_sigma freshno sigma' in
+
+ prerr_endline "--------<REDUCE>---------";
+ (* print_endline (Pure.print div); *)
+ let t = Pure.mwhd (e',div,[]) in
+ prerr_endline ("*:: " ^ (Pure.print t));
+ assert (t = Pure.B);
+ List.iter (fun n ->
+   (* verbose ("_::: " ^ (Pure.print n)); *)
+   let t = Pure.mwhd (e',n,[]) in
+   verbose ("_:: " ^ (Pure.print t));
+   assert (t <> Pure.B)
+ ) conv ;
+ prerr_endline "-------- </DONE> --------";
+ p_finale.sigma
+;;
+
+let solve (p, todo) =
+ let completeness, to_run =
+  match todo with
+   | `CompleteUnseparable s -> `Complete, `False s
+   | `CompleteSeparable _ -> `Complete, `True
+   | `Uncomplete -> `Uncomplete, `True in
+ completeness, match to_run with
+  | `False s -> `Unseparable s
+  | `True ->
+      try
+       `Separable (run p)
+      with
+       Backtrack _ -> `Unseparable "backtrack"
+;;
+
+let no_bombs_pacmans p =
+    not (List.exists (eta_subterm `Bottom) p.conv)
+ && not (eta_subterm `Pacman p.div)
+;;
+
+let check p =
+ if not (List.exists (eta_subterm p.div) p.conv) && no_bombs_pacmans p
+  then `CompleteSeparable "no bombs, pacmans and div"
+  (* il check seguente e' spostato nel parser e lancia un ParsingError *)
+ (* else if false (* TODO bombs or div fuori da lambda in ps@conv *)
+  then `CompleteUnseparable "bombs or div fuori da lambda in ps@conv" *)
+ else `Uncomplete
+;;
+
+let problem_of (label, div, conv, var_names) =
+ (* TODO: replace div with bottom in problem??? *)
+ let all_tms = div :: conv in
+ if all_tms = [] then failwith "problem_of: empty problem";
+ let initialSpecialK = compute_special_k (Listx.from_list (all_tms :> nf list)) in
+ let freshno = List.length var_names in
+ let sigma = [] in
+ let p = {freshno; div; conv; sigma; initialSpecialK; var_names; label} in
+ p, check p
+;;
diff --git a/ocaml_new/lambda4.mli b/ocaml_new/lambda4.mli
new file mode 100644 (file)
index 0000000..8e5d78c
--- /dev/null
@@ -0,0 +1,22 @@
+type problem\r
+\r
+val label_of_problem : problem -> string\r
+\r
+type response = [\r
+ | `CompleteSeparable of string\r
+ | `CompleteUnseparable of string\r
+ | `Uncomplete\r
+]\r
+\r
+type result = [\r
+ `Complete | `Uncomplete\r
+] * [\r
+ | `Separable of (int * Num.nf) list\r
+ | `Unseparable of string\r
+]\r
+\r
+val problem_of: (string (* problem label *)\r
+* Num.i_var (* div *)\r
+* Num.i_var list (* conv *)\r
+* string list (* names of free variables *)) -> problem * response\r
+val solve: problem * response -> result\r
diff --git a/ocaml_new/listx.ml b/ocaml_new/listx.ml
new file mode 100644 (file)
index 0000000..821e281
--- /dev/null
@@ -0,0 +1,71 @@
+(* Non-empty lists *)
+type 'a listx =
+  | Nil of 'a
+  | Cons of ('a * 'a listx)
+
+let rec fold_left f acc l =
+  match l with
+  | Nil x -> f acc x
+  | Cons (x, l') -> fold_left f (f acc x) l'
+
+let hd =
+ function
+  | Nil x
+  | Cons (x,_) -> x
+
+let rec map f =
+  function
+  | Nil x -> Nil (f x)
+  | Cons (x, l') -> Cons (f x, map f l')
+
+let rec append l =
+  function
+  | Nil x -> Cons (x, l)
+  | Cons (x, l') -> Cons (x, append l l')
+
+let rec length = function
+  | Nil _ -> 1
+  | Cons (_, xs) -> 1 + (length xs)
+
+let rec assoc x = function
+  | Nil (y,t)
+  | Cons ((y,t),_) when x=y -> t
+  | Nil _ -> raise Not_found
+  | Cons (_,l) -> assoc x l
+
+let rec to_list =
+ function
+    Nil x -> [x]
+  | Cons (x,l) -> x::to_list l
+
+let rec from_list =
+ function
+    [] -> raise (Failure "from_list: empty list")
+  | [x] -> Nil x
+  | x::l -> Cons(x,from_list l)
+
+let rec split_nth n l =
+ match n,l with
+    0,_ -> []
+ | 1,Nil x -> [x]
+ | n,Cons (hd,tl) -> hd::split_nth (n-1) tl
+ | _,_ -> raise (Failure "split_nth: not enough args")
+
+let rec max =
+  function
+  | Nil x -> x
+  | Cons (x, l) -> Pervasives.max x (max l)
+
+let rec last =
+  function
+  | Nil x -> x
+  | Cons (_, l) -> last l
+(*
+let rec nth i l = match l, i with
+ | Cons (x, _), 1  -> x
+ | _, n when n <= 0 -> raise (Invalid_argument "Listx.nth")
+ | Cons (_, xs), n -> nth (n-1) xs
+ | Nil x, 1        -> x
+ | Nil _, _        -> raise (Invalid_argument "Listx.nth")
+;;
+*)
diff --git a/ocaml_new/listx.mli b/ocaml_new/listx.mli
new file mode 100644 (file)
index 0000000..a43bc4e
--- /dev/null
@@ -0,0 +1,12 @@
+type 'a listx = Nil of 'a | Cons of ('a * 'a listx)
+val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b listx -> 'a
+val hd : 'a listx -> 'a
+val map : ('a -> 'b) -> 'a listx -> 'b listx
+val append : 'a listx -> 'a listx -> 'a listx
+val length : 'a listx -> int
+val assoc : 'a -> ('a * 'b) listx -> 'b
+val to_list : 'a listx -> 'a list
+val from_list : 'a list -> 'a listx
+val split_nth : int -> 'a listx -> 'a list
+val max : 'a listx -> 'a
+val last : 'a listx -> 'a
diff --git a/ocaml_new/num.ml b/ocaml_new/num.ml
new file mode 100644 (file)
index 0000000..f6b9405
--- /dev/null
@@ -0,0 +1,265 @@
+open Util
+open Util.Vars
+open Pure
+
+(* debug options *)
+let debug_display_arities = false;;
+
+(************ Syntax ************************************)
+
+(* Normal forms*)
+
+(* Var n = n-th De Bruijn index, 0-based *)
+
+(*type nf =
+  | Lam of nf
+  | Var of int
+  | i
+and i =
+  | I of int * nf listx
+;;*)
+type var = int * (* arity of variable*) int;;
+type 'nf_nob i_var_ = [ `I of var * 'nf_nob Listx.listx | `Var of var ]
+type 'nf nf_nob_ = [ `Lam of (* was_unpacked *) bool * 'nf | `Pacman | ('nf nf_nob_) i_var_ ]
+type nf = [ nf nf_nob_ | `Bottom  ]
+type nf_nob = nf nf_nob_
+type i_var = nf_nob i_var_;;
+
+let hd_of_i_var =
+ function
+   `I ((v,_),_)
+ | `Var (v,_) -> v
+
+let hd_of =
+ function
+   `I ((v,_),_)
+ | `Var(v,_) -> v
+
+let arity_of_hd =
+function
+  `I ((_,a),_)
+| `Var(_,a) -> a
+| _ -> 0 (* FIXME? *)
+
+let lift m (t : nf) =
+ let aux_var l (n, ar) = (if n < l then n else n+m), ar in
+ let rec aux_i_num_var l =
+  function
+    `I(v,args) -> `I(aux_var l v, Listx.map (aux_nob l) args)
+   | `Var v -> `Var(aux_var l v)
+ and aux_nob l =
+  function
+     #i_var as x -> (aux_i_num_var l x :> nf_nob)
+   | `Lam(b,nf) -> `Lam (b, aux (l+1) nf)
+   | `Pacman -> `Pacman
+ and aux l =
+  function
+     #nf_nob as x -> (aux_nob l x :> nf)
+   | `Bottom -> `Bottom
+ in
+  (aux 0 t : nf)
+;;
+
+(* put t under n lambdas, lifting t accordingtly *)
+let rec make_lams t =
+ function
+   0 -> t
+ | n when n > 0 -> `Lam (false, lift 1 (make_lams t (n-1)))
+ | _ -> assert false
+
+let free_vars' =
+ let rec aux n = function
+  | `Var(x,ar) -> if x < n then [] else [(x-n,ar)]
+  | `I((x,ar),args) ->
+      (if x < n then [] else [(x-n,ar)]) @
+      List.concat (List.map (aux n) (Listx.to_list args :> nf list))
+  | `Lam(_,t) -> aux (n+1) t
+  | `Bottom | `Pacman -> []
+  in aux 0
+;;
+let free_vars = (List.map fst) ++ free_vars';;
+
+module ToScott =
+struct
+
+let rec scott_of_nf = function
+ | `Var(v,_) -> Pure.V v
+ | `I((v,_), args) -> Listx.fold_left (fun acc t -> Pure.A(acc,scott_of_nf t)) (Pure.V v) (args :> nf Listx.listx)
+ | `Lam(_,t) -> Pure.L (scott_of_nf t)
+ | `Bottom -> Pure.B
+ | `Pacman -> let f x = Pure.A (x,x) in f (Pure.L (Pure.L (f (Pure.V 0))))
+end
+
+
+(************ Pretty-printing ************************************)
+
+(* let rec string_of_term l  = fun _ -> "";; *)
+
+let rec string_of_term =
+ let boundvar x = "v" ^ string_of_int x in
+ let varname lev l n =
+  if n < lev then boundvar (lev-n-1)
+   else if n < List.length l then List.nth l (n-lev)
+    else "`" ^ string_of_int (n-lev) in
+ let rec string_of_term_w_pars lev l  = function
+  | `Var(n,ar) -> varname lev l n ^ (if debug_display_arities then ":" ^ string_of_int ar else "")
+  | `I _ as t -> "(" ^ string_of_term_no_pars_app lev l t ^ ")"
+  | `Lam(_,`Bottom) -> "BOMB"
+  | `Lam _ as t -> "(" ^ string_of_term_no_pars_lam lev l t ^ ")"
+  | `Bottom -> "BOT"
+  | `Pacman -> "PAC"
+ and string_of_term_no_pars_app lev l  = function
+  | `I((n,ar), args) -> varname lev l n ^ (if debug_display_arities then ":" ^ string_of_int ar else "") ^ " " ^ String.concat " " (List.map (string_of_term_w_pars lev l) (Listx.to_list args :> nf list))
+  | #nf as t -> string_of_term_w_pars lev l t
+ and string_of_term_no_pars_lam lev l  = function
+  | `Lam(_,`Bottom) -> "BOMB"
+  | `Lam(_,t) -> "λ" ^ boundvar lev ^ ". " ^ (string_of_term_no_pars_lam (lev+1) l t)
+  | _ as t -> string_of_term_no_pars lev l t
+ and string_of_term_no_pars lev l = function
+  | `Lam _ as t -> string_of_term_no_pars_lam lev l t
+  | #nf as t -> string_of_term_no_pars_app lev l t
+ in string_of_term_no_pars 0
+;;
+
+let print ?(l=[]) = string_of_term l;;
+let string_of_nf t = string_of_term [] (t :> nf);;
+
+(************ Hereditary substitutions ************************************)
+
+let cast_to_i_var =
+ function
+    #i_var as y -> (y : i_var)
+  | t ->
+    prerr_endline (print (t :> nf));
+    assert false (* algorithm failed *)
+
+
+let rec set_arity arity = function
+(* FIXME because onlt variables should be in branches of matches, one day *)
+| `Var(n,_) -> `Var(n,arity)
+| `Bottom | `Pacman as t -> (t : nf)
+| `Lam(false, t) -> `Lam(false, set_arity arity (t :> nf))
+| `I _ | `Lam _ -> assert false
+
+let minus1 n = if n = min_int then n else n - 1;;
+
+let rec mk_app (h : nf) (arg : nf) =
+ match arg with
+  | `Bottom -> `Bottom
+  | #nf_nob as arg ->
+    match h with
+     | `I(v,args) -> `I(v,Listx.append (Listx.Nil arg) args)
+     | `Var v -> `I(v, Listx.Nil arg)
+     | `Lam(truelam,nf) -> subst truelam true 0 arg (nf : nf) (* AC FIXME sanity check on arity *)
+     | `Bottom | `Pacman as t -> t
+(*in let l = ["v0";"v1";"v2"] in
+prerr_endline ("mk_app h:" ^ print ~l h ^ " arg:" ^ print ~l:l arg ^ " res:" ^ print ~l:l res); res*)
+
+and mk_appl h args =
+ (*prerr_endline ("MK_APPL: " ^ print h ^ " " ^ String.concat " " (List.map print args));*)
+ List.fold_left mk_app h args
+
+and mk_appx h args = Listx.fold_left mk_app h args
+
+
+and subst truelam delift_by_one what (with_what : nf(*_nob*)) (where : nf) =
+ let rec aux_propagate_arity ar = function
+ | `Lam(false, t) when not delift_by_one -> `Lam(false, aux_propagate_arity ar t)
+ | `Var(i,oldar) -> `Var(i, if truelam then (assert (oldar = min_int); ar) else oldar)
+ | _ as t -> t in
+ let rec aux_i_var l =
+  function
+     `I((n,ar),args) ->
+       if n = what + l then
+       let args = Listx.map (aux l) (args :> nf Listx.listx) in
+        mk_appx (lift l (aux_propagate_arity ar (with_what :> nf))) args
+       else
+        mk_appl (`Var ((if delift_by_one && n >= l then n-1 else n), ar)) (List.map (aux l) (Listx.to_list (args :> nf Listx.listx)))
+   | `Var(n,ar) ->
+       if n = what + l then
+        lift l (aux_propagate_arity ar (with_what :> nf))
+       else
+        `Var((if delift_by_one && n >= l then n-1 else n), ar)
+ and aux l(*lift*) =
+(*function iii -> let res = match iii with*)
+  function
+   | #i_var as x -> aux_i_var l x
+   | `Lam(b, nf) -> `Lam(b, aux (l+1) nf)
+   | `Bottom -> `Bottom
+   | `Pacman -> `Pacman
+(*in let ll = ["v0";"v1";"v2"] in
+prerr_endline ("subst l:" ^ string_of_int l ^ " delift_by_one:" ^ string_of_bool delift_by_one ^ " what:" ^ (List.nth ll what) ^ " with_what:" ^ print ~l:ll with_what ^ " where:" ^ print ~l:ll iii ^ " res:" ^ print ~l:ll res); res*)
+ in
+  aux 0 where
+;;
+
+(************ Parsing ************************************)
+
+(************** Algorithm(s) ************************)
+
+let eta_compare x y =
+ (* let clex a b = let diff = ? a b in if diff = 0 then cont () else 0 in *)
+ let clex aux1 aux2 (a1,a2) (b1,b2) =
+  let diff = aux1 a1 b1 in if diff = 0 then aux2 a2 b2 else diff in
+ let rec lex aux l1 l2 =
+  match l1,l2 with
+ | [], [] -> 0
+ | [], _ -> -1
+ | _, [] -> 1
+ | x::xs, y::ys -> clex aux (lex aux) (x,xs) (y,ys) in
+ let rec aux t1 t2 = match t1, t2 with
+  | `Var(n,_) , `Var(m,_) -> compare n m
+  | `I((n1,_), l1), `I((n2,_), l2) ->
+    clex compare (lex aux) (n1, (Listx.to_list l1 :> nf list)) (n2, (Listx.to_list l2 :> nf list))
+  | `Bottom, `Bottom
+  | `Pacman, `Pacman -> 0
+  | `Bottom, `Lam(_,t) -> -1
+  | `Lam(_,t), `Bottom ->  1
+  | `Lam(_,t1), `Lam(_,t2) -> aux t1 t2
+  | `Lam(_,t1), t2 -> - aux t1 (mk_app (lift 1 t2) (`Var(0,-666)))
+  | t2, `Lam(_,t1) ->   aux t1 (mk_app (lift 1 t2) (`Var(0,-666)))
+  | `I _, _ -> -1
+  | _, `I _ -> 1
+  | `Bottom, _ -> -1
+  | _, `Bottom -> 1
+  | `Pacman, _ -> -1
+  | _, `Pacman -> 1
+  in aux x y
+;;
+
+let eta_eq (#nf as x) (#nf as y) = 0 = eta_compare x y ;;
+
+let rec eta_subterm sub t =
+ if eta_eq sub t then true else
+  match t with
+  | `Lam(_,t') -> eta_subterm (lift 1 sub) t'
+  | `Bottom
+  | `Pacman  -> false
+  | `I((v,_), args) -> List.exists (eta_subterm sub) ((Listx.to_list args) :> nf list) || (match sub with
+   | `Var(v',_) -> v = v'
+   | `I((v',_), args') -> v = v'
+    && Listx.length args' < Listx.length args
+    && List.for_all (fun (x,y) -> eta_eq x y) (List.combine (Util.take (Listx.length args') (Listx.to_list args :> nf list)) (Listx.to_list args' :> nf list))
+   | _ -> false
+   )
+  | `Var _ -> false
+;;
+
+let eta_subterm (#nf as x) (#nf as y) = eta_subterm x y;;
+
+let max_arity_tms n =
+ let max a b = match a, b with
+  | None, None -> None
+  | None, Some x
+  | Some x, None -> Some x
+  | Some x, Some y -> Some (Pervasives.max x y) in
+ let aux_var l (m,a) = if n + l = m then Some a else None in
+ let rec aux l = function
+  | `Var v -> aux_var l v
+  | `I(v,tms) -> max (aux_var l v) (aux_tms l (Listx.to_list tms :> nf list))
+  | `Lam(_,t) -> aux (l+1) t
+  | `Bottom | `Pacman -> None
+ and aux_tms l =
+  List.fold_left (fun acc t -> max acc (aux l t)) None in
+ fun tms -> aux_tms 0 (tms :> nf list)
+;;
diff --git a/ocaml_new/num.mli b/ocaml_new/num.mli
new file mode 100644 (file)
index 0000000..8b0bab4
--- /dev/null
@@ -0,0 +1,38 @@
+val debug_display_arities : bool
+type var = int * int
+type 'nf_nob i_var_ = [ `I of var * 'nf_nob Listx.listx | `Var of var ]
+type 'nf nf_nob_ =
+    [ `I of var * 'nf nf_nob_ Listx.listx
+    | `Lam of bool * 'nf
+    | `Pacman
+    | `Var of var ]
+type nf =
+    [ `Bottom
+    | `I of var * nf nf_nob_ Listx.listx
+    | `Lam of bool * nf
+    | `Pacman
+    | `Var of var ]
+type nf_nob = nf nf_nob_
+type i_var = nf_nob i_var_
+val hd_of_i_var : [< `I of ('a * 'b) * 'c | `Var of 'a * 'd ] -> 'a
+val hd_of : [< `I of ('a * 'b) * 'c | `Var of 'a * 'd ] -> 'a
+val arity_of_hd : [> `I of ('a * int) * 'b | `Var of 'c * int ] -> int
+val lift : int -> nf -> nf
+val make_lams : nf -> int -> nf
+val free_vars' : nf -> (int * int) list
+val free_vars : nf -> int list
+module ToScott : sig val scott_of_nf : nf -> Pure.Pure.t end
+val string_of_term : string list -> nf -> string
+val print : ?l:string list -> nf -> string
+val string_of_nf : [< nf ] -> string
+val cast_to_i_var : [< nf > `I `Var] -> i_var
+val set_arity : int -> nf -> nf
+val minus1 : int -> int
+val mk_app : nf -> nf -> nf
+val mk_appl : nf -> nf list -> nf
+val mk_appx : nf -> nf Listx.listx -> nf
+val subst : bool -> bool -> int -> nf -> nf -> nf
+val eta_compare : nf -> nf -> int
+val eta_eq : [< nf ] -> [< nf ] -> bool
+val eta_subterm : [< nf ] -> [< nf ] -> bool
+val max_arity_tms : int -> [< nf] list -> int option
diff --git a/ocaml_new/parser.ml b/ocaml_new/parser.ml
new file mode 100644 (file)
index 0000000..487f042
--- /dev/null
@@ -0,0 +1,239 @@
+module Bytes = String;;\r
+exception ParsingError of string;;\r
+\r
+let mk_app x y = Num.mk_app x y;;\r
+let mk_lam x = `Lam(true, x);;\r
+let mk_var x = `Var(x, -666);;\r
+\r
+let isAlphaNum c = let n = Char.code c in\r
+ (48 <= n && n <= 90) || (95 <= n && n <= 122) ;;\r
+let isSpace c = c = ' ' || c = '\n' || c = '\t' ;;\r
+\r
+(* FIXME *)\r
+let mk_var' (bound, free) x =\r
+  if x <> "@" && List.mem x bound\r
+  then free, mk_var (Util.index_of x bound)\r
+  else if x <> "@" && List.mem x free\r
+       then free, mk_var (List.length bound + Util.index_of x free)\r
+       else (free @ [x]), mk_var (List.length bound + List.length free)\r
+;;\r
+\r
+let mk_app' = function\r
+  | [] ->  assert false\r
+  | t :: ts -> List.fold_left mk_app t ts\r
+;;\r
+\r
+let explode s =\r
+ let len = String.length s in\r
+  let rec aux i l =\r
+    if i >= len || s.[i] = '#' then l else aux (i+1) (s.[i] :: l)\r
+  in List.rev (aux 0 [])\r
+;;\r
+\r
+let implode l =\r
+  let res = Bytes.create (List.length l) in\r
+  let rec aux i = function\r
+    | [] -> res\r
+    | c :: l -> Bytes.set res i c; aux (i + 1) l in\r
+  aux 0 l\r
+;;\r
+\r
+let rec strip_spaces = function\r
+  | c::cs when isSpace c -> strip_spaces cs\r
+  | cs -> cs\r
+;;\r
+\r
+let read_var s =\r
+  let rec aux = function\r
+  | [] -> None, []\r
+  | c::cs as x ->\r
+    if c = '@' then\r
+     (if cs <> [] && (let hd = List.hd cs in hd = '@' || isAlphaNum hd)\r
+     then raise (ParsingError ("Unexpected `"^String.make 1 (List.hd cs)^"` after `@`."))\r
+     else Some['@'], cs)\r
+    else if isAlphaNum c\r
+    then match aux cs with\r
+         | (Some x), cs' -> Some (c :: x), cs'\r
+         | None, cs' -> (Some [c]), cs'\r
+    else None, x\r
+  in match aux s with\r
+    | None, y -> None, y\r
+    | Some x, y -> Some (implode x), y\r
+;;\r
+\r
+let read_var' (bound, free as vars) s =\r
+  match read_var s with\r
+  | Some varname, cs ->\r
+    let free, v = mk_var' vars varname in\r
+    Some [v], cs, (bound, free)\r
+  | None, _ -> raise (ParsingError ("Can't read variable"))\r
+;;\r
+\r
+let rec read_smt vars =\r
+  let check_if_lambda cs = match read_var cs with\r
+    | None, _ -> false\r
+    | Some x, cs -> match strip_spaces cs with\r
+      | [] -> false\r
+      | c::_ -> c = '.'\r
+  in let read_lambda (bound, free) cs = (\r
+    match read_var (strip_spaces cs) with\r
+      | Some varname, cs ->\r
+      let vars' = (varname::bound, free) in\r
+      (match strip_spaces cs with\r
+        | [] -> raise (ParsingError "Lambda expression incomplete")\r
+        | c::cs -> (if c = '.' then (match read_smt vars' cs with\r
+          | None, _, _ -> raise (ParsingError "Lambda body expected")\r
+          | Some [x], y, (_, free) -> Some [mk_lam x], y, (bound, free)\r
+          | Some _, _, _ -> assert false\r
+          ) else raise (ParsingError "Expected `.` after variable in lambda")\r
+        ))\r
+      | _, _ -> assert false\r
+ ) in let rec aux vars cs =\r
+  match strip_spaces cs with\r
+  | [] -> None, [], vars\r
+  | c::_ as x ->\r
+      let tms, cs, vars = (\r
+           if c = '(' then read_pars vars x\r
+      else if c = ')' then (None, x, vars)\r
+      else if check_if_lambda x then read_lambda vars x\r
+      else read_var' vars x) in\r
+      match tms with\r
+      | Some [tm] -> (\r
+        match aux vars cs with\r
+          | None, cs, vars -> Some [tm], cs, vars\r
+          | Some ts, cs, vars -> Some (tm :: ts), cs, vars\r
+        )\r
+      | Some _ -> assert false\r
+      | None -> None, x, vars\r
+  in fun cs -> match aux vars cs with\r
+    | None, cs, vars -> None, cs, vars\r
+    | Some ts, cs, vars -> Some [mk_app' ts], cs, vars\r
+and read_pars vars = function\r
+  | [] -> None, [], vars\r
+  | c::cs -> if c = '(' then (\r
+    let tm, cs, vars = read_smt vars cs in\r
+    let cs = strip_spaces cs in\r
+    match cs with\r
+      | [] -> None, [], vars\r
+      | c::cs -> if c = ')' then tm, cs, vars else raise (ParsingError "Missing `)`")\r
+    ) else assert false\r
+;;\r
+\r
+let parse x =\r
+  match read_smt ([],[]) (explode x) with\r
+  | Some [y], [], _ -> y\r
+  | _, _, _ -> assert false\r
+;;\r
+\r
+let parse_many strs =\r
+  let f (x, y) z = match read_smt y (explode z) with\r
+  | Some[tm], [], vars -> (tm :: x, vars)\r
+  | _, _, _ -> assert false\r
+  in let aux = List.fold_left f ([], ([], []))\r
+  in let (tms, (_, free)) = aux strs\r
+  in (List.rev tms, free)\r
+;;\r
+\r
+(**********************************************************************\r
+\r
+let rec string_of_term = function\r
+  | Tvar n -> string_of_int n\r
+  | Tapp(t1, t2) -> "(" ^ string_of_term t1 ^ " " ^ string_of_term t2 ^ ")"\r
+  | Tlam(t1) -> "(\\" ^ string_of_term t1 ^ ")"\r
+;;\r
+\r
+let _ = prerr_endline (">>>" ^ string_of_term (parse "(\\x. x y z z1 k) z1 z j"));;\r
+\r
+\r
+*******************************************************************************)\r
+\r
+let problem_of_string s =\r
+ let lines = Str.split (Str.regexp "[\n\r\x0c\t;]+") s in\r
+ let head, lines = List.hd lines, List.tl lines in\r
+ let name = String.trim (String.sub head 1 (String.length head - 1)) in\r
+ let lines = List.filter ((<>) "") lines in\r
+ let aux (last, div, conv, ps) line =\r
+  let chr = String.sub line 0 1 in\r
+  let line = String.trim (String.sub line 1 (String.length line - 1)) in\r
+  if line = "" then chr, div, conv, ps else\r
+  let rec aux' chr line =\r
+   if chr = "#"\r
+    then chr, div, conv, ps\r
+   else if chr = "D"\r
+    then chr, line, conv, ps\r
+   else if chr = "C"\r
+    then chr, div, line::conv, ps\r
+   else if chr = "N"\r
+    then chr, div, conv, line::ps\r
+   else if chr = " "\r
+    then aux' last line\r
+   else raise (ParsingError\r
+     ("Unexpected at beginning of problem: `" ^ chr ^ "` " ^ line)) in\r
+  aux' chr line in\r
+ let _, div, conv, ps = List.fold_left aux ("#", "", [], []) lines in\r
+ let div_provided = div <> "" in\r
+ let div = if div_provided then div else "BOT" in\r
+ let strs = [div] @ ps @ conv in\r
+\r
+ if List.length ps = 0 && List.length conv = 0\r
+  then raise (ParsingError "Parsed empty problem");\r
+\r
+ (* parse' *)\r
+ let (tms, free) = parse_many strs in\r
+ (* Replace pacmans and bottoms *)\r
+ let n_bot = try Util.index_of "BOT" free with Not_found -> min_int in\r
+ let n_pac = try Util.index_of "PAC" free with Not_found -> min_int in\r
+ let n_bomb = try Util.index_of "BOMB" free with Not_found -> min_int in\r
+ let fix lev v =\r
+  if v = lev + n_bot then `Bottom\r
+   else if v = lev + n_pac then `Pacman\r
+    else if v = lev + n_bomb then `Lam(true, `Bottom)\r
+    else if v = lev then `Var(v, min_int) (* zero *)\r
+     else `Var(v,1) in (* 1 by default when variable not applied *)\r
+ (* Fix arity *)\r
+ let open Num in\r
+ let exclude_bottom = function\r
+ | #nf_nob as t -> t\r
+ (* actually, the following may be assert false *)\r
+ | `Bottom -> raise (ParsingError "Input term not in normal form") in\r
+ let rec aux_nob lev : nf_nob -> nf = function\r
+ | `I((n,_), args) -> `I((n,(if lev = 0 then 0 else 1) + Listx.length args), Listx.map (fun t -> exclude_bottom (aux_nob lev t)) args)\r
+ | `Var(n,_) -> fix lev n\r
+ | `Lam(_,t) -> `Lam (true, aux (lev+1) t)\r
+ | `Pacman -> `Pacman\r
+ and aux lev : Num.nf -> Num.nf = function\r
+  | #nf_nob as t -> aux_nob lev t\r
+  | `Bottom -> assert false in\r
+let all_tms = List.map (aux 0) (tms :> Num.nf list) in\r
+\r
+(* problem_of *)\r
+let div, (ps, conv) = List.hd all_tms, Util.list_cut (List.length ps, List.tl all_tms) in\r
+\r
+let div = if not div_provided || div = `Bottom\r
+ then (*raise (ParsingError "D is not provided or bottom")*) `Var(-1000,0)\r
+ else match div with\r
+  | `I _ as t -> t\r
+  | _ -> raise (ParsingError "D is not an inert in the initial problem") in\r
+let conv = Util.filter_map (\r
+ function\r
+ | #i_var as t -> Some t\r
+ | `Lam _ -> None\r
+ | _ -> raise (ParsingError "A C-term is not i_n_var")\r
+ ) conv in\r
+ name, div, conv, free\r
+;;\r
+\r
+\r
+let from_file path =\r
+ let lines = ref ["#"] in\r
+ let chan = open_in path in\r
+ let _ = try\r
+  while true; do\r
+    lines := input_line chan :: !lines\r
+  done\r
+ with End_of_file ->\r
+  close_in chan in\r
+ let txt = String.concat "\n" (List.rev !lines) in\r
+ let problems = Str.split (Str.regexp "[\n\r]+\\$") txt in\r
+ List.map problem_of_string (List.tl (List.map ((^) "$") problems))\r
+;;\r
diff --git a/ocaml_new/parser.mli b/ocaml_new/parser.mli
new file mode 100644 (file)
index 0000000..0a6ae06
--- /dev/null
@@ -0,0 +1,13 @@
+exception ParsingError of string\r
+\r
+val problem_of_string:\r
+ string ->\r
+  string (* problem label *)\r
+  * Num.i_var (* div *)\r
+  * Num.i_var list (* conv *)\r
+  * string list (* names of free variables *)\r
+val from_file : string ->\r
+ (string (* problem label *)\r
+ * Num.i_var (* div *)\r
+ * Num.i_var list (* conv *)\r
+ * string list (* names of free variables *)) list\r
diff --git a/ocaml_new/problems.ml b/ocaml_new/problems.ml
new file mode 100644 (file)
index 0000000..eda359a
--- /dev/null
@@ -0,0 +1,39 @@
+open Lambda4;;
+open Util;;
+
+(* Syntax for problem files in problem/ folder:
+
+- dollar ($) on newline
+  begin new problem
+  $! means that the problem is expected to be separable,
+  $? means that it is expected to be unseparable
+
+- (#) on new line
+  comment line
+
+- (D) (C) (N) stand respectively for divergent, convergent, numeric
+
+- lines starting with spaces inherit the type from the last line
+
+*)
+
+(* assert_depends solves the problem, and checks if the result was expected *)
+let assert_depends x =
+ let c = String.sub (label_of_problem (fst x)) 0 1 in
+ match solve x with
+ | _, `Unseparable s when c = "!" ->
+    failwith ("assert_depends: unseparable because: " ^ s ^ ".")
+ | _, `Separable _  when c = "?" ->
+    failwith ("assert_depends: separable.")
+ | _ -> ()
+;;
+
+(* TODO *)
+(* div under a lambda in conv *)
+
+if Array.length Sys.argv = 1
+ then failwith "no command line args. Please use e.g. ./a.out problems/*"
+else Array.iteri (fun i filename -> if i > 0 then
+ List.iter (assert_depends ++ problem_of) (Parser.from_file filename)
+ ) Sys.argv
+;;
diff --git a/ocaml_new/problems.mli b/ocaml_new/problems.mli
new file mode 100644 (file)
index 0000000..ddab9df
--- /dev/null
@@ -0,0 +1 @@
+val assert_depends : Lambda4.problem * Lambda4.response -> unit
diff --git a/ocaml_new/problems/1 b/ocaml_new/problems/1
new file mode 100644 (file)
index 0000000..ae0bb44
--- /dev/null
@@ -0,0 +1,33 @@
+$! 1 1\r
+D x x\r
+C y\r
+\r
+$! 1 2\r
+D x x\r
+C y x\r
+\r
+$! 1 3\r
+D x x\r
+C y (x z)\r
+\r
+$! 1 4\r
+D x x\r
+C x y\r
+  y x\r
+  y y\r
+\r
+$! 1 5\r
+D x y\r
+C x x\r
+  y x\r
+  y y\r
+\r
+$! 1 6\r
+D x x\r
+C y x\r
+  y (x a)\r
+\r
+$? 1 6\r
+D x x\r
+C y x\r
+  y (x x)\r
diff --git a/ocaml_new/pure.ml b/ocaml_new/pure.ml
new file mode 100644 (file)
index 0000000..51d1feb
--- /dev/null
@@ -0,0 +1,130 @@
+open Util.Vars
+
+module Pure =
+struct
+
+type t =
+  | V of int
+  | A of t * t
+  | L of t
+  | B
+
+let rec print ?(l=[]) =
+ function
+    V n -> print_name l n
+  | A(t1,t2) -> "(" ^ print ~l t1 ^ " " ^ print ~l t2 ^ ")"
+  | L t ->
+     let name = string_of_var (List.length l) in
+     "λ" ^ name ^ "." ^ print ~l:(name::l) t
+  | B -> "B"
+
+let lift m =
+ let rec aux l =
+  function
+   | V n -> V (if n < l then n else n+m)
+   | A (t1,t2) -> A (aux l t1, aux l t2)
+   | L t -> L (aux (l+1) t)
+   | B -> B
+ in
+  aux 0
+
+(* Reference implementation.
+   Reduction machine used below
+let subst delift_by_one what with_what =
+ let rec aux l =
+  function
+   | A(t1,t2) -> A(aux l t1, aux l t2)
+   | V n ->
+       if n = what + l then
+        lift l with_what
+       else
+        V (if delift_by_one && n >= l then n-1 else n)
+   | L t -> L (aux (l+1) t)
+ in
+  aux 0
+
+let rec whd =
+ function
+  | A(t1, t2) ->
+     let t2 = whd t2 in
+     let t1 = whd t1 in
+      (match t1 with
+        | L f -> whd (subst true 0 t2 f)
+        | V _
+        | A _ -> A(t1,t2))
+  | V _
+  | L _ as t -> t
+*)
+
+let unwind ?(tbl = Hashtbl.create 317) m =
+ let rec unwind (e,t,s) =
+  let cache_unwind m =
+   try
+    Hashtbl.find tbl m
+   with
+    Not_found ->
+     let t = unwind m in
+      Hashtbl.add tbl m t ;
+      t in
+  let s = List.map cache_unwind s in
+  let rec aux l =
+   function
+    | A(t1,t2) -> A(aux l t1, aux l t2)
+    | V n as x when n < l -> x
+    | V n ->
+       (try
+         lift l (cache_unwind (List.nth e (n - l)))
+        with Failure _ -> V (n - l))
+    | L t -> L (aux (l+1) t)
+    | B -> B in
+  let t = aux 0 t in
+  List.fold_left (fun f a -> A(f,a)) t s
+in
+ unwind m
+
+let mwhd m =
+ let rec aux =
+  function
+   | (e,A(t1,t2),s) ->
+       let t2' = aux (e,t2,[]) in
+       let (_,t,_) = t2' in
+       if t = B
+        then t2'
+        else aux (e,t1,t2'::s)
+   | (e,L t,x::s) -> aux (x::e,t,s)
+   | (e,V n,s) as m ->
+      (try
+        let e,t,s' = List.nth e n in
+        aux (e,t,s'@s)
+       with Failure _ -> m)
+   | (e, B, _) -> (e, B, [])
+   | (_,L _,[]) as m -> m
+ in
+  unwind (aux m)
+
+end
+
+module Scott =
+struct
+
+open Pure
+
+let rec mk_n n =
+ if n = 0 then L (L (A (V 1, L (V 0)))) else L (L (A (V 0, mk_n (n-1))))
+
+let dummy = V (max_int / 2)
+
+let mk_match t bs =
+ let bs = List.sort (fun (n1,_) (n2,_) -> compare n1 n2) bs in
+ let rec aux m t =
+  function
+     [] -> A (L dummy, t)
+   | (n,p)::tl as l ->
+      if n = m then
+       A (A (t, L (lift (m+1) p)), L (aux (m+1) (V 0) tl))
+      else
+       A (A (t, dummy), L (aux (m+1) (V 0) l))
+ in
+  aux 0 t bs
+
+end
diff --git a/ocaml_new/pure.mli b/ocaml_new/pure.mli
new file mode 100644 (file)
index 0000000..a6b90ac
--- /dev/null
@@ -0,0 +1,15 @@
+module Pure :
+  sig
+    type t = V of int | A of t * t | L of t | B
+    val print : ?l:string list -> t -> string
+    val lift : int -> t -> t
+    val unwind : ?tbl:('a list * t * 'a list as 'a, t) Hashtbl.t -> 'a -> t
+    val mwhd : (('a * t * ('b list as 'c) as 'b) list as 'a) * t * 'c -> t
+  end
+
+module Scott :
+  sig
+    val mk_n : int -> Pure.t
+    val dummy : Pure.t
+    val mk_match : Pure.t -> (int * Pure.t) list -> Pure.t
+  end
diff --git a/ocaml_new/run b/ocaml_new/run
new file mode 100644 (file)
index 0000000..77957cd
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+file=`mktemp`
+
+echo
+echo "Running test. Log file: $file."
+echo
+
+trap 'echo' SIGINT
+
+
+./test4.out 2>&1 | tee $file | stdbuf -o0 grep -Po '(?<=measure=)[^ ]*' | stdbuf -o0 tr '\n' ' '
+
+if [ $? -eq 0 ]
+then
+ rm $file
+ echo
+ echo 'Test succeeded'
+else
+ echo ''
+ echo 'Test failed or interrupted'
+ echo "Please have a look at log file: $file ."
+fi
diff --git a/ocaml_new/test.ml b/ocaml_new/test.ml
new file mode 100644 (file)
index 0000000..293c1e6
--- /dev/null
@@ -0,0 +1,88 @@
+open Lambda4;;\r
+\r
+let assert_depends x =\r
+ let c = String.sub (label_of_problem (fst x)) 0 1 in\r
+ match solve x with\r
+ | _, `Unseparable s when c = "!" ->\r
+    failwith ("assert_depends: unseparable because: " ^ s ^ ".")\r
+ | _, `Separable _  when c = "?" ->\r
+    failwith ("assert_depends: separable.")\r
+ | _ -> ()\r
+;;\r
+\r
+let acaso l =\r
+    let n = Random.int (List.length l) in\r
+    List.nth l n\r
+;;\r
+\r
+let acaso2 l1 l2 =\r
+  let n1 = List.length l1 in\r
+  let n = Random.int (n1 + List.length l2) in\r
+  if n >= n1 then List.nth l2 (n - n1) else List.nth l1 n\r
+;;\r
+\r
+let rec take l n =\r
+  if n = 0 then []\r
+  else match l with\r
+  | [] -> []\r
+  | x::xs -> x :: (take xs (n-1))\r
+;;\r
+\r
+let test3 n vars =\r
+  let rec aux n inerts lams =\r
+    if n = 0 then take (Util.sort_uniq inerts) 5\r
+    else let inerts, lams = if Random.int 2 = 0\r
+      then inerts, ("(" ^ acaso vars ^ ". " ^ acaso2 inerts lams ^ ")") :: lams\r
+      else ("(" ^ acaso inerts ^ " " ^ acaso2 inerts lams^ ")") :: inerts, lams\r
+    in aux (n-1) inerts lams\r
+  in aux (2*n) vars []\r
+;;\r
+\r
+let test4 n vars =\r
+  let rec take' l n =\r
+    if n = 0 then [], []\r
+    else match l with\r
+    | [] -> [], []\r
+    | [_] -> assert false\r
+    | x1::x2::xs -> let a, b = take' xs (n-1) in x1::a,x2::b in\r
+  let rec aux n inerts lams =\r
+    if n = 0 then List.hd inerts, take' (Util.sort_uniq (List.tl inerts)) 5\r
+    else let inerts, lams = if Random.int 2 = 0\r
+      then inerts, ("(" ^ acaso vars ^ ". " ^ acaso2 inerts lams ^ ")") :: lams\r
+      else ("(" ^ acaso inerts ^ " " ^ acaso2 inerts lams^ ")") :: inerts, lams\r
+    in aux (n-1) inerts lams\r
+  in aux (2*n) vars []\r
+;;\r
+\r
+\r
+let rec repeat f n =\r
+  prerr_endline "\n*************************** NEW TEST ***************************";\r
+  f () ;\r
+  if n > 0 then repeat f (n-1)\r
+;;\r
+\r
+let call_main4 div conv =\r
+  let str = "$ test.out\nD " ^ div ^ String.concat "\nC " conv in\r
+  let p = Parser.problem_of_string str in\r
+  let p = Lambda4.problem_of p in\r
+  assert_depends p\r
+;;\r
+\r
+let main =\r
+  Random.self_init ();\r
+  let num = 100 in\r
+  let complex = 1000 in\r
+  let vars = ["x"; "y"; "z"; "v" ; "w"; "a"; "b"; "c"] in\r
+\r
+  (* let open Parser in *)\r
+\r
+  repeat (fun _ ->\r
+    let tms = test3 complex vars in\r
+    let div = acaso tms in\r
+    let conv = List.filter ((<>) div) tms in\r
+    call_main4 div conv\r
+  ) num\r
+  ;\r
+\r
+  prerr_endline "\n---- ALL TESTS COMPLETED ----"\r
+;;\r
diff --git a/ocaml_new/util.ml b/ocaml_new/util.ml
new file mode 100644 (file)
index 0000000..a87b96f
--- /dev/null
@@ -0,0 +1,118 @@
+(* Function composition *)
+let (++) f g x = f (g x);;
+
+let findi p =
+ let rec aux n = function
+ | [] -> raise Not_found
+ | x::_ when p x -> n, x
+ | _::xs -> aux (n+1) xs
+ in aux 0
+;;
+
+let option_map f = function
+ | None -> None
+ | Some x -> Some (f x)
+;;
+
+let option_get = function
+ | Some x -> x
+ | None -> failwith "option_get: None"
+;;
+
+let rec find_opt f =
+ function
+    [] -> None
+  | x::xs ->
+     match f x with
+        None -> find_opt f xs
+      | Some _ as res -> res
+
+let rec index_of ?(eq=(=)) x =
+ function
+    [] -> raise Not_found
+  | y::_ when eq x y -> 0
+  | _::l -> 1 + index_of ~eq x l
+
+let index_of_opt ?eq l t =
+ try
+  Some (index_of ?eq t l)
+ with
+  Not_found -> None
+;;
+
+let rec filter_map f =
+ function
+    [] -> []
+  | hd::tl ->
+     match f hd with
+        None -> filter_map f tl
+      | Some x -> x::filter_map f tl
+;;
+
+(* the input must be sorted *)
+let rec first_duplicate =
+ function
+    []
+  | [_] -> None
+  | x::y::_ when x=y -> Some x
+  | _::tl -> first_duplicate tl
+
+(* the input must be sorted
+   output: list of non duplicates; list of duplicates *)
+let rec split_duplicates =
+ function
+    [] -> [],[]
+  | [x] -> [x],[]
+  | x::(y::_ as tl) ->
+     let nondup,dup = split_duplicates tl in
+     if x = y then
+      List.filter ((<>) x) nondup, x::dup
+     else
+      x::nondup,dup
+
+(* Non c'e' nella vecchia versione di OCaml :( *)
+let uniq ?(compare=compare) =
+  let rec aux = function
+  | [] -> []
+  | [_] as ts -> ts
+  | t1 :: (t2 :: _ as ts) ->
+    if compare t1 t2 = 0 then aux ts else t1 :: (aux ts)
+  in aux
+
+let sort_uniq ?(compare=compare) l = uniq ~compare (List.sort compare l)
+
+let rec list_cut = function
+  | 0, lst -> [], lst
+  | n, x::xs -> let a, b = list_cut (n-1,xs) in x::a, b
+  | _ -> assert false
+;;
+
+let concat_map f l = List.concat (List.map f l);;
+
+let rec take n =
+ function
+ | [] -> assert (n = 0); []
+ | _ when n = 0 -> []
+ | x::xs -> x::(take (n-1) xs)
+;;
+
+module Vars =
+struct
+
+let string_of_var v =
+  if v > 25
+     then "`" ^ string_of_int v
+     else String.make 1 (char_of_int (v + int_of_char 'a'))
+;;
+
+let var_of_string s =
+ if String.length s <> 1 then (
+   if s.[0] = '`' then int_of_string (String.sub s 1 (-1 + String.length s)) else assert false
+ ) else int_of_char s.[0] - int_of_char 'a'
+
+let print_name l n =
+ if n = -1
+  then "*"
+  else if n >= List.length l then "x" ^ string_of_int (List.length l - n - 1) else List.nth l n
+
+end
diff --git a/ocaml_new/util.mli b/ocaml_new/util.mli
new file mode 100644 (file)
index 0000000..96f03ed
--- /dev/null
@@ -0,0 +1,21 @@
+val ( ++ ) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
+val findi : ('a -> bool) -> 'a list -> (int * 'a)
+val option_map : ('a -> 'b) -> 'a option -> 'b option
+val option_get : ('a option) -> 'a
+val find_opt : ('a -> 'b option) -> 'a list -> 'b option
+val index_of : ?eq:('a -> 'a -> bool) -> 'a -> 'a list -> int
+val index_of_opt : ?eq:('a -> 'a -> bool) -> 'a list -> 'a -> int option
+val filter_map : ('a -> 'b option) -> 'a list -> 'b list
+val first_duplicate : 'a list -> 'a option
+val split_duplicates : 'a list -> 'a list * 'a list
+val uniq : ?compare:('a -> 'a -> int) -> 'a list -> 'a list
+val sort_uniq : ?compare:('a -> 'a -> int) -> 'a list -> 'a list
+val list_cut : (int * 'a list) -> ('a list * 'a list)
+val concat_map : ('a -> 'b list) -> 'a list -> 'b list
+val take : int -> 'a list -> 'a list
+module Vars :
+  sig
+    val string_of_var : int -> string
+    val var_of_string : string -> int
+    val print_name : string list -> int -> string
+  end