From 6268a3d0f92df7be461da6f8474fa7a62e628fe3 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 2 Jan 2014 15:20:30 +0100 Subject: Ajout support pour les cycles. --- cpu/netlist_gen.ml | 2279 +++++++++++++++++++++++++++++++++++++++------------ cpu/netlist_gen.mli | 4 +- cpu/netlist_proc.ml | 257 +++--- 3 files changed, 1910 insertions(+), 630 deletions(-) (limited to 'cpu') diff --git a/cpu/netlist_gen.ml b/cpu/netlist_gen.ml index 4eabf25..3e40e0f 100644 --- a/cpu/netlist_gen.ml +++ b/cpu/netlist_gen.ml @@ -2,13 +2,13 @@ open Netlist_ast include Netlist_proc -type t = calc ref +type t = calc let main_0_1 circuit = let eqs = [] in let vars = Idm.empty in let o_1 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -21,8 +21,8 @@ let main_0_2 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -35,9 +35,9 @@ let main_0_3 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -50,10 +50,10 @@ let main_0_4 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -66,11 +66,11 @@ let main_0_5 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4,o_5 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -83,12 +83,12 @@ let main_0_6 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4,o_5,o_6 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -101,13 +101,13 @@ let main_0_7 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -120,14 +120,14 @@ let main_0_8 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -140,15 +140,15 @@ let main_0_9 circuit = let eqs = [] in let vars = Idm.empty in let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -161,8 +161,11 @@ let main_1_1 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -175,9 +178,12 @@ let main_1_2 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -190,10 +196,13 @@ let main_1_3 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -206,11 +215,14 @@ let main_1_4 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -223,12 +235,15 @@ let main_1_5 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -241,13 +256,16 @@ let main_1_6 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -260,14 +278,17 @@ let main_1_7 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -280,15 +301,18 @@ let main_1_8 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -301,16 +325,19 @@ let main_1_9 circuit t_1 = let i_1 = id "" in let eqs = [] in let vars = Idm.add i_1 t_1 (Idm.empty) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -324,8 +351,14 @@ let main_2_1 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -339,9 +372,15 @@ let main_2_2 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -355,10 +394,16 @@ let main_2_3 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -372,11 +417,17 @@ let main_2_4 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -390,12 +441,18 @@ let main_2_5 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -409,13 +466,19 @@ let main_2_6 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -429,14 +492,20 @@ let main_2_7 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -450,15 +519,21 @@ let main_2_8 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -472,16 +547,22 @@ let main_2_9 circuit t_1 t_2 = let i_2 = id "" in let eqs = [] in let vars = Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -496,8 +577,17 @@ let main_3_1 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -512,9 +602,18 @@ let main_3_2 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -529,10 +628,19 @@ let main_3_3 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -547,11 +655,20 @@ let main_3_4 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -566,12 +683,21 @@ let main_3_5 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -586,13 +712,22 @@ let main_3_6 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -607,14 +742,23 @@ let main_3_7 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -629,15 +773,24 @@ let main_3_8 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -652,16 +805,25 @@ let main_3_9 circuit t_1 t_2 t_3 = let i_3 = id "" in let eqs = [] in let vars = Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -677,8 +839,20 @@ let main_4_1 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -694,9 +868,21 @@ let main_4_2 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -712,10 +898,22 @@ let main_4_3 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -731,11 +929,23 @@ let main_4_4 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -751,12 +961,24 @@ let main_4_5 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -772,13 +994,25 @@ let main_4_6 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -794,14 +1028,26 @@ let main_4_7 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -817,15 +1063,27 @@ let main_4_8 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -841,16 +1099,28 @@ let main_4_9 circuit t_1 t_2 t_3 t_4 = let i_4 = id "" in let eqs = [] in let vars = Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -867,8 +1137,23 @@ let main_5_1 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -885,9 +1170,24 @@ let main_5_2 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -904,10 +1204,25 @@ let main_5_3 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -924,11 +1239,26 @@ let main_5_4 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -945,12 +1275,27 @@ let main_5_5 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -967,13 +1312,28 @@ let main_5_6 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -990,14 +1350,29 @@ let main_5_7 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -1014,15 +1389,30 @@ let main_5_8 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -1039,16 +1429,31 @@ let main_5_9 circuit t_1 t_2 t_3 t_4 t_5 = let i_5 = id "" in let eqs = [] in let vars = Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 val_5 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -1066,8 +1471,26 @@ let main_6_1 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -1085,9 +1508,27 @@ let main_6_2 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -1105,10 +1546,28 @@ let main_6_3 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -1126,11 +1585,29 @@ let main_6_4 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -1148,12 +1625,30 @@ let main_6_5 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -1171,13 +1666,31 @@ let main_6_6 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -1195,14 +1708,32 @@ let main_6_7 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -1220,15 +1751,33 @@ let main_6_8 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -1246,16 +1795,34 @@ let main_6_9 circuit t_1 t_2 t_3 t_4 t_5 t_6 = let i_6 = id "" in let eqs = [] in let vars = Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 val_5 val_6 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -1274,8 +1841,29 @@ let main_7_1 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -1294,9 +1882,30 @@ let main_7_2 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -1315,10 +1924,31 @@ let main_7_3 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -1337,11 +1967,32 @@ let main_7_4 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -1360,12 +2011,33 @@ let main_7_5 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -1384,13 +2056,34 @@ let main_7_6 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -1409,14 +2102,35 @@ let main_7_7 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -1435,15 +2149,36 @@ let main_7_8 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -1462,16 +2197,37 @@ let main_7_9 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 = let i_7 = id "" in let eqs = [] in let vars = Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -1491,8 +2247,32 @@ let main_8_1 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -1512,9 +2292,33 @@ let main_8_2 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -1534,10 +2338,34 @@ let main_8_3 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -1557,11 +2385,35 @@ let main_8_4 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -1581,12 +2433,36 @@ let main_8_5 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -1606,13 +2482,37 @@ let main_8_6 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -1632,14 +2532,38 @@ let main_8_7 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -1659,15 +2583,39 @@ let main_8_8 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -1687,16 +2635,40 @@ let main_8_9 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 = let i_8 = id "" in let eqs = [] in let vars = Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty)))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; @@ -1717,8 +2689,35 @@ let main_9_1 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in match arg_1 with | Avar id_1 -> { p_eqs = eqs; @@ -1739,9 +2738,36 @@ let main_9_2 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in match arg_1,arg_2 with | Avar id_1,Avar id_2 -> { p_eqs = eqs; @@ -1762,10 +2788,37 @@ let main_9_3 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in match arg_1,arg_2,arg_3 with | Avar id_1,Avar id_2,Avar id_3 -> { p_eqs = eqs; @@ -1786,11 +2839,38 @@ let main_9_4 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in match arg_1,arg_2,arg_3,arg_4 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4 -> { p_eqs = eqs; @@ -1811,12 +2891,39 @@ let main_9_5 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4,o_5 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4,o_5 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in match arg_1,arg_2,arg_3,arg_4,arg_5 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5 -> { p_eqs = eqs; @@ -1837,13 +2944,40 @@ let main_9_6 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4,o_5,o_6 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6 -> { p_eqs = eqs; @@ -1864,14 +2998,41 @@ let main_9_7 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7 -> { p_eqs = eqs; @@ -1892,15 +3053,42 @@ let main_9_8 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8 -> { p_eqs = eqs; @@ -1921,16 +3109,43 @@ let main_9_9 circuit t_1 t_2 t_3 t_4 t_5 t_6 t_7 t_8 t_9 = let i_9 = id "" in let eqs = [] in let vars = Idm.add i_9 t_9 (Idm.add i_8 t_8 (Idm.add i_7 t_7 (Idm.add i_6 t_6 (Idm.add i_5 t_5 (Idm.add i_4 t_4 (Idm.add i_3 t_3 (Idm.add i_2 t_2 (Idm.add i_1 t_1 (Idm.empty))))))))) in - let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit (ref (Id (i_1,t_1))) (ref (Id (i_2,t_2))) (ref (Id (i_3,t_3))) (ref (Id (i_4,t_4))) (ref (Id (i_5,t_5))) (ref (Id (i_6,t_6))) (ref (Id (i_7,t_7))) (ref (Id (i_8,t_8))) (ref (Id (i_9,t_9))) in - let arg_1,_,eqs,vars = calc eqs vars o_1 in - let arg_2,_,eqs,vars = calc eqs vars o_2 in - let arg_3,_,eqs,vars = calc eqs vars o_3 in - let arg_4,_,eqs,vars = calc eqs vars o_4 in - let arg_5,_,eqs,vars = calc eqs vars o_5 in - let arg_6,_,eqs,vars = calc eqs vars o_6 in - let arg_7,_,eqs,vars = calc eqs vars o_7 in - let arg_8,_,eqs,vars = calc eqs vars o_8 in - let arg_9,_,eqs,vars = calc eqs vars o_9 in + let val_1 = + let res_1 = ref (Arg (Avar i_1,t_1)) in + fun () -> res_1 in + let val_2 = + let res_2 = ref (Arg (Avar i_2,t_2)) in + fun () -> res_2 in + let val_3 = + let res_3 = ref (Arg (Avar i_3,t_3)) in + fun () -> res_3 in + let val_4 = + let res_4 = ref (Arg (Avar i_4,t_4)) in + fun () -> res_4 in + let val_5 = + let res_5 = ref (Arg (Avar i_5,t_5)) in + fun () -> res_5 in + let val_6 = + let res_6 = ref (Arg (Avar i_6,t_6)) in + fun () -> res_6 in + let val_7 = + let res_7 = ref (Arg (Avar i_7,t_7)) in + fun () -> res_7 in + let val_8 = + let res_8 = ref (Arg (Avar i_8,t_8)) in + fun () -> res_8 in + let val_9 = + let res_9 = ref (Arg (Avar i_9,t_9)) in + fun () -> res_9 in + let o_1,o_2,o_3,o_4,o_5,o_6,o_7,o_8,o_9 = circuit val_1 val_2 val_3 val_4 val_5 val_6 val_7 val_8 val_9 in + let arg_1,_,eqs,vars = calc Iset.empty eqs vars o_1 in + let arg_2,_,eqs,vars = calc Iset.empty eqs vars o_2 in + let arg_3,_,eqs,vars = calc Iset.empty eqs vars o_3 in + let arg_4,_,eqs,vars = calc Iset.empty eqs vars o_4 in + let arg_5,_,eqs,vars = calc Iset.empty eqs vars o_5 in + let arg_6,_,eqs,vars = calc Iset.empty eqs vars o_6 in + let arg_7,_,eqs,vars = calc Iset.empty eqs vars o_7 in + let arg_8,_,eqs,vars = calc Iset.empty eqs vars o_8 in + let arg_9,_,eqs,vars = calc Iset.empty eqs vars o_9 in match arg_1,arg_2,arg_3,arg_4,arg_5,arg_6,arg_7,arg_8,arg_9 with | Avar id_1,Avar id_2,Avar id_3,Avar id_4,Avar id_5,Avar id_6,Avar id_7,Avar id_8,Avar id_9 -> { p_eqs = eqs; diff --git a/cpu/netlist_gen.mli b/cpu/netlist_gen.mli index 9dd7b62..69a165a 100644 --- a/cpu/netlist_gen.mli +++ b/cpu/netlist_gen.mli @@ -1,4 +1,4 @@ -type t +type t = unit -> Netlist_proc.res ref val print : out_channel -> Netlist_ast.program -> unit @@ -23,6 +23,8 @@ val rom : string -> int -> int -> t -> t val ram : int -> int -> t -> t -> t -> t -> t +val reg : int -> t -> t + val main_0_1 : t -> Netlist_ast.program val main_0_2 : t * t -> Netlist_ast.program val main_0_3 : t * t * t -> Netlist_ast.program diff --git a/cpu/netlist_proc.ml b/cpu/netlist_proc.ml index 99dde22..ae3acdb 100644 --- a/cpu/netlist_proc.ml +++ b/cpu/netlist_proc.ml @@ -2,118 +2,181 @@ open Netlist_ast (* module Idm = Map.Make (String) *) module Idm = Env +(*module Imap = Map.Make(struct type t = int let compare = compare end)*) +module Iset = Set.Make (struct type t = int let compare = compare end) + +type res = + | Arg of (arg * int) + | Calc of (Iset.t -> equation list -> int Idm.t -> + arg * int * equation list * int Idm.t) type calc = - | Id of (ident * int) - | Eq of (equation list -> int Idm.t -> arg * int * equation list * int Idm.t) - | Const of (bool array) + unit -> res ref let id = let cnt = ref 0 in - fun n -> - let res = n ^ "_xoxo_" ^ (string_of_int !cnt) in + fun s -> + let res = s ^ "_xoxo_" ^ (string_of_int !cnt) in incr cnt; res +let id2 = + let cnt = ref 0 in + fun () -> + let v = !cnt in incr cnt; v + let value n = let l = String.length n in - ref (Const (Array.init l (fun i -> n.[i] = '1'))) + let v = Array.init l (fun i -> n.[i] = '1') in + let res = ref (Arg (Aconst v,l)) in + fun () -> res -let calc eqs vars e = - match !e with - | Id (id,t) -> Avar id,t,eqs,vars - | Eq c -> - let arg,t,eqs,vars = c eqs vars in - let () = - match arg with - | Avar id -> e := Id (id,t) - | Aconst v -> e := Const v in - arg,t,eqs,vars - | Const v -> Aconst v,(Array.length v),eqs,vars - +let calc ids eqs vars e = + let res = e () in + match !res with + | Calc c -> + let a,t,eqs,vars = c ids eqs vars in + ( res := Arg (a,t); a, t, eqs, vars ) + | Arg (a,t) -> a,t,eqs,vars + +(*let calc_rec t ids eqs vars e = + let res,ide = e () in + try let id,_ = Imap.find ide ids in + Avar id, t, eqs, vars, ids + with Not_found -> + match !res with + | Calc c -> + let id = id "" in + let a,t,eqs,vars = c (Imap.add ide (id,t) ids) eqs vars in + ( res := Arg (a,t); a, t, eqs, vars ) + | Arg (a,t) -> a,t,eqs,vars*) + let ( ++ ) a b = - ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - let res = id "" in - Avar res, (ta+tb), (res,Econcat (arga, argb))::eqs, Idm.add res (ta+tb) vars)) + let res = ref (Calc ( + fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + let res = id "" in + Avar res, (ta+tb), (res,Econcat (arga, argb))::eqs, + Idm.add res (ta+tb) vars)) in + fun () -> res -let ( ^^ ) a b = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - if ta = tb then - let res = id "" in - Avar res, (ta), (res,Ebinop (Xor,arga, argb))::eqs, Idm.add res (ta) vars - else assert false)) +let ( ^^ ) a b = + let res = ref (Calc ( + fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + if ta = tb then + let res = id "" in + Avar res, (ta), (res,Ebinop (Xor,arga, argb))::eqs, Idm.add res (ta) vars + else assert false)) in + fun () -> res -let ( ^| ) a b = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - if ta = tb then - let res = id "" in - Avar res, (ta), (res,Ebinop (Or,arga, argb))::eqs, Idm.add res (ta) vars - else assert false)) +let ( ^| ) a b = + let res = ref (Calc ( + fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + if ta = tb then + let res = id "" in + Avar res, (ta), (res,Ebinop (Or,arga, argb))::eqs, Idm.add res (ta) vars + else assert false)) in + fun () -> res -let ( ^& ) a b = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - if ta = tb then - let res = id "" in - Avar res, (ta), (res,Ebinop (And,arga, argb))::eqs, Idm.add res (ta) vars - else assert false)) - -let ( ^$ ) a b = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - if ta = tb then - let res = id "" in - Avar res, (ta), (res,Ebinop (Nand,arga, argb))::eqs, Idm.add res (ta) vars - else assert false)) - -let not a = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let res = id "" in - Avar res, ta, (res,Enot arga)::eqs, Idm.add res ta vars)) - -let mux a b c = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - let argb,tb,eqs,vars = calc eqs vars b in - let argc,tc,eqs,vars = calc eqs vars c in - if ta = 1 && tb = tc then - let res = id "" in - Avar res, tb, (res,Emux (arga,argb,argc))::eqs, Idm.add res tb vars - else assert false)) - -let ( ** ) a n = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - if n >= ta then assert false - else if ta = 1 then arga,ta,eqs,vars - else let res = id "" in - Avar res, 1, (res,Eselect (n,arga))::eqs, Idm.add res 1 vars)) - -let ( % ) a (i,j) = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - if j > ta then assert false - else if i > j then assert false - else if j-i+1 = ta then arga,ta,eqs,vars - else let res = id "" in - Avar res, (j-i+1), (res,Eslice (i,j,arga))::eqs, Idm.add res (j-i+1) vars)) - -let rom name a_s w_s a = ref (Eq (fun eqs vars -> - let arga,ta,eqs,vars = calc eqs vars a in - if ta = a_s && w_s > 0 then - let res = id name in - Avar res, w_s, (res,Erom (a_s,w_s,arga))::eqs, Idm.add res w_s vars - else assert false)) - -let ram a_s w_s ra we wa d = ref (Eq (fun eqs vars -> - let argra,tra,eqs,vars = calc eqs vars ra in - let argwe,twe,eqs,vars = calc eqs vars we in - let argwa,twa,eqs,vars = calc eqs vars wa in - let argd,td,eqs,vars = calc eqs vars d in - if tra = a_s && twa = a_s && td = w_s && twe = 1 then +let ( ^& ) a b = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + if ta = tb then + let res = id "" in + Avar res, (ta), (res,Ebinop (And,arga, argb))::eqs, Idm.add res (ta) vars + else assert false)) in + fun () -> res + +let ( ^$ ) a b = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + if ta = tb then + let res = id "" in + Avar res, (ta), (res,Ebinop (Nand,arga, argb))::eqs, Idm.add res (ta) vars + else assert false)) in + fun () -> res + +let not a = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in let res = id "" in - Avar res, w_s, (res,Eram (a_s,w_s,argra,argwe,argwa,argd))::eqs, Idm.add res w_s vars - else assert false)) + Avar res, ta, (res,Enot arga)::eqs, Idm.add res ta vars)) in + fun () -> res + +let mux a b c = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + let argb,tb,eqs,vars = calc ids eqs vars b in + let argc,tc,eqs,vars = calc ids eqs vars c in + if ta = 1 && tb = tc then + let res = id "" in + Avar res, tb, (res,Emux (arga,argb,argc))::eqs, Idm.add res tb vars + else assert false)) in + fun () -> res + +let ( ** ) a n = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + if n >= ta then assert false + else if ta = 1 then arga,ta,eqs,vars + else let res = id "" in + Avar res, 1, (res,Eselect (n,arga))::eqs, Idm.add res 1 vars)) in + fun () -> res + +let ( % ) a (i,j) = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + if j > ta then assert false + else if i > j then assert false + else if j-i+1 = ta then arga,ta,eqs,vars + else let res = id "" in + Avar res, (j-i+1), (res,Eslice (i,j,arga))::eqs, + Idm.add res (j-i+1) vars)) in + fun () -> res + +let rom prefix a_s w_s a = + let res = ref (Calc (fun ids eqs vars -> + let arga,ta,eqs,vars = calc ids eqs vars a in + if ta = a_s && w_s > 0 then + let res = id prefix in + Avar res, w_s, (res,Erom (a_s,w_s,arga))::eqs, Idm.add res w_s vars + else assert false)) in + fun () -> res + +let ram a_s w_s ra we wa = + let id2 = id2 () in + let id = id "" in + fun d -> + let res = ref (Calc (fun ids eqs vars -> + if Iset.mem id2 ids then Avar id, w_s, eqs, vars + else let argra,tra,eqs,vars = calc ids eqs vars ra in + let ids = Iset.add id2 ids in + let argwe,twe,eqs,vars = calc ids eqs vars we in + let argwa,twa,eqs,vars = calc ids eqs vars wa in + let argd,td,eqs,vars = calc ids eqs vars d in + if tra = a_s && twa = a_s && td = w_s && twe = 1 then + Avar id, w_s, (id,Eram (a_s,w_s,argra,argwe,argwa,argd))::eqs, Idm.add id w_s vars + else assert false)) in + fun () -> res + +let reg n = + let id2 = id2 () in + let id = id "" in fun a -> + let res = ref (Calc (fun ids eqs vars -> + if Iset.mem id2 ids then Avar id, n, eqs, vars + else let arga,ta,eqs,vars = calc (Iset.add id2 ids) eqs vars a in + if ta = n then + match arga with + | Avar id' -> Avar id, n, (id,Ereg id')::eqs, Idm.add id n vars + | _ -> assert false + else assert false)) in + fun () -> res let init_string n f = let s = String.make n 'a' in -- cgit v1.2.3