Functions and monads for term, term building, SMT etc. helpers and monads #
Type-safe cvc5 terms, input type expected to be IsSrt for most uses.
- No direct constructor exposed publicly, users must go through the
Term.Buildmonadic constructors.
- ofUnsafe :: (
- )
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Sort of some term.
Note that due to strong-typing, this function does not perform any FFI.
Equations
Instances For
Equations
- Cvc.Term.instToString = { toString := Cvc.Term.toSmtString }
Term building #
State of the term builder monad.
- mk' :: (
- manager : cvc5.TermManager
Term manager.
- logic : Logic.Builder
Logic builder, used to track the logic necessary to express the terms actually built.
Updated when building terms.
- )
Instances For
Constructor from a term manager.
Equations
- Cvc.Term.Build.State.ofManager manager logic = { manager := manager, logic := logic }
Instances For
Creates a new term builder state.
Equations
- Cvc.Term.Build.State.mk = (fun (manager : cvc5.TermManager) => Cvc.Term.Build.State.ofManager manager) <$> cvc5.TermManager.new
Instances For
Term-building error-state-monad transformer.
Equations
Instances For
Plain term-building error-state-monad.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Cvc.Term.BuildT.instMonadLiftBuildOfMonad = { monadLift := fun {α : Type} (code : Cvc.Term.Build α) (state : Cvc.Term.Build.State) => pure (code state) }
Equations
- One or more equations did not get rendered due to their size.
Runs term-building code with a specific build state.
Instances For
Runs term-building code, creates an initial build state if none is provided.
Equations
- build.run' (some state) = do let y ← pure state (fun (state : Cvc.Term.Build.State) => build state) y
- build.run' state? = do let y ← liftM Cvc.Term.Build.State.mk (fun (state : Cvc.Term.Build.State) => build state) y
Instances For
Runs term-building code, creates an initial build state if none is provided.
Instances For
Runs term-building code in IO, creates an initial build state if none is provided
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs term-building code in IO, creates an initial build state if none is provided
Equations
- Cvc.Term.runIO build state? = Prod.fst <$> Cvc.Term.runIO' build state?
Instances For
Conversion to unsafe sorts.
- function sorts are flattened:
srt → srt' → srt'' → nonFunSrtbecomes#[srt, srt', srt''] → nonFunSrt
Equations
- srt.toSort = Cvc.Term.managerDoM✝ fun (tm : cvc5.TermManager) => Cvc.Srt.toSort.aux srt tm srt 10000
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cvc.Srt.toSort.aux srt tm srt' 0 = Cvc.throwInternal (toString "[Srt.toSort] maximum depth reached on `" ++ toString srt ++ toString "`")
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.bool maxRec.succ = pure tm.getBooleanSort
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.int maxRec.succ = pure tm.getIntegerSort
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.real maxRec.succ = pure tm.getRealSort
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.regex maxRec.succ = pure tm.getRegExpSort
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.string maxRec.succ = pure tm.getStringSort
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.roundingMode maxRec.succ = pure tm.getRoundingModeSort
- Cvc.Srt.toSort.aux srt tm (Cvc.Srt.finiteField size) maxRec.succ = liftM (tm.mkFiniteFieldSort size)
- Cvc.Srt.toSort.aux srt tm (Cvc.Srt.bitVec size) maxRec.succ = liftM (tm.mkBitVectorSort ↑size)
- Cvc.Srt.toSort.aux srt tm (Cvc.Srt.float exp sig) maxRec.succ = liftM (tm.mkFloatingPointSort exp sig)
- Cvc.Srt.toSort.aux srt tm (Cvc.Srt.uninterpreted name) maxRec.succ = pure (tm.mkUninterpretedSort name)
- Cvc.Srt.toSort.aux srt tm elm.bag maxRec.succ = do let __do_lift ← Cvc.Srt.toSort.aux srt tm elm maxRec liftM (tm.mkBagSort __do_lift)
- Cvc.Srt.toSort.aux srt tm elm.seq maxRec.succ = do let __do_lift ← Cvc.Srt.toSort.aux srt tm elm maxRec liftM (tm.mkSequenceSort __do_lift)
- Cvc.Srt.toSort.aux srt tm elm.set maxRec.succ = do let __do_lift ← Cvc.Srt.toSort.aux srt tm elm maxRec liftM (tm.mkSetSort __do_lift)
- Cvc.Srt.toSort.aux srt tm Cvc.Srt.unit maxRec.succ = liftM (tm.mkTupleSort #[])
- Cvc.Srt.toSort.aux srt tm (Cvc.Srt.abstract _k) maxRec.succ = Cvc.throwInternal (toString "[Srt.toSort] todo `" ++ toString (Cvc.Srt.abstract _k) ++ toString "`")
Instances For
Equations
- Cvc.Srt.toSort.flattenFun srt tm maxRec doms (dom.function cod) = do let dom ← Cvc.Srt.toSort.aux srt tm dom maxRec Cvc.Srt.toSort.flattenFun srt tm maxRec (doms.push dom) cod
- Cvc.Srt.toSort.flattenFun srt tm maxRec doms x✝ = do let __do_lift ← Cvc.Srt.toSort.aux srt tm x✝ maxRec pure (doms, __do_lift)
Instances For
Term creation API #
Builds a constant Boolean term.
Equations
- Cvc.Term.bool b = Cvc.Term.managerDo✝ fun (tm : cvc5.TermManager) => { hasSymbols := false, toUnsafe := tm.mkBoolean b }
Instances For
Retrieves the value of a constant Boolean term.
Equations
Instances For
Retrieves the value of a constant Boolean term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds a constant integer term.
Equations
- Cvc.Term.int i = do Cvc.Term.logicDo✝ Cvc.Logic.Builder.int Cvc.Term.managerDo✝ fun (tm : cvc5.TermManager) => { hasSymbols := false, toUnsafe := tm.mkInteger i }
Instances For
Retrieves the value of a constant integer term.
Equations
Instances For
Retrieves the value of a constant integer term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Retrieves the value of a constant rational/real term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds the Boolean negation of a term.
Equations
- Cvc.Term.mkNot term = Cvc.Term.mk✝ term.hasSymbols cvc5.Kind.NOT #[term.toUnsafe]
Instances For
Builds the Boolean negation of a term.
Equations
Instances For
Builds an if-then-else term.
Equations
- Cvc.Term.ite cnd thn els = Cvc.Term.mk✝ (decide (cnd.hasSymbols = true ∨ thn.hasSymbols = true ∨ els.hasSymbols = true)) cvc5.Kind.ITE #[cnd.toUnsafe, thn.toUnsafe, els.toUnsafe]
Instances For
n-ary operators (2 ≤ n) #
Builds a conjunction term.
Equations
- Cvc.Term.mkAnd terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.AND (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a disjunction term.
Equations
- Cvc.Term.mkOr terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.OR (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds an exclusive-disjunction term.
Equations
- Cvc.Term.mkXor terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.XOR (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a disjunction term.
Equations
- Cvc.Term.mkImplies terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.IMPLIES (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds an equality term.
Equations
- Cvc.Term.mkEqual terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.EQUAL (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a pairwise-distinct term.
Equations
- Cvc.Term.mkDistinct terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.DISTINCT (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a pairwise-distinct term.
Equations
Instances For
Builds a pairwise-distinct term.
Equations
Instances For
Builds a less-than term.
Equations
- Cvc.Term.mkLt terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.LT (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a less-than-or-equal-to term.
Equations
- Cvc.Term.mkLe terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.LEQ (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a greater-than-or-equal-to term.
Equations
- Cvc.Term.mkGe terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.GEQ (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a greater-than term.
Equations
- Cvc.Term.mkGt terms h_size = Cvc.Term.mk✝ (terms.any Cvc.Term.hasSymbols) cvc5.Kind.GT (Array.map Cvc.Term.toUnsafe terms)
Instances For
Arithmetic #
Builds an addition term.
- Forbids difference logics.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds an addition term.
- Forbids difference logics.
Equations
- lft.add rgt Arith = Cvc.Term.mkAdd #[lft, rgt] ⋯ inferInstance
Instances For
Builds a subtraction term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Builds a subtraction term.
Equations
- lft.sub rgt Arith = Cvc.Term.mkSub #[lft, rgt] ⋯ inferInstance
Instances For
Equations
- term.neg Arith = Cvc.Term.mk✝ term.hasSymbols cvc5.Kind.NEG #[term.toUnsafe]
Instances For
Builds a multiplication term.
- Forbids difference logic.
- Forces non-linear logic if non-linear.
Equations
- Cvc.Term.mkMul terms h_size Arith = do Cvc.Term.nonDiff✝ let hasSymbols ← Cvc.Term.checkNonLinearOfArgs✝ terms Cvc.Term.mk✝ hasSymbols cvc5.Kind.MULT (Array.map Cvc.Term.toUnsafe terms)
Instances For
Builds a multiplication term.
- Forbids difference logic.
- Forces non-linear logic if non-linear.
Equations
- lft.mul rgt Arith = Cvc.Term.mkMul #[lft, rgt] ⋯ inferInstance
Instances For
Arithmetic division with division by 0 undefined, left associative.
- Forbids difference logic.
- Forces non-linear logic if non-linear.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Arithmetic division with division by 0 undefined, left associative.
- Forbids difference logic.
- Forces non-linear logic if non-linear.
Equations
- lft.div! rgt Arith = Cvc.Term.mkDiv! #[lft, rgt] ⋯ inferInstance
Instances For
Arithmetic division with division by 0 defined to be 0, left associative.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Arithmetic division with division by 0 defined to be 0, left associative.
Equations
- lft.divTotal rgt Arith = lft.mkDivTotal rgt inferInstance
Instances For
Function application #
Applies a function term to an argument.
Partial applications and higher-order #
This function supports partial applications: they are encoded as cvc5.Kind.HO_APPLY terms, which
would trigger errors if used in a solver without support for higher-order. Since support for
higher-order makes cvc5-level reasoning much more expensive, we want to avoid having HO_APPLY
terms as much as possible.
For this reason, this function detects when it is building an application that yields a non-function term; in this case, it will destruct the underlying higher-order terms (recursively, and if any) and rewrite them as a regular (first-order) function application.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Cvc.Value.instToString = { toString := Cvc.Value.toString }
Boolean values.
Equations
Instances For
Integer values.
Equations
Instances For
String values.
Equations
Instances For
Array values.
Equations
- Cvc.Value.Array α β = Cvc.Value (Cvc.TMap α β)
Instances For
Equations
Instances For
Equations
- Cvc.Value.boolVal value = value.toTerm.boolVal
Instances For
Equations
- Cvc.Value.intVal value = value.toTerm.intVal
Instances For
Equations
- Cvc.Value.ratVal value = value.toTerm.ratVal
Instances For
Instances For
Equations
- Cvc.Conv.ValueToVal.mk Val ofValue = { toIsSrt := inst✝, Val := Val, ofValue := ofValue }
Instances For
Instances For
Equations
- Cvc.Conv.ValueToVal.instCoeSortType = { coe := fun (conv : Cvc.Conv.ValueToVal m α) => Cvc.Conv.ValueToVal.Val m α }
Equations
- Cvc.Conv.ValueToVal.adaptM lift = { toIsSrt := A.toIsSrt m, Val := Cvc.Conv.ValueToVal.Val m α, ofValue := lift ∘ Cvc.Conv.ValueToVal.ofValue }
Instances For
Equations
- Cvc.Conv.ValueToVal.liftM = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => liftM
Instances For
Equations
Equations
- Cvc.Conv.ValueToVal.defaultInstBool = Cvc.Conv.ValueToVal.mk Bool fun (v : Cvc.Value Bool) => v.boolVal
Equations
- Cvc.Conv.ValueToVal.defaultInstInt = Cvc.Conv.ValueToVal.mk Int fun (v : Cvc.Value Int) => v.intVal
Equations
- Cvc.Conv.ValueToVal.defaultInstRat = Cvc.Conv.ValueToVal.mk Rat fun (t : Cvc.Value Rat) => t.ratVal
Equations
- Cvc.Conv.ValueToVal.defaultFor (Cvc.Srt.abstract _kind) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor (_idx.array _elm) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor _elm.bag = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.bool = Cvc.Conv.ValueToVal.defaultInstBool
- Cvc.Conv.ValueToVal.defaultFor (Cvc.Srt.bitVec _n) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor (Cvc.Srt.finiteField _n) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor (Cvc.Srt.float _exp _sig) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor (_dom.function _cod) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.int = Cvc.Conv.ValueToVal.defaultInstInt
- Cvc.Conv.ValueToVal.defaultFor (_lft.prod _rgt) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.real = Cvc.Conv.ValueToVal.defaultInstRat
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.regex = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.roundingMode = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor _elm.seq = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor _elm.set = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.string = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor Cvc.Srt.unit = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
- Cvc.Conv.ValueToVal.defaultFor (Cvc.Srt.uninterpreted name) = Cvc.Conv.ValueToVal.adaptM fun {β : Type} => Cvc.Res.ok
Instances For
Equations
Instances For
- instValueToVal (srt : Srt) : ValueToVal m srt.toType
Instances
Equations
- Cvc.Conv.ValuesToVal.Values = { instValueToVal := fun (x : Cvc.Srt) => Cvc.Conv.ValueToVal.Id x.toType }
Instances For
Equations
- Cvc.Conv.ValuesToVal.Default = { instValueToVal := Cvc.Conv.ValueToVal.defaultFor }
Instances For
Conversion of term-values #
Instances For
- build (srt : Srt) : Term srt.toType → Srt.ToValType.Val srt
Instances
Equations
- Cvc.Term.ToVals.Terms = { toValConv := Cvc.Srt.ToValType.Terms, build := fun (x : Cvc.Srt) => id }
Instances For
- solver : cvc5.Solver
- builder : Term.Build.State
- nextActlitIdx' : Nat
Instances For
Equations
- Cvc.Smt.instMonadLiftSmtTOfMonad = { monadLift := fun {α : Type} (code : Cvc.SmtT m α) (state : Cvc.Smt.State) => do let __do_lift ← liftM (code state) pure __do_lift }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sets an option in the solver.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Asserts a formula.
Equations
- Cvc.Smt.assert formula = Cvc.Smt.lift5✝ (cvc5.Solver.assertFormula formula.toUnsafe)
Instances For
Checks the satisfiability of the formulas asserted with Smt.assert.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simplified Smt.checkSat, returns true/false for sat/unsat, none for unknown/unexpected.
Equations
- Cvc.Smt.checkSat? assuming = Cvc.CheckSat.isSat? <$> Cvc.Smt.checkSat assuming
Instances For
Sat-mode state.
Instances For
Unsat-mode state.
Instances For
Unknown-mode state.
Instances For
Sat-mode monad, allows running commands such as get-value.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Sat-mode monad, allows running commands such as get-value.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Equations
- Cvc.Smt.Sat.unexpected = Cvc.throwUser "unexpected sat result"
Instances For
Unsat-mode monad, allows running commands such as get-proof.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Unsat-mode monad, allows running commands such as get-proof.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Equations
- Cvc.Smt.Unsat.unexpected = Cvc.throwUser "unexpected unsat result"
Instances For
Unknown-mode monad, allows running unknown-mode-specific commands.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Unknown-mode monad, allows running unknown-mode-specific commands.
Smt does not lift to this monad as this would allow issuing a check-sat that could switch to a
different solver mode.
Equations
Instances For
Equations
- Cvc.Smt.Unknown.unexpected = Cvc.throwUser "unexpected unknown result"
Instances For
Performs a check-sat and runs sat/unsat/unknown-specific code.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Cvc.Smt.Sat.instMonadLiftSatTOfMonad = { monadLift := fun {α : Type} (code : Cvc.Smt.Sat α) (state : Cvc.Smt.Sat.State) => pure (code state) }
Equations
- One or more equations did not get rendered due to their size.
Retrieves the value of a term in Sat mode.
This function is available the following namespaces: Cvc.Term, Cvc.Smt, and Cvc.Smt.Sat.
Equations
- Cvc.Smt.getValue term = do let term! ← Cvc.Smt.Sat.lift5✝ (cvc5.Solver.getValue term.toUnsafe) pure { toTerm := { hasSymbols := false, toUnsafe := term! } }
Instances For
Retrieves the values of some terms of the same sort in Sat mode.
This function is available the following namespaces: Cvc.Term, Cvc.Smt, and Cvc.Smt.Sat.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Retrieves the concrete Value of a term in Sat mode.
Equations
- Cvc.Smt.getValUsing Val term = Cvc.Smt.getValue term >>= liftM ∘ Cvc.Conv.ValueToVal.ofValue
Instances For
Retrieves the concrete Value of a term in Sat mode.
Equations
- Cvc.Smt.getVal term = Cvc.Smt.getValUsing Val term
Instances For
Retrieves the concrete values of some terms of the same sort in Sat mode.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Retrieves the concrete values of some terms of the same sort in Sat mode.
Equations
- Cvc.Smt.getVals terms = Cvc.Smt.getValsUsing Val terms
Instances For
Equations
- Cvc.Smt.Unsat.instMonadLiftUnsatTOfMonad = { monadLift := fun {α : Type} (code : Cvc.Smt.Unsat α) (state : Cvc.Smt.Unsat.State) => pure (code state) }
Equations
- One or more equations did not get rendered due to their size.
Retrieves the unsat-proofs in Unsat mode.
Instances For
Equations
- Cvc.Smt.Unknown.instMonadLiftUnknownTOfMonad = { monadLift := fun {α : Type} (code : Cvc.Smt.Unknown α) (state : Cvc.Smt.Unknown.State) => pure (code state) }
Equations
- One or more equations did not get rendered due to their size.
Returns the symbol of a symbol-term.
Equations
- term.getSymbol? = term.toUnsafe.getSymbol?
Instances For
Equations
- Cvc.SmtT.runIO smt state? = Prod.fst <$> Cvc.SmtT.runIO' smt state?
Instances For
Equations
- smt.runWithBuilder builder = Except.map Prod.fst <$> smt.runWithBuilder' builder