hasmtlib-2.7.1: A monad for interfacing with external SMT solvers
Safe HaskellSafe-Inferred
LanguageGHC2021

Language.Hasmtlib.Variable

Description

This module provides the class Variable which lets you create symbolical values of a data-type.

A generic default implementation with GVariable is possible.

Example

Expand
data V3 a = V3 a a a deriving Generic
instance Codec a => Codec (V3 a)
instance Equatable a => Codec (V3 a)

problem :: MonadSMT s m => StateT s m (V3 (Expr RealSort))
problem = do
  let constantV3 = encode $ V3 7 69 42
  symbolicV3 <- variable @(V3 (Expr RealSort))
  assert $ symbolicV3 /== constantV3
  return symbolicV3
Synopsis

Class

class Variable a where Source #

Construct a variable datum of a data-type by creating variables for all its fields.

You can derive an instance of this class if your type is Generic and has exactly one constructor.

Minimal complete definition

Nothing

Methods

variable :: MonadSMT s m => m a Source #

default variable :: (MonadSMT s m, Generic a, GVariable (Rep a)) => m a Source #

Instances

Instances details
Variable () Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m () Source #

Variable a => Variable (Identity a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Identity a) Source #

Variable a => Variable (First a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (First a) Source #

Variable a => Variable (Last a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Last a) Source #

Variable a => Variable (Dual a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Dual a) Source #

Variable a => Variable (Product a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Product a) Source #

Variable a => Variable (Sum a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Sum a) Source #

KnownSMTSort t => Variable (Expr t) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Expr t) Source #

Variable a => Variable (Maybe a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Maybe a) Source #

Variable b => Variable (Either a b) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Either a b) Source #

(Variable a, Variable b) => Variable (a, b) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b) Source #

Variable m => Variable (Const m a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m0 => m0 (Const m a) Source #

Variable (f a) => Variable (Alt f a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Alt f a) Source #

(Variable a, Variable b, Variable c) => Variable (a, b, c) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c) Source #

(Variable a, Variable b, Variable c, Variable d) => Variable (a, b, c, d) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c, d) Source #

Variable (f (g a)) => Variable (Compose f g a) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (Compose f g a) Source #

(Variable a, Variable b, Variable c, Variable d, Variable e) => Variable (a, b, c, d, e) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c, d, e) Source #

(Variable a, Variable b, Variable c, Variable d, Variable e, Variable f) => Variable (a, b, c, d, e, f) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c, d, e, f) Source #

(Variable a, Variable b, Variable c, Variable d, Variable e, Variable f, Variable g) => Variable (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c, d, e, f, g) Source #

(Variable a, Variable b, Variable c, Variable d, Variable e, Variable f, Variable g, Variable h) => Variable (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

variable :: MonadSMT s m => m (a, b, c, d, e, f, g, h) Source #

Other functions

variable' :: forall s m a. (MonadSMT s m, Variable a) => Proxy a -> m a Source #

Wrapper for variable which takes a Proxy

Generics

class GVariable f where Source #

Methods

gvariable :: MonadSMT s m => m (f a) Source #

Instances

Instances details
GVariable (U1 :: k -> Type) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

gvariable :: forall s m (a :: k0). MonadSMT s m => m (U1 a) Source #

(GVariable f, GVariable g) => GVariable (f :*: g :: k -> Type) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

gvariable :: forall s m (a :: k0). MonadSMT s m => m ((f :*: g) a) Source #

Variable a => GVariable (K1 i a :: k -> Type) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

gvariable :: forall s m (a0 :: k0). MonadSMT s m => m (K1 i a a0) Source #

GVariable f => GVariable (M1 i c f :: k -> Type) Source # 
Instance details

Defined in Language.Hasmtlib.Variable

Methods

gvariable :: forall s m (a :: k0). MonadSMT s m => m (M1 i c f a) Source #