Additional operations on Expr and related types #
This file defines basic operations on the types expr, name, declaration, level, environment.
This file is mostly for non-tactics.
Converts an Expr
into a Syntax
, by creating a fresh metavariable
assigned to the expr and returning a named metavariable syntax ?a
.
Equations
- One or more equations did not get rendered due to their size.
Count the number of lambdas at the head of the given expression.
Returns the number of leading ∀
binders of an expression. Ignores metadata.
Like withApp
but ignores metadata.
Equations
- e.withApp' k = Lean.Expr.withApp'.go k e (Array.replicate e.getAppNumArgs' (Lean.mkSort Lean.levelZero)) (e.getAppNumArgs' - 1)
Auxiliary definition for withApp'
.
Equations
- Lean.Expr.withApp'.go k (Lean.Expr.mdata data b) x✝¹ x✝ = Lean.Expr.withApp'.go k b x✝¹ x✝
- Lean.Expr.withApp'.go k (f.app a) x✝¹ x✝ = Lean.Expr.withApp'.go k f (x✝¹.set! x✝ a) (x✝ - 1)
- Lean.Expr.withApp'.go k x✝² x✝¹ x✝ = k x✝² x✝¹
Like withAppRev
but ignores metadata.
Equations
- e.withAppRev' k = Lean.Expr.withAppRev'.go k e (Array.mkEmpty e.getAppNumArgs')
Auxiliary definition for withAppRev'
.
Equations
- Lean.Expr.withAppRev'.go k (Lean.Expr.mdata data b) x✝ = Lean.Expr.withAppRev'.go k b x✝
- Lean.Expr.withAppRev'.go k (f.app a) x✝ = Lean.Expr.withAppRev'.go k f (x✝.push a)
- Lean.Expr.withAppRev'.go k x✝¹ x✝ = k x✝¹ x✝
Like getAppRevArgs
but ignores metadata.
Equations
- e.getAppRevArgs' = e.withAppRev' fun (x : Lean.Expr) (as : Array Lean.Expr) => as
Like getRevArgD
but ignores metadata.
Equations
- (Lean.Expr.mdata data b).getRevArgD' x✝¹ x✝ = b.getRevArgD' x✝¹ x✝
- (fn.app a).getRevArgD' 0 x✝ = a
- (f.app arg).getRevArgD' i.succ x✝ = f.getRevArgD' i x✝
- x✝².getRevArgD' x✝¹ x✝ = x✝
Like getArgD
but ignores metadata.
Equations
- e.getArgD' i v₀ n = e.getRevArgD' (n - i - 1) v₀
Turns an expression that is a natural number literal into a natural number.
Equations
- (Lean.Expr.lit (Lean.Literal.natVal v)).natLit! = v
- x✝.natLit! = panicWithPosWithDecl "Batteries.Lean.Expr" "Lean.Expr.natLit!" 95 30 "nat literal expected"
Turns an expression that is a constructor of Int
applied to a natural number literal
into an integer.
Equations
- One or more equations did not get rendered due to their size.