Quantifiers, typed #
A quantified formula is a Term Bool whatever it binds, and so is its body. There are three
spellings:
mkForall/mkExiststake the bound variables as aBVarslist, asBVars.lambdadoes.forallH/existsHtake the body as a Lean function of the variables. Here each variable's sort comes from the type of its argument, so a quantifier reads like a Lean one:Term.forallH fun (x y : Term Int) => smt! x + y = y + xsmt! ∀ (x y : Int), x + y = y + x, and∃likewise.
A quantifier binds at least one variable: neither spelling accepts none.
Universal quantification of body over bvs.
Equations
- Cvc.Typed.Term.mkForall bvs body _nonEmpty = Cvc.Untyped.Term.mkForall bvs.erase body ⋯
Instances For
Existential quantification of body over bvs.
Equations
- Cvc.Typed.Term.mkExists bvs body _nonEmpty = Cvc.Untyped.Term.mkExists bvs.erase body ⋯
Instances For
Binding through Lean functions #
Binder φ says that φ is the type of a quantifier's body written as a Lean function: one
Term α argument per bound variable, ending in Env (Term Bool). The variable's sort is α's.
There is no instance for a bare Env (Term Bool), so a body binding no variable does not
typecheck.
The arguments' types are what the sorts come from, so they must be known: write
fun (x : Term Int) => … rather than fun x => … when nothing else in the body pins them down.
φ is a quantifier body taking one Term α per bound variable.
Creates one bound variable per argument of
fand appliesfto them.The
i-th variable is namednames[i], orx{i}whennameshas no such element.
Instances
The name of the i-th bound variable: names[i], or x{i} when there is none.
Instances For
Universal quantification of a body written as a Lean function of its variables.
names names the variables in the order the function takes them; a variable without one is
named x{i}, after its position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Existential quantification of a body written as a Lean function of its variables.
names names the variables in the order the function takes them; a variable without one is
named x{i}, after its position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Viewing a quantifier #
The variables' sorts come as a list of Typs, as an application's arguments do, and the body
mentions the variables: walking into it meets them as the aggregate's bvar leaf.
A quantified formula taken apart one level; always of sort Bool.
forall and exists are Lean keywords, hence the primes. The instantiation patterns stay
sort-erased, a pattern mixing sorts.
- forall'
[Ω]
(doms : List Typ)
(vars : Vars doms)
(body : Term Bool)
(patterns : Option Untyped.Term)
: View.Quant Typ.bool
∀ x₁ … xₙ, body, with cvc5's instantiation patterns if it has any. - exists'
[Ω]
(doms : List Typ)
(vars : Vars doms)
(body : Term Bool)
(patterns : Option Untyped.Term)
: View.Quant Typ.bool
∃ x₁ … xₙ, body, with cvc5's instantiation patterns if it has any.
Instances For
Takes a quantified formula apart one level, none for any other term.
Also none when a variable's sort is one no Typ describes.
Equations
- One or more equations did not get rendered due to their size.