Skip to content

Commit 0cfabaf

Browse files
committed
Restored input restriction before equiv testing
1 parent 22544f0 commit 0cfabaf

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/ecLowCircuits.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,18 @@ module MakeCircuitInterfaceFromCBackend(Backend: CBackend) : CircuitInterface =
13261326
let cond = circuit_or (circuit_not pre) post in
13271327
circ_taut cond
13281328

1329+
let sublimate_inputs ((c, cinps): circuit) : circuit =
1330+
assert (c.type_ = CBool);
1331+
let node_c = Backend.node_of_reg c.reg in
1332+
let node_c, shifts = Backend.Deps.excise_bit node_c in
1333+
let inps = List.filter_map (fun {id; type_} ->
1334+
match Map.find_opt id shifts with
1335+
| Some (low, hi) -> Some {id; type_ = CBitstring (hi - low + 1)}
1336+
| None -> None
1337+
) cinps in
1338+
let c = Backend.reg_of_node node_c in
1339+
{ reg = c; type_ = CBool}, inps
1340+
13291341

13301342
(* Review later? *)
13311343
let collapse_lanes (lanes: circuit list) =
@@ -1399,6 +1411,7 @@ module MakeCircuitInterfaceFromCBackend(Backend: CBackend) : CircuitInterface =
13991411
if debug then Format.eprintf "Checking equivalence for bit %d@." i; (* FIXME *)
14001412

14011413
(* let res = fillet_taut pres post in *)
1414+
let post = sublimate_inputs post in
14021415
let res = circ_taut post in
14031416
if not res then Format.eprintf "Failed for bit %d@." i;
14041417

0 commit comments

Comments
 (0)