[sledge] Refactor: Make Term and Equality independent of Var.Subst

Summary:
Change Term and Equality rename functions to accept a partial
application of Var.Subst.apply to the renaming substitution.

Reviewed By: ngorogiannis

Differential Revision: D22170520

fbshipit-source-id: 003d8b27e
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 9cb74ac9ac
commit 79a4db7771

@ -11,10 +11,11 @@ module Term = struct
include Ses.Term
let ite = conditional
let rename s e = rename (Var.Subst.apply s) e
end
module Formula = struct
include Ses.Term
include Term
let inject b = b
let project e = Some e
@ -29,6 +30,7 @@ module Context = struct
let and_formula = and_term
let normalizef = normalize
let rename x sub = rename x (Var.Subst.apply sub)
module Subst = struct
include Subst

@ -48,7 +48,7 @@ val or_ : Var.Set.t -> t -> t -> Var.Set.t * t
val orN : Var.Set.t -> t list -> Var.Set.t * t
(** Nary disjunction. *)
val rename : t -> Var.Subst.t -> t
val rename : t -> (Var.t -> Var.t) -> t
(** Apply a renaming substitution to the relation. *)
val fv : t -> Var.Set.t

@ -1220,10 +1220,8 @@ let disjuncts e =
in
Set.elements (disjuncts_ e)
let rename sub e =
map_rec_pre e ~f:(function
| Var _ as v -> Some (Var.Subst.apply sub v)
| _ -> None )
let rename f e =
map_rec_pre e ~f:(function Var _ as v -> Some (f v) | _ -> None)
(** Traverse *)

@ -259,7 +259,7 @@ val fold_map_rec_pre :
t -> init:'a -> f:('a -> t -> ('a * t) option) -> 'a * t
val disjuncts : t -> t list
val rename : Var.Subst.t -> t -> t
val rename : (Var.t -> Var.t) -> t -> t
(** Traverse *)

Loading…
Cancel
Save