|
|
@ -142,9 +142,6 @@ let rec is_constant e =
|
|
|
|
Qset.for_all ~f:(fun arg _ -> is_constant arg) args
|
|
|
|
Qset.for_all ~f:(fun arg _ -> is_constant arg) args
|
|
|
|
| Label _ | Float _ | Integer _ -> true
|
|
|
|
| Label _ | Float _ | Integer _ -> true
|
|
|
|
|
|
|
|
|
|
|
|
let solve ~us ~xs e f =
|
|
|
|
|
|
|
|
[%Trace.call fun {pf} -> pf "%a@ %a" Term.pp e Term.pp f]
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
let rec solve_ e f s =
|
|
|
|
let rec solve_ e f s =
|
|
|
|
let extend ~trm ~rep (us, xs, s) =
|
|
|
|
let extend ~trm ~rep (us, xs, s) =
|
|
|
|
Some (us, xs, Subst.compose1 ~key:trm ~data:rep s)
|
|
|
|
Some (us, xs, Subst.compose1 ~key:trm ~data:rep s)
|
|
|
@ -159,14 +156,12 @@ let solve ~us ~xs e f =
|
|
|
|
| Integer {data= m}, Integer {data= n} when not (Z.equal m n) -> None
|
|
|
|
| Integer {data= m}, Integer {data= n} when not (Z.equal m n) -> None
|
|
|
|
| _ -> (
|
|
|
|
| _ -> (
|
|
|
|
match (is_constant e, is_constant f) with
|
|
|
|
match (is_constant e, is_constant f) with
|
|
|
|
(* orient equation to discretionarily prefer term that is constant
|
|
|
|
(* orient equation to discretionarily prefer term that is constant or
|
|
|
|
or compares smaller as class representative *)
|
|
|
|
compares smaller as class representative *)
|
|
|
|
| true, false -> extend ~trm:f ~rep:e s
|
|
|
|
| true, false -> extend ~trm:f ~rep:e s
|
|
|
|
| false, true -> extend ~trm:e ~rep:f s
|
|
|
|
| false, true -> extend ~trm:e ~rep:f s
|
|
|
|
| _ ->
|
|
|
|
| _ ->
|
|
|
|
let trm, rep =
|
|
|
|
let trm, rep = if Term.compare e f > 0 then (e, f) else (f, e) in
|
|
|
|
if Term.compare e f > 0 then (e, f) else (f, e)
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
extend ~trm ~rep s )
|
|
|
|
extend ~trm ~rep s )
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let concat_size args =
|
|
|
|
let concat_size args =
|
|
|
@ -193,7 +188,10 @@ let solve ~us ~xs e f =
|
|
|
|
| Some p -> solve_uninterp e f >>= solve_ p m
|
|
|
|
| Some p -> solve_uninterp e f >>= solve_ p m
|
|
|
|
| _ -> solve_uninterp e f )
|
|
|
|
| _ -> solve_uninterp e f )
|
|
|
|
| _ -> solve_uninterp e f
|
|
|
|
| _ -> solve_uninterp e f
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
|
|
let solve ~us ~xs e f =
|
|
|
|
|
|
|
|
[%Trace.call fun {pf} -> pf "%a@ %a" Term.pp e Term.pp f]
|
|
|
|
|
|
|
|
;
|
|
|
|
(solve_ e f (us, xs, Subst.empty) >>| fun (_, xs, s) -> (xs, s))
|
|
|
|
(solve_ e f (us, xs, Subst.empty) >>| fun (_, xs, s) -> (xs, s))
|
|
|
|
|>
|
|
|
|
|>
|
|
|
|
[%Trace.retn fun {pf} ->
|
|
|
|
[%Trace.retn fun {pf} ->
|
|
|
|