[sledge] Remove unnecessary hash functions

Reviewed By: ngorogiannis

Differential Revision: D22170519

fbshipit-source-id: 2c916272a
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 967185e02a
commit 4308ca649f

@ -7,7 +7,7 @@
(** Variables *) (** Variables *)
module Var : sig module Var : sig
type t [@@deriving compare, equal, hash, sexp] type t [@@deriving compare, equal, sexp]
type strength = t -> [`Universal | `Existential | `Anonymous] option type strength = t -> [`Universal | `Existential | `Anonymous] option
val pp : t pp val pp : t pp
@ -17,7 +17,6 @@ module Var : sig
module Set : sig module Set : sig
include NS.Set.S with type elt := t include NS.Set.S with type elt := t
val hash_fold_t : t Hash.folder
val sexp_of_t : t -> Sexp.t val sexp_of_t : t -> Sexp.t
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
val ppx : strength -> t pp val ppx : strength -> t pp
@ -58,7 +57,7 @@ end
(** Terms *) (** Terms *)
module Term : sig module Term : sig
type t [@@deriving compare, equal, hash, sexp] type t [@@deriving compare, equal, sexp]
val ppx : Var.strength -> t pp val ppx : Var.strength -> t pp
val pp : t pp val pp : t pp

@ -40,35 +40,25 @@ type opN = Concat | Record [@@deriving compare, equal, hash, sexp]
module rec Set : sig module rec Set : sig
include NS.Set.S with type elt := T.t include NS.Set.S with type elt := T.t
val hash : t -> int
val hash_fold_t : t Hash.folder
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
end = struct end = struct
include NS.Set.Make (T) include NS.Set.Make (T)
let hash_fold_t = hash_fold_t T.hash_fold_t
let hash = Hash.of_fold hash_fold_t
include Provide_of_sexp (T) include Provide_of_sexp (T)
end end
and Qset : sig and Qset : sig
include NS.Qset.S with type elt := T.t include NS.Qset.S with type elt := T.t
val hash : t -> int
val hash_fold_t : t Hash.folder
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
end = struct end = struct
include NS.Qset.Make (T) include NS.Qset.Make (T)
let hash_fold_t = hash_fold_t T.hash_fold_t
let hash = Hash.of_fold hash_fold_t
let t_of_sexp = t_of_sexp T.t_of_sexp let t_of_sexp = t_of_sexp T.t_of_sexp
end end
and T : sig and T : sig
type set = Set.t [@@deriving compare, equal, hash, sexp] type set = Set.t [@@deriving compare, equal, sexp]
type qset = Qset.t [@@deriving compare, equal, hash, sexp] type qset = Qset.t [@@deriving compare, equal, sexp]
type t = type t =
| Var of {id: int; name: string} | Var of {id: int; name: string}
@ -85,10 +75,10 @@ and T : sig
| Integer of {data: Z.t} | Integer of {data: Z.t}
| Rational of {data: Q.t} | Rational of {data: Q.t}
| RecRecord of int | RecRecord of int
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
end = struct end = struct
type set = Set.t [@@deriving compare, equal, hash, sexp] type set = Set.t [@@deriving compare, equal, sexp]
type qset = Qset.t [@@deriving compare, equal, hash, sexp] type qset = Qset.t [@@deriving compare, equal, sexp]
type t = type t =
| Var of {id: int; name: string} | Var of {id: int; name: string}
@ -105,7 +95,7 @@ end = struct
| Integer of {data: Z.t} | Integer of {data: Z.t}
| Rational of {data: Q.t} | Rational of {data: Q.t}
| RecRecord of int | RecRecord of int
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
(* Note: solve (and invariant) requires Qset.min_elt to return a (* Note: solve (and invariant) requires Qset.min_elt to return a
non-coefficient, so Integer and Rational terms must compare higher than non-coefficient, so Integer and Rational terms must compare higher than

@ -26,7 +26,7 @@ type op1 =
[Integer] types. *) [Integer] types. *)
| Splat (** Iterated concatenation of a single byte *) | Splat (** Iterated concatenation of a single byte *)
| Select of int (** Select an index from a record *) | Select of int (** Select an index from a record *)
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
type op2 = type op2 =
| Eq (** Equal test *) | Eq (** Equal test *)
@ -45,36 +45,34 @@ type op2 =
| Ashr (** Arithmetic shift right, bitwise *) | Ashr (** Arithmetic shift right, bitwise *)
| Sized (** Size-tagged sequence *) | Sized (** Size-tagged sequence *)
| Update of int (** Constant record with updated index *) | Update of int (** Constant record with updated index *)
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
type op3 = type op3 =
| Conditional (** If-then-else *) | Conditional (** If-then-else *)
| Extract (** Extract a slice of an sequence value *) | Extract (** Extract a slice of an sequence value *)
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
type opN = type opN =
| Concat (** Byte-array concatenation *) | Concat (** Byte-array concatenation *)
| Record (** Record (array / struct) constant *) | Record (** Record (array / struct) constant *)
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
module rec Set : sig module rec Set : sig
include NS.Set.S with type elt := T.t include NS.Set.S with type elt := T.t
val hash_fold_t : t Hash.folder
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
end end
and Qset : sig and Qset : sig
include NS.Qset.S with type elt := T.t include NS.Qset.S with type elt := T.t
val hash_fold_t : t Hash.folder
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
end end
and T : sig and T : sig
type set = Set.t [@@deriving compare, equal, hash, sexp] type set = Set.t [@@deriving compare, equal, sexp]
type qset = Qset.t [@@deriving compare, equal, hash, sexp] type qset = Qset.t [@@deriving compare, equal, sexp]
and t = private and t = private
| Var of {id: int; name: string} | Var of {id: int; name: string}
@ -93,7 +91,7 @@ and T : sig
| Integer of {data: Z.t} (** Integer constant *) | Integer of {data: Z.t} (** Integer constant *)
| Rational of {data: Q.t} (** Rational constant *) | Rational of {data: Q.t} (** Rational constant *)
| RecRecord of int (** Reference to ancestor recursive record *) | RecRecord of int (** Reference to ancestor recursive record *)
[@@deriving compare, equal, hash, sexp] [@@deriving compare, equal, sexp]
end end
include module type of T with type t = T.t include module type of T with type t = T.t
@ -101,7 +99,7 @@ include module type of T with type t = T.t
(** Term.Var is re-exported as Var *) (** Term.Var is re-exported as Var *)
module Var : sig module Var : sig
type term := t type term := t
type t = private term [@@deriving compare, equal, hash, sexp] type t = private term [@@deriving compare, equal, sexp]
type strength = t -> [`Universal | `Existential | `Anonymous] option type strength = t -> [`Universal | `Existential | `Anonymous] option
module Map : Map.S with type key := t module Map : Map.S with type key := t
@ -109,7 +107,6 @@ module Var : sig
module Set : sig module Set : sig
include NS.Set.S with type elt := t include NS.Set.S with type elt := t
val hash_fold_t : t Hash.folder
val sexp_of_t : t -> Sexp.t val sexp_of_t : t -> Sexp.t
val t_of_sexp : Sexp.t -> t val t_of_sexp : Sexp.t -> t
val ppx : strength -> t pp val ppx : strength -> t pp

Loading…
Cancel
Save