[checkers] mlis for abstract domains

Reviewed By: jvillard, jberdine

Differential Revision: D4078302

fbshipit-source-id: 3b5f961
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent ecda199e9d
commit 9bf318fd4d

@ -0,0 +1,49 @@
(*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open! Utils
module F = Format
(** Abstract domains and domain combinators *)
module type S = sig
type astate
val initial : astate
val (<=) : lhs:astate -> rhs:astate -> bool (* fst \sqsubseteq snd? *)
val join : astate -> astate -> astate
val widen : prev:astate -> next:astate -> num_iters:int -> astate
val pp : F.formatter -> astate -> unit
end
(** Lift a pre-domain to a domain *)
module BottomLifted (Domain : S) : sig
type astate =
| Bottom
| NonBottom of Domain.astate
include S with type astate := astate
end
(** Cartesian product of two domains. *)
module Pair (Domain1 : S) (Domain2 : S) : S with type astate = Domain1.astate * Domain2.astate
(** Lift a set to a domain. The elements of the set should be drawn from a *finite* collection of
possible values, since the widening operator here is just union. *)
module FiniteSet (Set : PrettyPrintable.PPSet) : sig
include PrettyPrintable.PPSet with type t = Set.t and type elt = Set.elt
include S with type astate = t
end
(** Lift a map whose value type is an abstract domain to a domain. *)
module Map (Map : PrettyPrintable.PPMap) (ValueDomain : S) : sig
include PrettyPrintable.PPMap with type 'a t = 'a Map.t and type key = Map.key
include S with type astate = ValueDomain.astate Map.t
end

@ -21,7 +21,6 @@ module type S = sig
val pp : F.formatter -> astate -> unit val pp : F.formatter -> astate -> unit
end end
(** Lift a domain without bottom to a domain with bottom. *)
module BottomLifted (Domain : S) = struct module BottomLifted (Domain : S) = struct
type astate = type astate =
| Bottom | Bottom
@ -61,7 +60,6 @@ module BottomLifted (Domain : S) = struct
| NonBottom astate -> Domain.pp fmt astate | NonBottom astate -> Domain.pp fmt astate
end end
(** Cartestian product of two domains. *)
module Pair (Domain1 : S) (Domain2 : S) = struct module Pair (Domain1 : S) (Domain2 : S) = struct
type astate = Domain1.astate * Domain2.astate type astate = Domain1.astate * Domain2.astate
@ -89,8 +87,6 @@ module Pair (Domain1 : S) (Domain2 : S) = struct
F.fprintf fmt "(%a, %a)" Domain1.pp astate1 Domain2.pp astate2 F.fprintf fmt "(%a, %a)" Domain1.pp astate1 Domain2.pp astate2
end end
(** Lift a set to a domain. The elements of the set should be drawn from a *finite* collection of
possible values, since the widening operator here is just union. *)
module FiniteSet (S : PrettyPrintable.PPSet) = struct module FiniteSet (S : PrettyPrintable.PPSet) = struct
include S include S
type astate = t type astate = t
@ -111,7 +107,6 @@ module FiniteSet (S : PrettyPrintable.PPSet) = struct
join prev next join prev next
end end
(** Lift a map whose value type is an abstract domain to a domain. *)
module Map (M : PrettyPrintable.PPMap) (ValueDomain : S) = struct module Map (M : PrettyPrintable.PPMap) (ValueDomain : S) = struct
include M include M
type astate = ValueDomain.astate M.t type astate = ValueDomain.astate M.t

Loading…
Cancel
Save