X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=ocaml%2Flambda4.ml;h=4108ea57af1773e71c84ff8e25861f82a73e43f7;hb=f6a7ce917055ee2d750bb0e1bec6617945ea9928;hp=fa9b043e4f64d1b60bed908a2893f83389d4585c;hpb=5991691df6dc3d096a08397712040c93d7f873b5;p=fireball-separation.git diff --git a/ocaml/lambda4.ml b/ocaml/lambda4.ml index fa9b043..4108ea5 100644 --- a/ocaml/lambda4.ml +++ b/ocaml/lambda4.ml @@ -27,6 +27,8 @@ type problem = ; sigma: (int * nf) list (* the computed substitution *) ; deltas: (int * nf) list ref list (* collection of all branches *) ; initialSpecialK: int + ; label : string + ; var_names : string list (* names of the original free variables *) };; let all_terms p = @@ -747,6 +749,24 @@ let append_zero = | `N _ -> raise (Parser.ParsingError " numbers in ps") ;; +let tmp (label, div, conv, nums, var_names) = + (* DA SPOSTARE NEI TEST: *) + let ps = List.map append_zero nums in (* crea lista applicando zeri o dummies *) + let ps = sort_uniq ~compare:eta_compare (ps :> nf list) in + let ps = List.map (cast_to_i_n_var) ps in + + (* TODO: *) + (* replace div with bottom in problem??? *) + let special_k = + let all_tms = (match div with None -> [] | Some div -> [(div :> i_n_var)]) @ nums @ conv in + compute_special_k (Listx.from_list (all_tms :> nf list)) in (* compute initial special K *) + 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 + {freshno; div; conv; ps; sigma=[]; deltas; initialSpecialK=special_k; var_names; label} +;; + let problem_of ~div ~conv ~nums = let all_tms = (match div with None -> [] | Some div -> [div]) @ nums @ conv in let all_tms, var_names = Parser.parse' all_tms in @@ -770,19 +790,5 @@ let problem_of ~div ~conv ~nums = | #i_n_var as y -> y | _ -> raise (Parser.ParsingError "A term in num is not i_n_var") ) ps in - (* DA SPOSTARE NEI TEST: *) - let ps = List.map append_zero ps in (* crea lista applicando zeri o dummies *) - let ps = sort_uniq ~compare:eta_compare (ps :> nf list) in - let ps = List.map (cast_to_i_n_var) ps in - - (* TODO: *) - (* replace div with bottom in problem??? *) - - let special_k = compute_special_k (Listx.from_list all_tms) in (* compute initial special K *) - 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 p = {freshno; div; conv; ps; sigma=[] ; deltas; initialSpecialK=special_k} in - p + tmp("missing label", div, conv, ps, var_names) ;;