Removes an occurrence of type abbreviation in type expression t
Equations
- Blaster.Smt.removeTypeAbbrev te = Blaster.Smt.removeTypeAbbrev.visit te fun (e : Lean.Expr) => pure e
Instances For
Generate an smt symbol from a given Name.
Equations
Instances For
Generate a smt symbol for a free variable id corresponding to a sort name (e.g., α : Type) s.t.:
- return smt symbol
"@" ++ v.getUserName ++ v.namewhenuniqueis set totrue - return smt symbol
"@" ++ v.getUserNameotherwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generate an smt symbol from a given inductive type name.
Equations
- Blaster.Smt.indNameToSmtSymbol indName = Blaster.Smt.mkNormalSymbol (toString "@" ++ toString indName.toString)
Instances For
Return some b if e := mkAnnotation __solver.ctorSelector b'`.
Equations
- Blaster.Smt.toTaggedCtorSelector? (Lean.Expr.mdata d b) = if (Lean.KVMap.size d == 1 && Lean.KVMap.getBool d `_solver.ctorSelector) = true then some b else none
- Blaster.Smt.toTaggedCtorSelector? e = none
Instances For
Return true if e := mkAnnotation _solver.ctorSelector b'`.
Equations
- Blaster.Smt.isTaggedCtorSelector (Lean.Expr.mdata d b) = (Lean.KVMap.size d == 1 && Lean.KVMap.getBool d `_solver.ctorSelector)
- Blaster.Smt.isTaggedCtorSelector e = false
Instances For
Given ctor a constructor name and idx corresponding to
the index for one of the ctor's effective parameters,
create the ctor selector symbol ctor.idx
Equations
- Blaster.Smt.mkCtorSelectorSymbol ctor idx = Blaster.Smt.mkNormalSymbol (toString ctor ++ toString "." ++ toString idx)
Instances For
Given ctor a constructor name and idx corresponding to the index for
one of the ctor's arguments and arg the current ctor arg and t its corresponding type,
perform the following:
- add
{ctor}.idx := ← getFunEnvInfo argtofunCtorCachewhenisFunType t - create expression
ctor.idx xand tag it as a ctor selector. - create the corresponding smt term
- return both as result The tag is used during translation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given ctor a constructor name and an smt term s,
create the smt term application is-ctor s.
Equations
- Blaster.Smt.mkCtorTestorTerm ctor s = Blaster.Smt.mkSimpleSmtAppN (Blaster.Smt.mkNormalSymbol (toString "is-" ++ toString ctor)) #[s]
Instances For
Given ctor a constructor name, create the smt term is-ctor x.
Equations
Instances For
Return s when nbArity := s exists in arrowTypeArities. Otherwise,
perform the following:
- let s :=
@@ArrowT{nbArity} - Add entry
nbArity := sin arrowTypeArities - declare sort
(declare-sort s nbArity) - return
s
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define smt universal sort @@Type and its corresponding predicate qualified
whenever flag typeUniverse is not set.
Do nothing otherwise.
Assume isTypeSym := @isType
Equations
- One or more equations did not get rendered due to their size.
Instances For
Update sort cache with v.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return vstrₙ when entry v := vstrₙ exists in sortCache,
otherwise, perform the following:
vstr := "@" ++ v.getUserName ++ v.name.- add
define-sort "vstr" () @@Typeto the Smt context - add entry
v := vstrtosortCache - return vstr
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add an inductive datatype name to the visited inductive datatype cache.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true when indName is already in the visited inductive
datatype cache (i.e., indTypeCache)
Equations
- Blaster.Smt.isVisitedIndName indName = do let __do_lift ← get pure (__do_lift.smtEnv.indTypeVisited.contains indName)
Instances For
Given d corresponding to a inductive datatype name expression,
or an instantiated polymorphic inductive datatype, or a function instance declaration and
n a unique smt identifier generated for d and
instSort the instantiated Smt sort for d, perform the following:
- add entry
d := {instName := "@is{n}", instSort, applyInstName}inindTypeInstCache - return {instName := "@is{n}", instSort, applyInstName}
with applyInstName set to none for inductive datatype and set to some @apply{uniq_xxx}.
See function generateFunInstDeclAux.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Same as updateIndInstCacheAux but return value is discarded.
Equations
- Blaster.Smt.updateIndInstCache d n instSort = discard (Blaster.Smt.updateIndInstCacheAux d n instSort)
Instances For
Return true if v is tagged as a top level free variable.
Equations
Instances For
Perform the following:
- add
vtoquantifierFvarscache - add
vtotopLevelVarsonly when topLevel is set totrueand¬ isType (← inferTypeEnv (mkFVar v)).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true if v is in the quantified fvars cache.
Equations
- Blaster.Smt.isInQuantifiedFVarsCache v = do let __do_lift ← get pure (__do_lift.smtEnv.quantifiedFVars.contains v)
Instances For
Return true when an entry exists for v in inPatternMatching.
Equations
- Blaster.Smt.isPatternMatchFVar v = do let __do_lift ← get pure (__do_lift.smtEnv.options.inPatternMatching.contains v)
Instances For
Return an Smt Array sort when args.size > 1. Otherwise return args[0]!. An error is triggered when args.size < 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given n corresponding to the name of an inductive datatype, and x₀ ... xₖ the parameters instantiating
the inductive datatype, perform the following actions:
- When k > 0:
let A := [x₀, ..., xₖ]
let B := [typeTranslator A[i] | i ∈ [0..k] ∧ ¬ isClassConstraintExpr (← inferTypeEnv A[i])]
- return
ParamSort (indNameToSmtSymbol n) B
- return
- When k = 0:
- return
SymbolSort indNameToSmtSymbol n)
- return
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given arguments x₀ ... xₙ perform the following:
let A := [x₀, ..., xₙ]
let V := {α | i ∈ [0..n] ∧ α ∈ getFVarsInExpr A[i] ∧ isGenericParam A[i]}
return [α | α ∈ V]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an inductive datatype instance t x₀ ... xₙ, perform the following:
- When
∀ i ∈ [0..n], ¬ isGenericParam xᵢ,- return
t x₀ ... xₙ
- return
- When
∃ i ∈ [0..n], isGenericParam xᵢ, let A := [x₀, ..., xₙ] let V := [α | i ∈ [0..n] ∧ α ∈ getFVarsInExpr A[i] ∧ isGenericParam A[i] ] let [b₀ ... bₘ ] := V- return
λ b₀ → .. → bₘ → t x₀ ... xₙ
- return
Equations
- Blaster.Smt.getIndInst t args = do let genericArgs ← Blaster.Smt.retrieveGenericArgs args have auxApp : Lean.Expr := Lean.mkAppN t args liftM (Lean.Meta.mkLambdaFVars genericArgs auxApp true)
Instances For
Given t := ∀ α₀ → ∀ α₁ ... → αₙ returns #[α₀, α₁ ..., αₙ].
Assumes that t no more contains any class constraints (see function removeClassConstraintsInFunType).
Instances For
Equations
- Blaster.Smt.retrieveArrowTypes.visit (Lean.Expr.forallE binderName t b binderInfo) arrowTypes = Blaster.Smt.retrieveArrowTypes.visit b (arrowTypes.push t)
- Blaster.Smt.retrieveArrowTypes.visit e arrowTypes = arrowTypes.push e
Instances For
Given t := ∀ α₀ → ∀ α₁ ... → αₙ, perform the following:
- let A := [αᵢ | i ∈ [0..n-1], isClassConstraintExpr αᵢ]
- let [α'₀ ... α'ₚ] := A
- return ∀ α'₀ → α'₁ → ... → α'ₚ → αₙ`
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given t := Expr.const n _ corresponding to an inductive datatype name and
args the parameters instantiating the inductive datatype (if any),
perform the following actions:
- When args.size > 0:
- instName := nameToSmtSymbol (n ++ (← mkFreshId)) (i.e., generate a unique name for instance)
- instSort ← generateInstType n args typeTranslator
- instApp ← getIndInst t args
- add entry
instApp := {@is{instName}, instSort}toindTypeInstCache - When declarePredicate:
- When
assertFlag := some b:- define smt predicate
(define-fun @is{instName} ((@x instSort)) Bool b)
- define smt predicate
- Otherwise:
- declare smt predicate
(declare-fun @is{instName} ((instSort)) Bool)
- declare smt predicate
- When
- return {instName, instSort}
- When args.size = 0:
- instName := nameToSmtSymbol n
- instSort ← generateInstType n args typeTranslator
- add entry
t := {@is{instName}, instSort}toindTypeInstCache - When declarePredicate:
- When
assertFlag := some b:- define smt predicate
(define-fun @is{instName} ((@x instSort)) Bool b)
- define smt predicate
- Otherwise:
- declare smt predicate
(declare-fun @is{instName} ((instSort)) Bool)
- declare smt predicate
- When
- return
{instName, instSort}Assumes thattcorresponds to the name of an inductive datatype.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given t := ∀ α₀ → ∀ α₁ ... → αₙ, perform the following:
Let A := [αᵢ | i ∈ [0..n-1]]
- When
∀ i ∈ [0..n], ¬ isGenericParam A[i],- return
t
- return
- When
∃ i ∈ [0..n], isGenericParam A[i], let V := {v | i ∈ [0..n] ∧ v ∈ getFVarsInExpr A[i] ∧ isGenericParam A[i]} let B := [v | v ∈ V] ++ [A[i] | i ∈ [0..n] ∧ isGenericParam A[i]] let [b₀ ... bₘ ] := B let [α'₀ ... α'ₚ] := A- return
λ b₀ → .. → bₘ → ∀ α'₀ → α'₁ → ... → α'ₚ → αₙAssumes thattdoes not have any implicit types (i.e., removeClassConstraintsInFunType called)
- return
Equations
- Blaster.Smt.getFunInstDeclAux t = do let genericArgs ← Blaster.Smt.retrieveGenericArgs (Blaster.Smt.retrieveArrowTypes t) liftM (Blaster.Optimize.mkLambdaFVars' genericArgs t)
Instances For
Same as getFunInstDeclAux but calls removeClassConstraintsInFunType on t` first.
Equations
Instances For
Given t := ∀ α₀ → ∀ α₁ ... → αₙ, execute k t', with t' obtained as follows:
- let [α'₀ ... α'ₚ] := [αᵢ | i ∈ [0..n-1], isExplicit αᵢ]
- t' := ∀ α'₀ → α'₁ → ... → α'ₚ → αₙ`
- with free variables created for implicit arguments.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return decl.instName when t := decl exists in indTypeInstCache.
Otherwise none.
TODO: UPDATE
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Return n only when entry t := decl exists in indTypeInstCache and
decl.applyInstName := some n.
An error is triggered when:
- no entry exist for
t - decl.applyInstName is set to
none.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given st an smt term and t its corresponding type expression, perform the following:
- retrieve predicate qualifier name
instNamefort - return smt application (instName v)
An error is triggered if the predicate qualifier name for
tdoes not exists. Assume that there is no type abbreviation int, i.e., call toremoveTypeAbbrevhas been applied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Same as createPredQualifierAppAux but accepts an SmtSymbol as argument.
Equations
Instances For
Given t := α₁ → α₂ ... → αₙ and st its corresponding smt representation (i.e., ArrowTN sα₁ sα₂ sαₙ),
perform the following action:
- let funInst ← getFunInstDecl t
- When funInst := {@is{instName}, st, applyInstName} ∈ indTypeInstCache
- return
{@is{instName}, st, applyInstName}
- return
- Otherwise:
- let n ← mkFreshId
- instName ← (Fun ++ n) (i.e., generate a unique name for function instance)
- add entry
t := {@is{instName}, st, applyInstName := some @apply{n}}toindTypeInstCache - declare smt predicate
(declare-fun @is{instName} ((instSort)) Bool) - declare apply function
(declare-fun @apply{n} (st sα₁ ... sαₙ₋₁) sαₙ) - assert the following propositions to specify congruence, extensionality and codomain values constraints:
(assert (forall ((@f (ArrowTN sα₁ sα₂ sαₙ))(@x₁ sα₁) ... (@xₙ₋₁ sαₙ₋₁) (@y₁ sα₁) ... (@yₙ₋₁ sαₙ₋₁)) (! (=> (= @x₁ @y₁) (=> (= @x₂ @y₂) ... (=> (= @xₙ₋₁ @yₙ₋₁) (= (@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @f @y₁ ... @yₙ₋₁))))) :pattern ((@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @f @y₁ ... @yₙ₋₁) (= @x₁ @y₁) ... (= @xₙ₋₁ @yₙ₋₁)) :qid @apply{n}_congr_args)))(assert (forall ((@f (ArrowTN sα₁ sα₂ sαₙ)) (@g (ArrowTN sα₁ sα₂ sαₙ)) (@x₁ sα₁) ... (@xₙ₋₁ sαₙ₋₁)) (! (=> (= @f @g) (= (@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @g @x₁ ... @xₙ₋₁))) :pattern ((@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @g @x₁ ... @xₙ₋₁) (= @f @g)) :qid @apply{n}_congr_fun)))(assert (forall ((@f (ArrowTN sα₁ sα₂ sαₙ)) (@g (ArrowTN sα₁ sα₂ sαₙ)) (@x₁ sα₁) ... (@xₙ₋₁ sαₙ₋₁)) (! (=> (= (@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @g @x₁ ... @xₙ₋₁)) (= @f @g)) :pattern (= (@apply{n} @f @x₁ ... @xₙ₋₁) (@apply{n} @g @x₁ ... @xₙ₋₁))) :qid @apply{n}_ext_fun)))(assert (forall ((@f (ArrowTN sα₁ sα₂ ... αₙ))) (! (= (forall ((@x₁ sα₁) ... (@xₙ₋₁ sαₙ₋₁)) (@isTypeₙ (@apply{n} @f @x₁ ... @xₙ₋₁))) (@is{instName} @f) ) :pattern ( (@is{instName} @f)) :qid @isFun{v}_cstr)))with ∀ i ∈ [1..n] = s
- return
{@is{instName}, st}
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Blaster.Smt.generateFunInstDeclAux.removeOutParam ((Lean.Expr.const `outParam us).app e) = e
- Blaster.Smt.generateFunInstDeclAux.removeOutParam x✝ = x✝
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given t := Expr.sort _ perform the following actions only when
no entry for t exists in indTypeInstCache:
When
t := Expr.sort .zero- add entry
t := {@isProp, propSort} toindTypeInstCache` - define smt sort
(define-sort Prop () Bool) - declare smt function
(declare-fun @isProp ((Prop)) Bool)withtrueassertion
- add entry
When
isType t- add entry
t := {@isType, typeSort} toindTypeInstCache` - Define smt univseral sort @@Type when flag
typeUniverse is not set (see functiondeclareTypeSort`)
- add entry
An error is triggered when t is not the expected sort type.
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Smt.generateSortInstDecl t = Blaster.Optimize.throwEnvError (Lean.toMessageData "generateSortInstDecl: sort type expected but got " ++ Lean.toMessageData (reprStr t))
Instances For
TODO: UPDATE SPEC
Equations
- One or more equations did not get rendered due to their size.
Instances For
Options for translateType.
- inTypeDefinition : Bool
flag set to
trueonly when translating an inductive datatype so as not to generate predicate qualifier for generic types used in ctor parameters. - genericParamFun : Bool
flag set to true only when translating type of function arguments so as to use universal sort @@Type when function are still polymorphic after instantiation.
Instances For
Equations
Instances For
type options to be used when translating inductive datatype.
Equations
- Blaster.Smt.optionsForInductiveType = { inTypeDefinition := true }
Instances For
type options to be used when generating predicate qualifiers.
Equations
- Blaster.Smt.optionsForPredicateQualifier = { genericParamFun := true }
Instances For
Same as optionsForPredicateQualifier.
Equations
- Blaster.Smt.optionsForFunLambdaParam = { genericParamFun := true }
Instances For
TODO: UPDATE SPEC
Given indValStart an inductive value info for an inductive datatype,
update the inductive datatype declaration indTypeMap.
Intuitively, for the non-mutual inductive List,
inductive List (α : Type u) where
| nil : List α
| cons (head : α) (tail : List α) : List α
The following entry will be added. `List := [{ indName := List, numParams := 1, hasProp := false ctors := [ { ctorName := nil, nbFields := 0, hasProp := false, propIndices := [], rhs := λ α : Type u → nil }, { ctorName := cons, nbFields := 2, hasProp := false, propIndices := [], rhs := λ α : Type u → λ head : α → λ tail : List α → cons head tail } ]
As for the following mutual inductive declaration, mutual inductive Attribute (α : Type u) where | Named (n : String) | Pattern (p : List (Term α)) | Qid (n : String)
inductive Term (α : Type u) where
| Ident (s : String)
| App (nm : String) (args : List (Term α))
| Annotated (t : Term α) (annot : List (Attribute α))
end
The following entries will be added:
Attribute := declsTerm := declswith decls := [{ indName := Attribute, numParams := 1, hasProp := false, ctors := [ { ctorName := Named, nbFields := 1, hasProp := false, propIndices := [], rhs := λ α : Type u → λ n : String → Named n }, { ctorName := Pattern, nbFields := 1, hasProp := false, propIndices := [], rhs := λ α : Type u → λ p : List (Term α) → Pattern p } { ctorName := Qid, nbFields := 1, hasProp := false, propIndices := [], rhs := λ α : Type u → λ n : String → Qid n } ] }, { indName := Term, numParams := 1, hasProp := false, ctors := [ { ctorName := Named, nbFields := 1, hasProp := false, propIndices := [], rhs := λ α : Type u → λ s : String → Ident s }, { ctorName := App, nbFields := 2, hasProp := false, propIndices := [], rhs := λ α : Type u → λ nm : String → λ args : List (Term α) → App nm args }, { ctorName := Annotated, nbFields := 2, hasProp := false, propIndices := [], rhs := λ α : Type u → λ t : Term α → λ annot : List (Attribute α) → Annotated nm args } ] } ]
Note that optimizer is called on each constructor rhs to apply proper formalization
when at least one of the arguments is a proposition.
An error is triggered when:
- ∀ n ∈ indValStart.all
- no inductive info is found for
n; - no recursive info is found for
n; - no recursor rule is found for at least one constructor for
n.
- no inductive info is found for
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an instantiated inductive data type t x₁ ... xₙ, generate it's corresponding
predicate qualifier predicate and propositional assertions when instance is not already
in indTypeInstCache. In particular,
- let instApp ← getIndInst t #[x₁, ..., xₙ]
- When instApp := {instName, instSort} ∈ indTypeInstCache
- return ()
- Otherwise:
- let {instName, instSort} ← generateIndInstDecl t args typeTranslator
- When `∀ c ∈ Ctors(t), c = C (i.e., nullary constructors)
- declare smt predicate (declare-fun @is{instName} ((instSort)) Bool)`
- Otherwise:
- declare smt predicate (declare-fun @is{instName} ((instSort)) Bool)`
- For each c ∈ Ctors(t),
- When c = C (i.e., nullary constructor) don't generate any assertion
- When c = C p₁ ... pₙ, generate assertion
(assert (forall ((@x instSort)) (! (=> (@is{instName} @x) (=> is-C @x (and predTermᵢ ... predTermₙ))) :pattern ((@is{instName} @x) (is-C @x)))))with ∀ i ∈ [1..n], (isProp pᵢ → predTermᵢ =(= (C.i @x) (← termTranslator (← optimizeExpr pᵢ)))) ∧ (¬ isProp pᵢ → predTermᵢ =(isTypeᵢ (C.i @x))) TODO: UPDATE SPEC
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Blaster.Smt.defineInstPredicateQualifier.updatePredTerm prevTerm newTerm = if Blaster.Smt.isTrueSmt prevTerm = true then newTerm else Blaster.Smt.andSmt prevTerm newTerm
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
TODO: UPDATE SPEC.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given n a name expression for which a corresponding smt sort exists (e.g., Bool, Int, String),
s its corresponding Smt symbol and t its corresponding Smt sort,
perform the following actions:
- When entry
n := sexists inindTypeInstCache- return
t
- return
- Otherwise:
- add entry
n := sinindTypeInstCache - define smt predicate
(define-fun @is{s} ((@x s)) Bool true) - return
t
- add entry
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform the following actions:
- When entry
n := "Nat"exists inindTypeInstCachereturn #[natSort] - Otherwise:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform the following actions:
- When entry
n := "Empty"exists inindTypeInstCache- return
emptySort
- return
- Otherwise:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Perform the following actions:
- When entry
n := "PEmpty"exists inindTypeInstCache- return
pemptySort
- return
- Otherwise:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Translate opaque sorts to their Smt counterpart.
An error is triggered when e does not correspond to a name expression.
TODO: update function when opacifying other Lean inductive types (e.g., BitVector, Char, etc).
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Smt.translateOpaqueType (Lean.Expr.const `Bool us) = do let a ← Blaster.Smt.translateSmtEquivType (Lean.Expr.const `Bool us) Blaster.Smt.boolSymbol Blaster.Smt.boolSort pure (some a)
- Blaster.Smt.translateOpaqueType (Lean.Expr.const `Empty us) = do let a ← Blaster.Smt.translateEmptyType (Lean.Expr.const `Empty us) pure (some a)
- Blaster.Smt.translateOpaqueType (Lean.Expr.const `Int us) = do let a ← Blaster.Smt.translateSmtEquivType (Lean.Expr.const `Int us) Blaster.Smt.intSymbol Blaster.Smt.intSort pure (some a)
- Blaster.Smt.translateOpaqueType (Lean.Expr.const `Nat us) = do let a ← Blaster.Smt.translateNatType (Lean.Expr.const `Nat us) pure (some a)
- Blaster.Smt.translateOpaqueType (Lean.Expr.const `PEmpty us) = do let a ← Blaster.Smt.translatePEmptyType (Lean.Expr.const `PEmpty us) pure (some a)
- Blaster.Smt.translateOpaqueType (Lean.Expr.const n us) = pure none
- Blaster.Smt.translateOpaqueType e = Blaster.Optimize.throwEnvError (Lean.toMessageData "translateOpaqueType: name expression expected but got " ++ Lean.toMessageData (reprStr e))
Instances For
TODO: UPDATE SPEC
TODO: UPDATE SPEC
Equations
- Blaster.Smt.translateType termTranslator t topts = do let __do_lift ← Blaster.Smt.removeTypeAbbrev t Blaster.Smt.translateTypeAux termTranslator __do_lift topts
Instances For
- quantifiers : SortedVars
- topLevel : Bool
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Translate a quantifier (n : t) by performing the following actions:
- Add
nto the quantified fvars cache. - When isType t, e.g., (α : Type or α : Sort u)
- Call
defineSortAndCache nto declare an Smt sort and return quantified arrayqtsunchanged
- Call
- When ¬ isType t:
- translate n to an Smt symbol
s - translate t to a Smt type
st - When toplevel flag is set:
- Call
declareConst s stto declare a free Smt scalar variable whenst := α(i.e., scalar type). - Call
declareFun s #[α₁ ... αₙ] βto declare an uninterpreted Smt function whenst := α₁ → ... → αₙ → β.
- Call
- When toplevel flag is not set:
- Add (s : st) to quantifier array
qtswhenst := α(i.e., scalar type) - Add (s : Array α₁ ... αₙ β) to quantifier array
qtswhenst := α₁ → ... → αₙ → β.
- Add (s : st) to quantifier array
- translate n to an Smt symbol
Assume that t is not a proposition (i.e., !(← isPropEnv t)) nor a class constraint.
An error is triggered if n is not an fvar expression.
TODO: UPDATE SPEC
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
TODO: UPDATE SPEC
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Blaster.Smt.translateForAll.updatePremises p = modify fun (env : Blaster.Smt.QuantifierEnv) => { quantifiers := env.quantifiers, premises := env.premises.push p, topLevel := env.topLevel }
Instances For
Translate free variable expression f := Expr.fvar v to an Smt term such that:
- When
v ∈ (← get).smtEnv.quantifiedFVars:- return `fvarIdToSmtTerm v
- When
v ∉ (← get).smtEnv.quantifiedFVars:- add
vto the quantified fvars cache - Let t' ← removeTypeAbbrev (← inferTypeEnv f)
- smtType ← translateType optimize termTranslator t'
- smtSym ← fvarIdToSmtSymbol v
- declare smt symbol at top level, i.e.,
(declare-const smtSym smtType) - pTerm ← createPredQualifierApp smtSym t'
- assert pTerm at smt level, i.e.,
(assert pTerm) - return
smtSimpleVarId smtSymAn error is triggered when fis not anfvarexpression; orfhas a sort type
- add
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Smt.translateFreeVar f termTranslator = Blaster.Optimize.throwEnvError (Lean.toMessageData "translateFreeVar: FVarExpr expected but got " ++ Lean.toMessageData (reprStr f))