@[inline]
Equations
- Lean.Expr.const? e = match e with | Lean.Expr.const n us => some (n, us) | x => none
@[inline]
Equations
- Lean.Expr.app1? e fName = if Lean.Expr.isAppOfArity e fName 1 = true then some (Lean.Expr.appArg! e) else none
@[inline]
Equations
- Lean.Expr.app2? e fName = if Lean.Expr.isAppOfArity e fName 2 = true then some (Lean.Expr.appArg! (Lean.Expr.appFn! e), Lean.Expr.appArg! e) else none
@[inline]
Equations
- Lean.Expr.eq? p = Lean.Expr.app3? p (Lean.Name.mkStr1 "Eq")
@[inline]
Equations
- Lean.Expr.ne? p = Lean.Expr.app3? p (Lean.Name.mkStr1 "Ne")
@[inline]
Equations
- Lean.Expr.iff? p = Lean.Expr.app2? p (Lean.Name.mkStr1 "Iff")
@[inline]
Equations
- Lean.Expr.not? p = Lean.Expr.app1? p (Lean.Name.mkStr1 "Not")
@[inline]
Equations
- Lean.Expr.notNot? p = match Lean.Expr.not? p with | some p => Lean.Expr.not? p | none => none
@[inline]
Equations
- Lean.Expr.and? p = Lean.Expr.app2? p (Lean.Name.mkStr1 "And")
@[inline]
Equations
- Lean.Expr.heq? p = Lean.Expr.app4? p (Lean.Name.mkStr1 "HEq")
Equations
- Lean.Expr.natAdd? e = Lean.Expr.app2? e (Lean.Name.mkStr2 "Nat" "add")
@[inline]
Equations
- Lean.Expr.arrow? _fun_discr = match _fun_discr with | Lean.Expr.forallE binderName α β binderInfo => if Lean.Expr.hasLooseBVars β = true then none else some (α, β) | x => none
Equations
- Lean.Expr.isEq e = Lean.Expr.isAppOfArity e (Lean.Name.mkStr1 "Eq") 3
Equations
- Lean.Expr.isHEq e = Lean.Expr.isAppOfArity e (Lean.Name.mkStr1 "HEq") 4
Equations
- Lean.Expr.isIte e = Lean.Expr.isAppOfArity e (Lean.Name.mkStr1 "ite") 5
Equations
- Lean.Expr.isDIte e = Lean.Expr.isAppOfArity e (Lean.Name.mkStr1 "dite") 5
Equations
Equations
- Lean.Expr.arrayLit? e = if Lean.Expr.isAppOfArity' e (Lean.Name.mkStr2 "List" "toArray") 2 = true then Lean.Expr.listLit? (Lean.Expr.appArg!' e) else none
Recognize α × β
Equations
- Lean.Expr.prod? e = Lean.Expr.app2? e (Lean.Name.mkStr1 "Prod")
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Expr.isConstructorApp env e = Option.isSome (Lean.Expr.isConstructorApp? env e)
def
Lean.Expr.constructorApp?
(env : Lean.Environment)
(e : Lean.Expr)
(useRaw : optParam Bool false)
:
If e
is a constructor application, return a pair containing the corresponding ConstructorVal
and the constructor
application arguments.
This function treats numerals as constructors. For example, if e
is the numeral 2
, the result pair
is ConstructorVal
for Nat.succ
, and the array #[1]
. The parameter useRaw
controls how the resulting
numeral is represented. If useRaw := false
, then mkNatLit
is used, otherwise mkRawNatLit
.
Recall that mkNatLit
uses the OfNat.ofNat
application which is the canonical way of representing numerals
in the elaborator and tactic framework. We useRaw := false
in the compiler (aka code generator).
Equations
- One or more equations did not get rendered due to their size.