Documentation

Lean.Compiler.LCNF.ToLCNF

Return true if e is a lcProof application. Recall that we use lcProof to erase all nested proofs.

Equations
Instances For

    Auxiliary inductive datatype for constructing LCNF Code objects. The toLCNF function maintains a sequence of elements that is eventually converted into Code.

    Instances For
      @[reducible, inline]

      State for BindCasesM monad Mapping from _alt.<idx> variables to new join points

      Equations
      Instances For

        This method returns code that at each exit point of cases, it jumps to jpDecl. It is similar to Code.bind, but we add special support for inlineMatcher. The inlineMatcher function inlines the auxiliary _match_<idx> declarations. To make sure there is no code duplication, inlineMatcher creates auxiliary declarations _alt.<idx>. We can say the _alt.<idx> declarations are pre join points. For each auxiliary declaration used at an exit point of cases, this method creates an new auxiliary join point that invokes _alt.<idx>, and then jumps to jpDecl. The goal is to make sure the auxiliary join point is the only occurrence of _alt.<idx>, then simp will inline it. That is, our goal is to try to promote the pre join points _alt.<idx> into a proper join point.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          • ignoreNoncomputable : Bool

            Whether uses of noncomputable defs should be ignored; used in contexts that will be erased eventually.

          Instances For
            • Local context containing the original Lean types (not LCNF ones).

            • Cache from Lean regular expression to LCNF argument.

            • shouldCache : Bool

              Determines whether caching has been disabled due to finding a use of a constant marked with never_extract.

            • typeCache : Std.HashMap Expr Expr
            • isTypeFormerTypeCache : Std.HashMap Expr Bool

              isTypeFormerType cache

            • LCNF sequence, we chain it to create a LCNF Code object.

            • toAny : FVarIdSet

              Fields that are type formers must be replaced with in the resulting code. Otherwise, we have data occurring in types. When converting a casesOn into LCNF, we add constructor fields that are types and type formers into this set. See visitCases.

            Instances For
              @[inline]
              Equations
              Instances For

                Add LCNF element to the current sequence

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Create Code that executes the current seq and then returns result

                      Equations
                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Create a new local declaration using a Lean regular type.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Lean.Compiler.LCNF.ToLCNF.mkLetDecl (binderName : Name) (type value type' : Expr) (arg : Arg Purity.pure) (nondep : Bool) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Given e and args where mkAppN e (args.map (·.toExpr)) is not necessarily well-typed (because of dependent typing), returns e.beta args' where args' are new local declarations each assigned to a value in args with adjusted type (such that the resulting expression is well-typed).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Eta-expand with n lambdas.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          Eta reduce implicits. We use this function to eliminate introduced by the implicit lambda feature, where it generates terms such as fun {α} => ReaderT.pure

                                          Put the given expression in LCNF.

                                          • Nested proofs are replaced with lcProof-applications.
                                          • Eta-expand applications of declarations that satisfy shouldEtaExpand.
                                          • Put computationally relevant expressions in A-normal form.
                                          Equations
                                          Instances For