[sledge] Strengthen Equality invariant to ensure carrier closed under subterms

Reviewed By: jvillard

Differential Revision: D20831347

fbshipit-source-id: 374638285
master
Josh Berdine 5 years ago committed by Facebook GitHub Bot
parent 2124be1c71
commit 548928a839

@ -32,9 +32,6 @@ let rec fold_max_solvables e ~init ~f =
if non_interpreted e then f e init if non_interpreted e then f e init
else Term.fold e ~init ~f:(fun d s -> fold_max_solvables ~f d ~init:s) else Term.fold e ~init ~f:(fun d s -> fold_max_solvables ~f d ~init:s)
let rec iter_max_solvables e ~f =
if non_interpreted e then f e else Term.iter ~f:(iter_max_solvables ~f) e
(** Solution Substitutions *) (** Solution Substitutions *)
module Subst : sig module Subst : sig
type t [@@deriving compare, equal, sexp] type t [@@deriving compare, equal, sexp]
@ -419,10 +416,11 @@ let pre_invariant r =
(* no interpreted terms in carrier *) (* no interpreted terms in carrier *)
assert (non_interpreted trm || fail "non-interp %a" Term.pp trm ()) ; assert (non_interpreted trm || fail "non-interp %a" Term.pp trm ()) ;
(* carrier is closed under subterms *) (* carrier is closed under subterms *)
iter_max_solvables trm ~f:(fun subtrm -> Term.iter trm ~f:(fun subtrm ->
assert ( assert (
in_car r subtrm non_interpreted subtrm
|| fail "@[subterm %a of %a not in carrier of@ %a@]" Term.pp ==> (Term.is_constant subtrm || in_car r subtrm)
|| fail "@[subterm %a@ of %a@ not in carrier of@ %a@]" Term.pp
subtrm Term.pp trm pp r () ) ) ) subtrm Term.pp trm pp r () ) ) )
let invariant r = let invariant r =

Loading…
Cancel
Save