[sledge] Revise Context.classify to detect more atomic terms

Summary: Treating atomic terms as uninterpreted is correct, but slower.

Reviewed By: jvillard

Differential Revision: D24934117

fbshipit-source-id: d9bdf5c8d
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent c31e7f2ee7
commit 4916aee050

@ -14,16 +14,15 @@ open Exp
type kind = Interpreted | Atomic | Uninterpreted
[@@deriving compare, equal]
let rec classify e =
let classify e =
match (e : Trm.t) with
| Var _ | Z _ | Q _ | Concat [||] | Apply (_, [||]) -> Atomic
| Arith a -> (
match Trm.Arith.classify a with
| Trm t -> classify t
| Const _ -> Atomic
| Trm _ | Const _ -> violates Trm.invariant e
| Interpreted -> Interpreted
| Uninterpreted -> Uninterpreted )
| Splat _ | Sized _ | Extract _ | Concat _ -> Interpreted
| Var _ | Z _ | Q _ -> Atomic
| Apply _ -> Uninterpreted
let interpreted e = equal_kind (classify e) Interpreted

@ -88,6 +88,9 @@ and Trm : sig
val ppx : Var.strength -> t pp
val pp : t pp
include Invariant.S with type t := t
val _Var : int -> string -> t
val _Z : Z.t -> t
val _Q : Q.t -> t

@ -47,6 +47,8 @@ val ppx : Var.strength -> t pp
val pp : t pp
val pp_diff : (t * t) pp
include Invariant.S with type t := t
(** Construct *)
(* variables *)

Loading…
Cancel
Save