@ -116,7 +116,7 @@ end = struct
(* * remove entries for vars *)
let remove xs s =
Var . Set . fold ~ f : ( fun s x -> Term . Map . remove ( Term . var x ) s ) ~ init : s xs
Var . Set . fold ~ f : ( fun x s -> Term . Map . remove ( Term . var x ) s ) xs ~ init : s
(* * map over a subst, applying [f] to both domain and range, requires that
[ f ] is injective and for any set of terms [ E ] , [ f \ [ E \ ] ] is disjoint
@ -212,7 +212,7 @@ let compose1 ?f ~var ~rep (us, xs, s) =
let fresh name ( us , xs , s ) =
let x , us = Var . fresh name ~ wrt : us in
let xs = Var . Set . add x s x in
let xs = Var . Set . add x x s in
( Term . var x , ( us , xs , s ) )
let solve_poly ? f p q s =
@ -654,7 +654,7 @@ let rec and_term_ us e r =
let eq_false b r = and_eq_ us b Term . false_ r in
match ( e : Term . t ) with
| Integer { data } -> if Z . is_false data then false _ else r
| And cs -> Term . Set . fold cs ~ init : r ~ f : ( fun r e -> and_term_ us e r )
| And cs -> Term . Set . fold ~ f : ( and_term_ us ) cs ~ init : r
| Ap2 ( Eq , a , b ) -> and_eq_ us a b r
| Ap2 ( Xor , Integer { data } , a ) when Z . is_true data -> eq_false a r
| Ap2 ( Xor , a , Integer { data } ) when Z . is_true data -> eq_false a r
@ -703,11 +703,11 @@ let subst_invariant us s0 s =
(* dom of new entries not ito us *)
assert (
Option . for_all ~ f : ( Term . equal data ) ( Subst . find key s0 )
| | not ( Var . Set . is_ subset ( Term . fv key ) ~ of_ : us ) ) ;
| | not ( Var . Set . subset ( Term . fv key ) ~ of_ : us ) ) ;
(* rep not ito us implies trm not ito us *)
assert (
Var . Set . is_ subset ( Term . fv data ) ~ of_ : us
| | not ( Var . Set . is_ subset ( Term . fv key ) ~ of_ : us ) ) ) ;
Var . Set . subset ( Term . fv data ) ~ of_ : us
| | not ( Var . Set . subset ( Term . fv key ) ~ of_ : us ) ) ) ;
true )
type ' a zom = Zero | One of ' a | Many
@ -723,7 +723,7 @@ let solve_poly_eq us p' q' subst =
let max_solvables_not_ito_us =
fold_max_solvables diff ~ init : Zero ~ f : ( fun solvable_subterm -> function
| Many -> Many
| zom when Var . Set . is_ subset ( Term . fv solvable_subterm ) ~ of_ : us -> zom
| zom when Var . Set . subset ( Term . fv solvable_subterm ) ~ of_ : us -> zom
| One _ -> Many
| Zero -> One solvable_subterm )
in
@ -740,8 +740,8 @@ let solve_seq_eq us e' f' subst =
[ % Trace . call fun { pf } -> pf " %a = %a " Term . pp e' Term . pp f' ]
;
let f x u =
( not ( Var . Set . is_ subset ( Term . fv x ) ~ of_ : us ) )
&& Var . Set . is_ subset ( Term . fv u ) ~ of_ : us
( not ( Var . Set . subset ( Term . fv x ) ~ of_ : us ) )
&& Var . Set . subset ( Term . fv u ) ~ of_ : us
in
let solve_concat ms n a =
let a , n =
@ -835,7 +835,7 @@ let solve_uninterp_eqs us (cls, subst) =
let { rep_us ; cls_us ; rep_xs ; cls_xs } =
List . fold cls ~ init : { rep_us = None ; cls_us = [] ; rep_xs = None ; cls_xs = [] }
~ f : ( fun ( { rep_us ; cls_us ; rep_xs ; cls_xs } as s ) trm ->
if Var . Set . is_ subset ( Term . fv trm ) ~ of_ : us then
if Var . Set . subset ( Term . fv trm ) ~ of_ : us then
match rep_us with
| Some rep when compare rep trm < = 0 ->
{ s with cls_us = trm :: cls_us }
@ -899,7 +899,7 @@ let solve_class us us_xs ~key:rep ~data:cls (classes, subst) =
;
let cls , cls_not_ito_us_xs =
List . partition
~ f : ( fun e -> Var . Set . is_ subset ( Term . fv e ) ~ of_ : us_xs )
~ f : ( fun e -> Var . Set . subset ( Term . fv e ) ~ of_ : us_xs )
( rep :: cls )
in
let cls , subst = solve_interp_eqs us ( cls , subst ) in
@ -957,8 +957,7 @@ let solve_concat_extracts r us x (classes, subst, us_xs) =
List . fold ( cls_of r e ) ~ init : None ~ f : ( fun rep_ito_us trm ->
match rep_ito_us with
| Some rep when Term . compare rep trm < = 0 -> rep_ito_us
| _ when Var . Set . is_subset ( Term . fv trm ) ~ of_ : us ->
Some trm
| _ when Var . Set . subset ( Term . fv trm ) ~ of_ : us -> Some trm
| _ -> rep_ito_us )
in
Term . sized ~ siz : ( Term . seq_size_exn e ) ~ seq : rep_ito_us :: suffix ) )
@ -973,7 +972,7 @@ let solve_concat_extracts r us x (classes, subst, us_xs) =
let solve_for_xs r us xs ( classes , subst , us_xs ) =
Var . Set . fold xs ~ init : ( classes , subst , us_xs )
~ f : ( fun ( classes , subst , us_xs ) x ->
~ f : ( fun x ( classes , subst , us_xs ) ->
let x = Term . var x in
if Subst . mem x subst then ( classes , subst , us_xs )
else solve_concat_extracts r us x ( classes , subst , us_xs ) )
@ -1036,10 +1035,10 @@ let solve_for_vars vss r =
let ks = Term . fv key in
let ds = Term . fv data in
if
Var . Set . is_ subset ks ~ of_ : us_xs
&& Var . Set . is_ subset ds ~ of_ : us_xs
&& ( Var . Set . is_ subset ds ~ of_ : us
| | not ( Var . Set . is_ subset ks ~ of_ : us ) )
Var . Set . subset ks ~ of_ : us_xs
&& Var . Set . subset ds ~ of_ : us_xs
&& ( Var . Set . subset ds ~ of_ : us
| | not ( Var . Set . subset ks ~ of_ : us ) )
then ` Stop true
else ` Continue us_xs )
~ finish : ( fun _ -> false ) ) ) ]