Documentation

Mathlib.Tactic.FunProp.FunctionData

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

  • args : Array Mor.Arg

    applied function arguments

  • mainVar : Lean.Expr

    main variable

  • mainArgs : Array

    indices of args that contain mainVars

Instances For

    Turn function data back to expression.

    Instances For

      Is f an identity function?

      Instances For

        Is f a constant function?

        Instances For

          Domain type of f.

          Instances For
            def Mathlib.Meta.FunProp.FunctionData.getFnConstName? (f : FunctionData) :
            Lean.MetaM (Option Lean.Name)

            Is head function of f a constant?

            If the head of f is a projection return the name of corresponding projection function.

            Instances For
              def Mathlib.Meta.FunProp.getFunctionData (f : Lean.Expr) :
              Lean.MetaM FunctionData

              Get FunctionData for f. Throws if f can't be put into funProp-normal form.

              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 ↦ ...

                Instances For

                  Turn MaybeFunctionData to the function.

                  Instances For
                    def Mathlib.Meta.FunProp.getFunctionData? (f : Lean.Expr) (unfoldPred : Lean.NameBool := fun (x : Lean.Name) => false) :

                    Get FunctionData for f.

                    Instances For
                      def Mathlib.Meta.FunProp.FunctionData.unfoldHeadFVar? (fData : FunctionData) :
                      Lean.MetaM (Option Lean.Expr)

                      If head function is a let-fvar unfold it and return resulting function. Return none otherwise.

                      Instances For

                        Type of morphism application.

                        • underApplied : MorApplication

                          Of the form ⇑f i.e. missing argument.

                        • exact : MorApplication

                          Of the form ⇑f x i.e. morphism and one argument is provided.

                        • overApplied : MorApplication

                          Of the form ⇑f x y ... i.e. additional applied arguments y ....

                        • none : MorApplication

                          Not a morphism application.

                        Instances For

                          Is function body of f a morphism application? What kind?

                          Instances For
                            def Mathlib.Meta.FunProp.FunctionData.peeloffArgDecomposition (fData : FunctionData) :
                            Lean.MetaM (Option (Lean.Expr × Lean.Expr))

                            Decomposes fun x ↦ f y₁ ... yₙ into (fun g ↦ g yₙ) ∘ (fun x y ↦ f y₁ ... yₙ₋₁ y)

                            Returns none if:

                            • n=0
                            • yₙ contains x
                            • n=1 and (fun x y ↦ f y) is identity function i.e. x=f
                            Instances For
                              def Mathlib.Meta.FunProp.FunctionData.nontrivialDecomposition (fData : FunctionData) :
                              Lean.MetaM (Option (Lean.Expr × Lean.Expr))

                              Decompose function f = (← fData.toExpr) into composition of two functions.

                              Returns none if the decomposition would produce composition with identity function.

                              Instances For
                                def Mathlib.Meta.FunProp.FunctionData.decompositionOverArgs (fData : FunctionData) (args : Array ) :
                                Lean.MetaM (Option (Lean.Expr × Lean.Expr))

                                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.

                                Instances For