[sledge] Refactor: Add `formula` alias for `term` type, and use appropriately

Reviewed By: ngorogiannis

Differential Revision: D22170518

fbshipit-source-id: dfa6e506e
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 4308ca649f
commit 0998ce011f

@ -6,5 +6,14 @@
*) *)
module Var = Ses.Term.Var module Var = Ses.Term.Var
module Term = Ses.Term
module Term = struct
include Ses.Term
type term = t
type formula = t
let ite = conditional
end
module Context = Ses.Equality module Context = Ses.Equality

@ -57,78 +57,89 @@ end
(** Terms *) (** Terms *)
module Term : sig module Term : sig
type t [@@deriving compare, equal, sexp] type term
type formula = term
val ppx : Var.strength -> t pp val ppx : Var.strength -> term pp
val pp : t pp val pp : term pp
module Map : Map.S with type key := t module Map : Map.S with type key := term
(** Construct *) (** Construct *)
(** terms *)
(* variables *) (* variables *)
val var : Var.t -> t val var : Var.t -> term
(* constants *) (* constants *)
val true_ : t val zero : term
val false_ : t val one : term
val integer : Z.t -> t val integer : Z.t -> term
val zero : t val rational : Q.t -> term
val one : t
val rational : Q.t -> t
(* comparisons *)
val eq : t -> t -> t
val dq : t -> t -> t
val lt : t -> t -> t
val le : t -> t -> t
(* arithmetic *) (* arithmetic *)
val neg : t -> t val neg : term -> term
val add : t -> t -> t val add : term -> term -> term
val sub : t -> t -> t val sub : term -> term -> term
val mulq : Q.t -> t -> t val mulq : Q.t -> term -> term
val mul : t -> t -> t val mul : term -> term -> term
(* boolean *) (* sequences *)
val and_ : t -> t -> t val splat : term -> term
val or_ : t -> t -> t val sized : seq:term -> siz:term -> term
val not_ : t -> t val extract : seq:term -> off:term -> len:term -> term
val concat : term array -> term
(* if-then-else *) (* if-then-else *)
val conditional : cnd:t -> thn:t -> els:t -> t val ite : cnd:formula -> thn:term -> els:term -> term
(* sequences *) (** formulas *)
val splat : t -> t
val sized : seq:t -> siz:t -> t
val extract : seq:t -> off:t -> len:t -> t
val concat : t array -> t
(* convert *) (* constants *)
val of_exp : Llair.Exp.t -> t val true_ : formula
val false_ : formula
(* comparisons *)
val eq : term -> term -> formula
val dq : term -> term -> formula
val lt : term -> term -> formula
val le : term -> term -> formula
(* connectives *)
val not_ : formula -> formula
val and_ : formula -> formula -> formula
val or_ : formula -> formula -> formula
val conditional : cnd:formula -> thn:formula -> els:formula -> formula
(** Convert *)
val of_exp : Llair.Exp.t -> term
(** Destruct *) (** Destruct *)
val d_int : t -> Z.t option val d_int : term -> Z.t option
(** Access *) (** Access *)
val const_of : t -> Q.t option val const_of : term -> Q.t option
(** Transform *) (** Transform *)
val disjuncts : t -> t list val disjuncts : term -> term list
val rename : Var.Subst.t -> t -> t val rename : Var.Subst.t -> term -> term
(** Traverse *) (** Traverse *)
val fold_vars : t -> init:'a -> f:('a -> Var.t -> 'a) -> 'a val fold_vars : term -> init:'a -> f:('a -> Var.t -> 'a) -> 'a
(** Query *) (** Query *)
val fv : t -> Var.Set.t val is_true : formula -> bool
val is_true : t -> bool val is_false : formula -> bool
val is_false : t -> bool val fv : term -> Var.Set.t
type t = term [@@deriving compare, equal, sexp]
end end
(** Inference System *) (** Inference System *)

Loading…
Cancel
Save