funProp
data structure holding information about a function #
FunctionData
holds data about function in the form fun x => f x₁ ... xₙ
.
Structure storing parts of a function in funProp-normal form.
- lctx : Lean.LocalContext
local context where
mainVar
exists - insts : Lean.LocalInstances
local instances
- fn : Lean.Expr
main function
applied function arguments
- mainVar : Lean.Expr
main variable
indices of
args
that containmainVars
Instances For
Turn function data back to expression.
Equations
- f.toExpr = Lean.Meta.withLCtx f.lctx f.insts (let body := Mathlib.Meta.FunProp.Mor.mkAppN f.fn f.args; Lean.Meta.mkLambdaFVars #[f.mainVar] body)
Instances For
Is f
an identity function?
Instances For
Is f
a constant function?
Instances For
Domain type of f
.
Equations
- f.domainType = Lean.Meta.withLCtx f.lctx f.insts (Lean.Meta.inferType f.mainVar)
Instances For
Is head function of f
a constant?
If the head of f
is a projection return the name of corresponding projection function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get FunctionData
for f
. Throws if f
can't be put into funProp-normal form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Result of getFunctionData?
. It returns function data if the function is in the form
fun x => f y₁ ... yₙ
. Two other cases are fun x => let y := ...
or fun x y => ...
- letE
(f : Lean.Expr)
: Mathlib.Meta.FunProp.MaybeFunctionData
Can't generate function data as function body has let binder.
- lam
(f : Lean.Expr)
: Mathlib.Meta.FunProp.MaybeFunctionData
Can't generate function data as function body has lambda binder.
- data
(fData : Mathlib.Meta.FunProp.FunctionData)
: Mathlib.Meta.FunProp.MaybeFunctionData
Function data has been successfully generated.
Instances For
Turn MaybeFunctionData
to the function.
Equations
- (Mathlib.Meta.FunProp.MaybeFunctionData.letE f).get = pure f
- (Mathlib.Meta.FunProp.MaybeFunctionData.lam f).get = pure f
- (Mathlib.Meta.FunProp.MaybeFunctionData.data d).get = d.toExpr
Instances For
Get FunctionData
for f
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If head function is a let-fvar unfold it and return resulting function.
Return none
otherwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Type of morphism application.
- underApplied : Mathlib.Meta.FunProp.MorApplication
Of the form
⇑f
i.e. missing argument. - exact : Mathlib.Meta.FunProp.MorApplication
Of the form
⇑f x
i.e. morphism and one argument is provided. - overApplied : Mathlib.Meta.FunProp.MorApplication
Of the form
⇑f x y ...
i.e. additional applied argumentsy ...
. - none : Mathlib.Meta.FunProp.MorApplication
Not a morphism application.
Instances For
Is function body of f
a morphism application? What kind?
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decomposes fun x => f y₁ ... yₙ
into (fun g => g yₙ) ∘ (fun x y => f y₁ ... yₙ₋₁ y)
Returns none if:
n=0
yₙ
containsx
n=1
and(fun x y => f y)
is identity function i.e.x=f
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decompose function f = (← fData.toExpr)
into composition of two functions.
Returns none if the decomposition would produce composition with identity function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decompose function fun x => f y₁ ... yₙ
over specified argument indices #[i, j, ...]
.
The result is:
(fun (yᵢ',yⱼ',...) => f y₁ .. yᵢ' .. yⱼ' .. yₙ) ∘ (fun x => (yᵢ, yⱼ, ...))
This is not possible if yₗ
for l ∉ #[i,j,...]
still contains x
.
In such case none
is returned.
Equations
- One or more equations did not get rendered due to their size.