lean2js

Lean2Js.Core

source

Imports 2

The syntax of the Lean subset destined for JavaScript #

Holds the syntax of the Lean subset destined for JavaScript as a standalone AST inside Lean.

This is a deep embedding rather than a reader of ordinary Lean defs because compiler correctness cannot even be stated without holding the source language's semantics in our own hands.

inductive

Lean2Js.Core.Ty

source

The types that may sit on the boundary of the public API. Only those whose JS representation is uniquely determined are listed.

var stands for a type parameter and is only ever written inside the field types of the TypeDef that declares it; every type reaching a boundary has had its parameters substituted away.

option and result stay built in even though a user could now declare them, because the subset has literal syntax for their constructors and the generated runtime checks them by shape. Expressing them as declarations would remove neither special case.

  • bool : Ty
  • int53 : Ty
  • uint32 : Ty
  • string : Ty
  • bigint : Ty
  • var : Ty
  • named : Ty
  • option : Ty
  • result : Ty
  • array : Ty
  • dict : Ty
  • dictObj : Ty
  • fn : Ty
Instances For
    Used by
      partial def

      Lean2Js.Core.instReprTy.repr

      source
      :
      Ty → Nat → Std.Format
      Used by
        instance

        Lean2Js.Core.instReprTy

        source
        @[instance_reducible]
        Equations
        Used by
          instance

          Lean2Js.Core.instInhabitedTy

          source
          @[instance_reducible]
          Equations
          Used by
            def

            Lean2Js.Core.Ty.beq

            source
            :
            Ty → Ty → Bool

            Written out rather than derived so that Ty.eq_of_beq can be proved: Ty nests a List Ty, and neither DecidableEq nor LawfulBEq derives through that. Recursing through a list helper keeps it structural, so a type comparison still closes by rfl.

            Equations
            Instances For
              Used by
                def

                Lean2Js.Core.Ty.beqList

                source
                :
                List Ty → List Ty → Bool
                Equations
                Instances For
                  Used by
                    instance

                    Lean2Js.Core.instBEqTy

                    source
                    @[instance_reducible]
                    Equations
                    Used by
                      theorem

                      Lean2Js.Core.Ty.beq_refl

                      source
                      (t : Ty) :
                      t.beq t = true
                      Used by
                        theorem

                        Lean2Js.Core.Ty.beqList_refl

                        source
                        (ts : List Ty) :
                        beqList ts ts = true
                        Used by
                          theorem

                          Lean2Js.Core.Ty.eq_of_beq

                          source
                          {a b : Ty} :
                          a.beq b = true → a = b

                          Written out for the reason Ty.beq is: a type comparison is what ties the knot in a recursive descriptor, and the knot has to be tied on equality rather than on a Bool nothing reads back.

                          Used by
                            theorem

                            Lean2Js.Core.Ty.eq_of_beqList

                            source
                            {as bs : List Ty} :
                            beqList as bs = true → as = bs
                            Used by
                              instance

                              Lean2Js.Core.instLawfulBEqTy

                              source
                              Used by
                                def

                                Lean2Js.Core.Ty.size

                                source
                                :
                                Ty → Nat

                                A node count, used to bound how far a type can be expanded. sizeOf would say the same thing, but its derived instance is noncomputable and this number is computed while compiling.

                                Equations
                                Instances For
                                  Used by
                                    def

                                    Lean2Js.Core.Ty.sizeList

                                    source
                                    :
                                    List Ty → Nat
                                    Equations
                                    Instances For
                                      Used by
                                        def

                                        Lean2Js.Core.Ty.render

                                        source
                                        :
                                        Equations
                                        Instances For
                                          Used by
                                            def

                                            Lean2Js.Core.Ty.renderArgs

                                            source
                                            :

                                            Each argument carries its own leading space rather than being joined by one, so that a name applied to nothing renders as the bare name without a case split on the list.

                                            Equations
                                            Instances For
                                              Used by
                                                def

                                                Lean2Js.Core.Ty.renderParams

                                                source
                                                :
                                                Equations
                                                Instances For
                                                  Used by
                                                    def

                                                    Lean2Js.Core.Ty.renderParamsRest

                                                    source
                                                    :
                                                    Equations
                                                    Instances For
                                                      Used by
                                                        def

                                                        Lean2Js.Core.Ty.subst

                                                        source
                                                        (sigma : List (String × Ty)) :
                                                        Ty → Ty

                                                        Replaces a declaration's type parameters with the arguments it was applied to. Recursing through a list helper rather than args.map keeps this out of partial, which a proof about a declaration cannot unfold.

                                                        Equations
                                                        Instances For
                                                          Used by
                                                            def

                                                            Lean2Js.Core.Ty.substArgs

                                                            source
                                                            (sigma : List (String × Ty)) :
                                                            Equations
                                                            Instances For
                                                              Used by
                                                                def

                                                                Lean2Js.Core.Ty.isFn

                                                                source
                                                                :
                                                                Ty → Bool
                                                                Equations
                                                                Instances For
                                                                  Used by
                                                                    def

                                                                    Lean2Js.Core.Ty.noDictObj

                                                                    source
                                                                    :
                                                                    Ty → Bool

                                                                    Whether a type's own shape reaches no dictObj. Written through a list helper rather than args.all for the reason Ty.beq is: a structural recursion is what a proof can unfold.

                                                                    This says nothing about what a named type's fields hold — those come from the program, not from the type — so the reading a proof needs is this together with Program.noDictObj.

                                                                    Equations
                                                                    Instances For
                                                                      Used by
                                                                        def

                                                                        Lean2Js.Core.Ty.noDictObjList

                                                                        source
                                                                        :
                                                                        Equations
                                                                        Instances For
                                                                          Used by
                                                                            theorem

                                                                            Lean2Js.Core.Ty.noDictObj_subst

                                                                            source
                                                                            {sigma : List (String × Ty)} (hs : ∀ (pair : String × Ty), pair ∈ sigma → pair.snd.noDictObj = true) (t : Ty) :
                                                                            t.noDictObj = true → (subst sigma t).noDictObj = true

                                                                            Substituting types that reach no dictObj into a type that reaches none leaves one that reaches none. This is what carries Ty.noDictObj through TypeDef.ctorsAt, which is the only place a field's type is read at a use of the type it belongs to.

                                                                            Used by
                                                                              theorem

                                                                              Lean2Js.Core.Ty.noDictObjList_substArgs

                                                                              source
                                                                              {sigma : List (String × Ty)} (hs : ∀ (pair : String × Ty), pair ∈ sigma → pair.snd.noDictObj = true) (ts : List Ty) :
                                                                              Used by
                                                                                theorem

                                                                                Lean2Js.Core.Ty.noDictObj_zip

                                                                                source
                                                                                {params : List String} {args : List Ty} :
                                                                                noDictObjList args = true → ∀ (pair : String × Ty), pair ∈ params.zip args → pair.snd.noDictObj = true

                                                                                The types a substitution puts in reach no dictObj when the arguments it was built from reach none. TypeDef.ctorsAt builds its substitution by zipping the declared parameters against them.

                                                                                Used by
                                                                                  inductive

                                                                                  Lean2Js.Core.Lit

                                                                                  source
                                                                                  Instances For
                                                                                    Used by
                                                                                      def

                                                                                      Lean2Js.Core.instReprLit.repr

                                                                                      source
                                                                                      :
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        Used by
                                                                                          instance

                                                                                          Lean2Js.Core.instReprLit

                                                                                          source
                                                                                          @[instance_reducible]
                                                                                          Equations
                                                                                          Used by
                                                                                            instance

                                                                                            Lean2Js.Core.instBEqLit

                                                                                            source
                                                                                            @[instance_reducible]
                                                                                            Equations
                                                                                            Used by
                                                                                              def

                                                                                              Lean2Js.Core.instBEqLit.beq

                                                                                              source
                                                                                              :
                                                                                              Lit → Lit → Bool
                                                                                              Equations
                                                                                              Instances For
                                                                                                Used by
                                                                                                  instance

                                                                                                  Lean2Js.Core.instInhabitedLit

                                                                                                  source
                                                                                                  @[instance_reducible]
                                                                                                  Equations
                                                                                                  Used by
                                                                                                    inductive

                                                                                                    Lean2Js.Core.UnOp

                                                                                                    source
                                                                                                    Instances For
                                                                                                      Used by
                                                                                                        instance

                                                                                                        Lean2Js.Core.instReprUnOp

                                                                                                        source
                                                                                                        @[instance_reducible]
                                                                                                        Equations
                                                                                                        Used by
                                                                                                          def

                                                                                                          Lean2Js.Core.instReprUnOp.repr

                                                                                                          source
                                                                                                          :
                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            Used by
                                                                                                              instance

                                                                                                              Lean2Js.Core.instBEqUnOp

                                                                                                              source
                                                                                                              @[instance_reducible]
                                                                                                              Equations
                                                                                                              Used by
                                                                                                                def

                                                                                                                Lean2Js.Core.instBEqUnOp.beq

                                                                                                                source
                                                                                                                :
                                                                                                                UnOp → UnOp → Bool
                                                                                                                Equations
                                                                                                                Instances For
                                                                                                                  Used by
                                                                                                                    instance

                                                                                                                    Lean2Js.Core.instInhabitedUnOp

                                                                                                                    source
                                                                                                                    @[instance_reducible]
                                                                                                                    Equations
                                                                                                                    Used by
                                                                                                                      inductive

                                                                                                                      Lean2Js.Core.BinOp

                                                                                                                      source
                                                                                                                      Instances For
                                                                                                                        Used by
                                                                                                                          def

                                                                                                                          Lean2Js.Core.instReprBinOp.repr

                                                                                                                          source
                                                                                                                          :
                                                                                                                          Equations
                                                                                                                          Instances For
                                                                                                                            Used by
                                                                                                                              instance

                                                                                                                              Lean2Js.Core.instReprBinOp

                                                                                                                              source
                                                                                                                              @[instance_reducible]
                                                                                                                              Equations
                                                                                                                              Used by
                                                                                                                                def

                                                                                                                                Lean2Js.Core.instBEqBinOp.beq

                                                                                                                                source
                                                                                                                                :
                                                                                                                                BinOp → BinOp → Bool
                                                                                                                                Equations
                                                                                                                                Instances For
                                                                                                                                  Used by
                                                                                                                                    instance

                                                                                                                                    Lean2Js.Core.instBEqBinOp

                                                                                                                                    source
                                                                                                                                    @[instance_reducible]
                                                                                                                                    Equations
                                                                                                                                    Used by
                                                                                                                                      instance

                                                                                                                                      Lean2Js.Core.instInhabitedBinOp

                                                                                                                                      source
                                                                                                                                      @[instance_reducible]
                                                                                                                                      Equations
                                                                                                                                      Used by
                                                                                                                                        inductive

                                                                                                                                        Lean2Js.Core.StrUnOp

                                                                                                                                        source

                                                                                                                                        The string operations that take only the string. length is not here: an Array has one too, so the two share Expr.length.

                                                                                                                                        Instances For
                                                                                                                                          Used by
                                                                                                                                            def

                                                                                                                                            Lean2Js.Core.instReprStrUnOp.repr

                                                                                                                                            source
                                                                                                                                            Equations
                                                                                                                                            Instances For
                                                                                                                                              Used by
                                                                                                                                                instance

                                                                                                                                                Lean2Js.Core.instReprStrUnOp

                                                                                                                                                source
                                                                                                                                                @[instance_reducible]
                                                                                                                                                Equations
                                                                                                                                                Used by
                                                                                                                                                  instance

                                                                                                                                                  Lean2Js.Core.instBEqStrUnOp

                                                                                                                                                  source
                                                                                                                                                  @[instance_reducible]
                                                                                                                                                  Equations
                                                                                                                                                  Used by
                                                                                                                                                    def

                                                                                                                                                    Lean2Js.Core.instBEqStrUnOp.beq

                                                                                                                                                    source
                                                                                                                                                    :
                                                                                                                                                    Equations
                                                                                                                                                    Instances For
                                                                                                                                                      Used by
                                                                                                                                                        instance

                                                                                                                                                        Lean2Js.Core.instInhabitedStrUnOp

                                                                                                                                                        source
                                                                                                                                                        @[instance_reducible]
                                                                                                                                                        Equations
                                                                                                                                                        Used by
                                                                                                                                                          inductive

                                                                                                                                                          Lean2Js.Core.StrBinOp

                                                                                                                                                          source
                                                                                                                                                          Instances For
                                                                                                                                                            Used by
                                                                                                                                                              instance

                                                                                                                                                              Lean2Js.Core.instReprStrBinOp

                                                                                                                                                              source
                                                                                                                                                              @[instance_reducible]
                                                                                                                                                              Equations
                                                                                                                                                              Used by
                                                                                                                                                                def

                                                                                                                                                                Lean2Js.Core.instReprStrBinOp.repr

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

                                                                                                                                                                    Lean2Js.Core.instBEqStrBinOp

                                                                                                                                                                    source
                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                    Equations
                                                                                                                                                                    Used by
                                                                                                                                                                      def

                                                                                                                                                                      Lean2Js.Core.instBEqStrBinOp.beq

                                                                                                                                                                      source
                                                                                                                                                                      Equations
                                                                                                                                                                      Instances For
                                                                                                                                                                        Used by
                                                                                                                                                                          instance

                                                                                                                                                                          Lean2Js.Core.instInhabitedStrBinOp

                                                                                                                                                                          source
                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                          Equations
                                                                                                                                                                          Used by
                                                                                                                                                                            def

                                                                                                                                                                            Lean2Js.Core.StrUnOp.name

                                                                                                                                                                            source
                                                                                                                                                                            Equations
                                                                                                                                                                            Instances For
                                                                                                                                                                              Used by
                                                                                                                                                                                def

                                                                                                                                                                                Lean2Js.Core.StrBinOp.name

                                                                                                                                                                                source
                                                                                                                                                                                Equations
                                                                                                                                                                                Instances For
                                                                                                                                                                                  Used by
                                                                                                                                                                                    inductive

                                                                                                                                                                                    Lean2Js.Core.QuantOp

                                                                                                                                                                                    source

                                                                                                                                                                                    all and any differ only in which answer ends the walk, so they share one form. find does not join them: it answers with the element rather than with a Bool.

                                                                                                                                                                                    Instances For
                                                                                                                                                                                      Used by
                                                                                                                                                                                        instance

                                                                                                                                                                                        Lean2Js.Core.instReprQuantOp

                                                                                                                                                                                        source
                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                        Equations
                                                                                                                                                                                        Used by
                                                                                                                                                                                          def

                                                                                                                                                                                          Lean2Js.Core.instReprQuantOp.repr

                                                                                                                                                                                          source
                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            Used by
                                                                                                                                                                                              instance

                                                                                                                                                                                              Lean2Js.Core.instBEqQuantOp

                                                                                                                                                                                              source
                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                              Equations
                                                                                                                                                                                              Used by
                                                                                                                                                                                                def

                                                                                                                                                                                                Lean2Js.Core.instBEqQuantOp.beq

                                                                                                                                                                                                source
                                                                                                                                                                                                :
                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For
                                                                                                                                                                                                  Used by
                                                                                                                                                                                                    instance

                                                                                                                                                                                                    Lean2Js.Core.instInhabitedQuantOp

                                                                                                                                                                                                    source
                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    Used by
                                                                                                                                                                                                      def

                                                                                                                                                                                                      Lean2Js.Core.QuantOp.name

                                                                                                                                                                                                      source
                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                        Used by
                                                                                                                                                                                                          inductive

                                                                                                                                                                                                          Lean2Js.Core.Pat

                                                                                                                                                                                                          source

                                                                                                                                                                                                          What one match arm tests the scrutinee against. Nesting is what lets a rule branch on a combination — a state together with a role — instead of one constructor at a time, and a wildcard is what lets it name the combinations it cares about and leave the rest to a fallback.

                                                                                                                                                                                                          bind and wild differ only in whether the value is given a name; the exhaustiveness check treats them alike.

                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                            Used by
                                                                                                                                                                                                              instance

                                                                                                                                                                                                              Lean2Js.Core.instReprPat

                                                                                                                                                                                                              source
                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                partial def

                                                                                                                                                                                                                Lean2Js.Core.instReprPat.repr

                                                                                                                                                                                                                source
                                                                                                                                                                                                                :
                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                  partial def

                                                                                                                                                                                                                  Lean2Js.Core.instBEqPat.beq

                                                                                                                                                                                                                  source
                                                                                                                                                                                                                  :
                                                                                                                                                                                                                  Pat → Pat → Bool
                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                    Lean2Js.Core.instBEqPat

                                                                                                                                                                                                                    source
                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                      instance

                                                                                                                                                                                                                      Lean2Js.Core.instInhabitedPat

                                                                                                                                                                                                                      source
                                                                                                                                                                                                                      @[instance_reducible]
                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                        inductive

                                                                                                                                                                                                                        Lean2Js.Core.Expr

                                                                                                                                                                                                                        source

                                                                                                                                                                                                                        For none and error / ok one side's type is not determined by the term, so the syntax carries an annotation.

                                                                                                                                                                                                                        The array combinators carry their binder and body rather than taking a function, so no value in the subset is ever a function.

                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                            partial def

                                                                                                                                                                                                                            Lean2Js.Core.instReprExpr.repr

                                                                                                                                                                                                                            source
                                                                                                                                                                                                                            :
                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                              Lean2Js.Core.instReprExpr

                                                                                                                                                                                                                              source
                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                partial def

                                                                                                                                                                                                                                Lean2Js.Core.instBEqExpr.beq

                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                :
                                                                                                                                                                                                                                Expr → Expr → Bool
                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                  Lean2Js.Core.instBEqExpr

                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                    Lean2Js.Core.instInhabitedExpr

                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                      abbrev

                                                                                                                                                                                                                                      Lean2Js.Core.Alt

                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                      @[reducible, inline]
                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                          Lean2Js.Core.Alt.pat

                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                          (a : Alt) :
                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                              Lean2Js.Core.Alt.body

                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                              (a : Alt) :
                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                  inductive

                                                                                                                                                                                                                                                  Lean2Js.Core.FoldKind

                                                                                                                                                                                                                                                  source

                                                                                                                                                                                                                                                  How a fold carries one of a constructor's fields: the declared type coming round, a list of it coming round, or neither.

                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                      instance

                                                                                                                                                                                                                                                      Lean2Js.Core.instReprFoldKind

                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                      @[instance_reducible]
                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                        Lean2Js.Core.instReprFoldKind.repr

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

                                                                                                                                                                                                                                                            Lean2Js.Core.instBEqFoldKind.beq

                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                instance

                                                                                                                                                                                                                                                                Lean2Js.Core.instBEqFoldKind

                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                @[instance_reducible]
                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                  Lean2Js.Core.instInhabitedFoldKind

                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                    Lean2Js.Core.instDecidableEqFoldKind

                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                      Lean2Js.Core.foldKindOf

                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                      (typeName : String) (tyArgs : List Ty) :

                                                                                                                                                                                                                                                                      Which of a constructor's fields a fold over typeName tyArgs goes into, read off the field's own declared type. This is the one test: the evaluator walks by it and the emitter writes its spec from it, so the two cannot disagree about which field comes round.

                                                                                                                                                                                                                                                                      Only the type at the same arguments comes round. Tree Int inside Tree String is a different type and a fold over one does not descend into the other.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                          structure

                                                                                                                                                                                                                                                                          Lean2Js.Core.Param

                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                                                              Lean2Js.Core.instReprParam.repr

                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                              :
                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                  Lean2Js.Core.instReprParam

                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                    Lean2Js.Core.instBEqParam

                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                      Lean2Js.Core.instBEqParam.beq

                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                      :
                                                                                                                                                                                                                                                                                      Param → Param → Bool
                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                          instance

                                                                                                                                                                                                                                                                                          Lean2Js.Core.instInhabitedParam

                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                            structure

                                                                                                                                                                                                                                                                                            Lean2Js.Core.Field

                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                Lean2Js.Core.instReprField.repr

                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                :
                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                                    Lean2Js.Core.instReprField

                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                      Lean2Js.Core.instBEqField.beq

                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                      :
                                                                                                                                                                                                                                                                                                      Field → Field → Bool
                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                          instance

                                                                                                                                                                                                                                                                                                          Lean2Js.Core.instBEqField

                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                            instance

                                                                                                                                                                                                                                                                                                            Lean2Js.Core.instInhabitedField

                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                            @[instance_reducible]
                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                              structure

                                                                                                                                                                                                                                                                                                              Lean2Js.Core.CtorDef

                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                  Lean2Js.Core.instReprCtorDef

                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.instReprCtorDef.repr

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

                                                                                                                                                                                                                                                                                                                        Lean2Js.Core.instBEqCtorDef

                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.instBEqCtorDef.beq

                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                          :
                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.instInhabitedCtorDef

                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                structure

                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.TypeDef

                                                                                                                                                                                                                                                                                                                                source

                                                                                                                                                                                                                                                                                                                                A structure / inductive declared by the user. The single-constructor ones are the structures.

                                                                                                                                                                                                                                                                                                                                params names the type parameters that the field types may mention as Ty.var.

                                                                                                                                                                                                                                                                                                                                discriminator is the key the generated JavaScript tells this type's constructors apart by: tag unless the author wrote @[discriminator "..."] above the type.

                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.instReprTypeDef

                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                                                      Lean2Js.Core.instReprTypeDef.repr

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

                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.instBEqTypeDef.beq

                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                          :
                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.instBEqTypeDef

                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                instance

                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.instInhabitedTypeDef

                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Core.builtinCtors

                                                                                                                                                                                                                                                                                                                                                  source

                                                                                                                                                                                                                                                                                                                                                  The constructor names the subset spells itself, in Option and Result. No TypeDef declares them, so they are carried under tag and a declared type may not key one of them elsewhere.

                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                      class

                                                                                                                                                                                                                                                                                                                                                      Lean2Js.Core.Discriminators

                                                                                                                                                                                                                                                                                                                                                      source

                                                                                                                                                                                                                                                                                                                                                      Which key a constructor's name is carried under in the generated JavaScript.

                                                                                                                                                                                                                                                                                                                                                      A value the reference semantics returns carries the name of its constructor and not the type it came from, so the key that name is written with has to be decided by the name alone. The compiler and encodeValue both read it from here, which is what makes the two write the same object; Compile.validateType is what checks this reading against what each type declares.

                                                                                                                                                                                                                                                                                                                                                      The two laws are what the generated code needs of a key wherever it is written rather than read off a type, so they are carried here and not asked again at each use. Program.discriminators? is where a program's own reading is checked against them.

                                                                                                                                                                                                                                                                                                                                                      Instances
                                                                                                                                                                                                                                                                                                                                                        Used by

                                                                                                                                                                                                                                                                                                                                                          The law spelled out for each of the four, so that a proof about Option or Result meets tag where it expects it.

                                                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.keyFor_none

                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                          @[simp]
                                                                                                                                                                                                                                                                                                                                                          [Discriminators] :
                                                                                                                                                                                                                                                                                                                                                          keyFor "none" = "tag"
                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Core.keyFor_some

                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                            @[simp]
                                                                                                                                                                                                                                                                                                                                                            [Discriminators] :
                                                                                                                                                                                                                                                                                                                                                            keyFor "some" = "tag"
                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.keyFor_ok

                                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                                              @[simp]
                                                                                                                                                                                                                                                                                                                                                              [Discriminators] :
                                                                                                                                                                                                                                                                                                                                                              keyFor "ok" = "tag"
                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.keyFor_error

                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                @[simp]
                                                                                                                                                                                                                                                                                                                                                                [Discriminators] :
                                                                                                                                                                                                                                                                                                                                                                keyFor "error" = "tag"
                                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Core.TypeDef.find?

                                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                                  (t : TypeDef) (ctor : String) :
                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                                                                                      Lean2Js.Core.TypeDef.ctorsAt

                                                                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                                                                      (t : TypeDef) (args : List Ty) :

                                                                                                                                                                                                                                                                                                                                                                      The constructors as seen by a use of the type at args. Every lookup that reads a field's type rather than its name goes through here; reading a name back does not need the substitution.

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

                                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.TypeDef.findAt?

                                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                                          (t : TypeDef) (args : List Ty) (ctor : String) :
                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                                              structure

                                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.Decl

                                                                                                                                                                                                                                                                                                                                                                              source

                                                                                                                                                                                                                                                                                                                                                                              One pure function the package carries.

                                                                                                                                                                                                                                                                                                                                                                              • name : String
                                                                                                                                                                                                                                                                                                                                                                              • params : List Param
                                                                                                                                                                                                                                                                                                                                                                              • ret : Ty
                                                                                                                                                                                                                                                                                                                                                                              • body : Expr
                                                                                                                                                                                                                                                                                                                                                                              • exported : Bool

                                                                                                                                                                                                                                                                                                                                                                                Whether the author meant this declaration to be part of the package's API. @[ship internal] clears it; a declaration whose exported is clear is compiled and callable from the others, and named by neither index.js's exports nor index.d.ts.

                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Core.instReprDecl

                                                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.instReprDecl.repr

                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                    :
                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                        instance

                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Core.instBEqDecl

                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.instBEqDecl.beq

                                                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                                                          :
                                                                                                                                                                                                                                                                                                                                                                                          Decl → Decl → Bool
                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.instInhabitedDecl

                                                                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                structure

                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.Program

                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.instReprProgram

                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                                                                                                                      Lean2Js.Core.instReprProgram.repr

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

                                                                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.instInhabitedProgram

                                                                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Core.Decl.paramsCheckable

                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                            (d : Decl) :

                                                                                                                                                                                                                                                                                                                                                                                                            Whether the entry check has something to read in every parameter. A function value has no shape to check, so a declaration taking one has nothing to refuse at the boundary — which is what the refusing direction, the descent and the small-step agreement each ask for, and all they ask for. Named apart from isPublic because the two answer different questions and a proof wants this one.

                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.Decl.isPublic

                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                (d : Decl) :

                                                                                                                                                                                                                                                                                                                                                                                                                A declaration crosses the boundary when its author meant it to and the entry check can read its parameters. A declaration that takes a function is internal whatever the author wrote: a function value cannot be checked at the boundary, so one that would need one checked never reaches it at all.

                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.Program.publicDecls

                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Core.TypeDef.noDictObj

                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                        (t : TypeDef) :

                                                                                                                                                                                                                                                                                                                                                                                                                        Whether a declared type's fields reach no dictObj, read before its parameters are substituted away. The substitution only ever puts in types the use site wrote, so reading it here is enough.

                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Core.Decl.noDictObj

                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                            (d : Decl) :

                                                                                                                                                                                                                                                                                                                                                                                                                            Whether a declaration's boundary reaches no dictObj.

                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.Program.typesNoDictObj

                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                (p : Program) :

                                                                                                                                                                                                                                                                                                                                                                                                                                Whether no type this program declares reaches a dictObj. This is the half encodeAt reads: it recurses into a declared type's fields and never into a declaration, so a program may hand a dictionary across as a plain object and still satisfy this.

                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.Program.noDictObj

                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                    (p : Program) :

                                                                                                                                                                                                                                                                                                                                                                                                                                    Whether nothing this program declares crosses the boundary as a plain object.

                                                                                                                                                                                                                                                                                                                                                                                                                                    Every claim written before a dictionary could cross as one holds under this, which is what lets those claims keep the exact text they have: encodeAt_eq_encodeValue carries them back to encodeValue rather than restating them.

                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Core.Program.typesNoDictObj_of_noDictObj

                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Core.TypeDef.noDictObj_ctorsAt

                                                                                                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                                                                                                          {t : TypeDef} (h : t.noDictObj = true) {args : List Ty} (ha : Ty.noDictObjList args = true) (c : CtorDef) :
                                                                                                                                                                                                                                                                                                                                                                                                                                          c ∈ t.ctorsAt args → ∀ (f : Field), f ∈ c.fields → f.ty.noDictObj = true
                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Core.Program.noDictObj_ret

                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                            {p : Program} (hp : p.noDictObj = true) {d : Decl} (hd : d ∈ p.decls) :

                                                                                                                                                                                                                                                                                                                                                                                                                                            A declaration's return type, where the program reaches no dictObj.

                                                                                                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.Program.noDictObj_param

                                                                                                                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                                                                                                                              {p : Program} (hp : p.noDictObj = true) {d : Decl} (hd : d ∈ p.decls) (param : Param) :
                                                                                                                                                                                                                                                                                                                                                                                                                                              param ∈ d.params → param.ty.noDictObj = true

                                                                                                                                                                                                                                                                                                                                                                                                                                              A declaration's parameter types, where the program reaches no dictObj.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Core.Program.find?

                                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                                (p : Program) (name : String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Core.Program.findType?

                                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                                    (p : Program) (name : String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Core.Program.ownerOf?

                                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                                        (p : Program) (ctor : String) :

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Looks up the type a constructor name belongs to. match can reach the type definition from the scrutinee's type, so only the typing of ctor uses this.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Core.Program.noDictObj_findAt?

                                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                                            {p : Program} (hp : p.typesNoDictObj = true) {n : String} {t : TypeDef} (ht : p.findType? n = some t) {args : List Ty} (ha : Ty.noDictObjList args = true) {ctor : String} {c : CtorDef} (hc : t.findAt? args ctor = some c) (f : Field) :

                                                                                                                                                                                                                                                                                                                                                                                                                                                            The field types a constructor is read at, where no type the program declares reaches a dictObj and the type was used at arguments that reach none. This is the step encodeAt takes at a named type.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Core.TypeDef.checkedKey

                                                                                                                                                                                                                                                                                                                                                                                                                                                              source

                                                                                                                                                                                                                                                                                                                                                                                                                                                              What a type's key has to be before a constructor's name can be read as carrying it.

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

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Core.checkedKeys

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  source

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Written as a recursion rather than forM so that the two readings below can be taken back out of it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Lean2Js.Core.Program.discriminators?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      source

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The reading this program declares: a constructor is carried under the key of the type that declares it, and under tag when no type does — which is Option and Result, whose constructors are the subset's own. Checked, because the reading is what the compiler and encodeValue share and the laws above are what the generated code needs of it.

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