lean2js

Lean2Js.Prelude

source

The functions an author writes where Lean's own would mean something else #

An author writes ordinary Lean, and most of it means on the JS side what it means in Lean: ++ on a List concatenates, List.reverse reverses, String.length counts the same characters eval counts. The functions collected here are the ones where that is not so, and each is here for one of three reasons.

Lean's function computes something else. String.trim strips every Unicode space and String.toUpper maps ß to SS, which changes the length of the string; the subset strips four characters and folds only ASCII. Str.trim and Str.upper name what the subset does, so an author's theorem is about the shipped behaviour rather than about Lean's.

Lean has no partial function to write. Reading past the end of an array traps on the JS side and so does a substring whose bounds do not fit. A Lean function is total, so Arr.get answers with default there — the certificate is one-sided, so the answer in the trapping case is never claimed.

Lean's own is recursive. List.take, List.contains and List.flatMap repeat by recursion, and the walk reads no recursion. The ones collected under @[expand] say the same thing with slice, any and foldl, and are written out where they are called, so the package ships no function for them.

Opt and Exc hold the Option and Except vocabulary under names of their own rather than adding to Option and Except. The mark goes only on a declaration this library elaborates, and Option.getD and Except.map are imported before this file is read; a second Except.map would also be ambiguous with Lean's under the open Lean2Js an author writes.

Nat is not in the subset, so the functions that count answer with Int.

Two of the types here exist because a Value constructor had no Lean type left to it. Int already encodes to Int53 and List (String × α) already encodes to an array, so Value.bigint and Value.dict get BigInt and Dict — wrappers whose only job is to be a different type from the one that took the encoding first.

def

Lean2Js.Arr.length

source
{α : Type u_1} (xs : List α) :

How many elements, as the Int53 the subset counts in.

Equations
Instances For
    Used by
      def

      Lean2Js.Arr.range

      source
      (n : Int) :

      The whole numbers below n, and none of them where n is not positive.

      This is the array a body folds over when it has to run a number of times rather than once per element it was handed. It is the one array whose length a value rather than the syntax decides, so Bound asks that the program text bound that value -- Arr.range (min (max n 0) 64) -- exactly as it does of a repeat.

      Equations
      Instances For
        Used by
          def

          Lean2Js.Arr.get

          source
          {α : Type u_1} [Inhabited α] (xs : List α) (i : Int) :
          α

          The element at an index. An index outside the array traps rather than answering default; what is written here is what the total function has to say in a case the certificate never reaches.

          Equations
          Instances For
            Used by
              class

              Lean2Js.Arr.KeyOrd

              source
              (κ : Type) [Enc κ] :

              The key types the subset orders an array by. le is the order the author reasons with, and agrees is what ties it to the order the generated code puts the elements in; scalar is what says the key is one the comparison is defined on, which is what keeps the two sides from parting company on a value neither order was written for.

              Instances
                Used by
                  instance

                  Lean2Js.Arr.instKeyOrdInt

                  source
                  @[instance_reducible]
                  Equations
                  Used by
                    instance

                    Lean2Js.Arr.instKeyOrdString

                    source
                    @[instance_reducible]
                    Equations
                    Used by
                      def

                      Lean2Js.Arr.sortByKey

                      source
                      {α κ : Type} [Enc κ] [KeyOrd κ] (xs : List α) (key : α → κ) :
                      List α

                      The elements ordered by their key. List.mergeSort is what the generated code computes too, so what it proves is what ships: the answer is a permutation of the input, and elements whose keys compare equal keep the order they came in.

                      Equations
                      Instances For
                        Used by
                          theorem

                          Lean2Js.Arr.sortByKey_perm

                          source
                          {α κ : Type} [Enc κ] [KeyOrd κ] (xs : List α) (key : α → κ) :
                          (sortByKey xs key).Perm xs
                          Used by
                            def

                            Lean2Js.Arr.slice

                            source
                            {α : Type u_1} (xs : List α) (lo hi : Int) :
                            List α

                            The elements from lo up to but not including hi. Bounds that do not fit trap.

                            Equations
                            Instances For
                              Used by
                                def

                                Lean2Js.Arr.take

                                source
                                {α : Type u_1} (xs : List α) (n : Int) :
                                List α

                                The first n elements, or all of them where there are fewer.

                                Equations
                                Instances For
                                  Used by
                                    def

                                    Lean2Js.Arr.drop

                                    source
                                    {α : Type u_1} (xs : List α) (n : Int) :
                                    List α

                                    Everything after the first n elements.

                                    Equations
                                    Instances For
                                      Used by
                                        def

                                        Lean2Js.Arr.isEmpty

                                        source
                                        {α : Type u_1} (xs : List α) :
                                        Equations
                                        Instances For
                                          Used by
                                            def

                                            Lean2Js.Arr.contains

                                            source
                                            {α : Type u_1} [BEq α] (xs : List α) (wanted : α) :
                                            Equations
                                            Instances For
                                              Used by
                                                def

                                                Lean2Js.Arr.sum

                                                source
                                                (xs : List Int) :

                                                The elements added up. Leaving Int53 on the way traps, as the addition does.

                                                Equations
                                                Instances For
                                                  Used by
                                                    def

                                                    Lean2Js.Arr.count

                                                    source
                                                    {α : Type u_1} (xs : List α) (p : α → Bool) :

                                                    How many elements p holds of.

                                                    Equations
                                                    Instances For
                                                      Used by

                                                        The equations to reason with #

                                                        Every one of these is written as a foldl or a List.any so that the walk can read it, and neither shape reduces on the empty array and the one built from :: the way an author's goal needs. These are the two cases as simp lemmas, so a theorem about a literal array closes without naming List.foldl, and one about x :: xs peels a single element.

                                                        theorem

                                                        Lean2Js.Arr.length_nil

                                                        source
                                                        @[simp]
                                                        {α : Type u_1} :
                                                        Used by
                                                          theorem

                                                          Lean2Js.Arr.length_cons

                                                          source
                                                          @[simp]
                                                          {α : Type u_1} (x : α) (xs : List α) :
                                                          length (x :: xs) = length xs + 1
                                                          Used by
                                                            theorem

                                                            Lean2Js.Arr.isEmpty_nil

                                                            source
                                                            @[simp]
                                                            {α : Type u_1} :
                                                            Used by
                                                              theorem

                                                              Lean2Js.Arr.isEmpty_cons

                                                              source
                                                              @[simp]
                                                              {α : Type u_1} (x : α) (xs : List α) :
                                                              isEmpty (x :: xs) = false
                                                              Used by
                                                                theorem

                                                                Lean2Js.Arr.contains_nil

                                                                source
                                                                @[simp]
                                                                {α : Type u_1} [BEq α] (wanted : α) :
                                                                Used by
                                                                  theorem

                                                                  Lean2Js.Arr.contains_cons

                                                                  source
                                                                  @[simp]
                                                                  {α : Type u_1} [BEq α] (x : α) (xs : List α) (wanted : α) :
                                                                  contains (x :: xs) wanted = (x == wanted || contains xs wanted)
                                                                  Used by
                                                                    theorem

                                                                    Lean2Js.Arr.sum_nil

                                                                    source
                                                                    @[simp]
                                                                    :
                                                                    sum [] = 0
                                                                    Used by
                                                                      theorem

                                                                      Lean2Js.Arr.sum_cons

                                                                      source
                                                                      @[simp]
                                                                      (x : Int) (xs : List Int) :
                                                                      sum (x :: xs) = x + sum xs
                                                                      Used by
                                                                        theorem

                                                                        Lean2Js.Arr.count_nil

                                                                        source
                                                                        @[simp]
                                                                        {α : Type u_1} (p : α → Bool) :
                                                                        count [] p = 0
                                                                        Used by
                                                                          theorem

                                                                          Lean2Js.Arr.count_cons

                                                                          source
                                                                          @[simp]
                                                                          {α : Type u_1} (x : α) (xs : List α) (p : α → Bool) :
                                                                          count (x :: xs) p = (if p x = true then 1 else 0) + count xs p
                                                                          Used by
                                                                            def

                                                                            Lean2Js.Arr.head?

                                                                            source
                                                                            {α : Type u_1} [Inhabited α] (xs : List α) :

                                                                            The first element, or none where there is none. Unlike get, this never traps — the empty case is an answer rather than a read past the end.

                                                                            Equations
                                                                            Instances For
                                                                              Used by
                                                                                def

                                                                                Lean2Js.Arr.last?

                                                                                source
                                                                                {α : Type u_1} [Inhabited α] (xs : List α) :

                                                                                The last element, or none where there is none.

                                                                                Equations
                                                                                Instances For
                                                                                  Used by
                                                                                    def

                                                                                    Lean2Js.Arr.flatten

                                                                                    source
                                                                                    {α : Type u_1} (xss : List (List α)) :
                                                                                    List α

                                                                                    The arrays run together, in the order they come in.

                                                                                    Equations
                                                                                    Instances For
                                                                                      Used by
                                                                                        def

                                                                                        Lean2Js.Arr.flatMap

                                                                                        source
                                                                                        {α : Type u_1} {β : Type u_2} (xs : List α) (f : α → List β) :
                                                                                        List β

                                                                                        Each element replaced by an array, and those run together.

                                                                                        Equations
                                                                                        Instances For
                                                                                          Used by
                                                                                            theorem

                                                                                            Lean2Js.Arr.head?_nil

                                                                                            source
                                                                                            @[simp]
                                                                                            {α : Type u_1} [Inhabited α] :
                                                                                            Used by
                                                                                              theorem

                                                                                              Lean2Js.Arr.head?_cons

                                                                                              source
                                                                                              @[simp]
                                                                                              {α : Type u_1} [Inhabited α] (x : α) (xs : List α) :
                                                                                              head? (x :: xs) = some x
                                                                                              Used by
                                                                                                theorem

                                                                                                Lean2Js.Arr.last?_nil

                                                                                                source
                                                                                                @[simp]
                                                                                                {α : Type u_1} [Inhabited α] :
                                                                                                Used by
                                                                                                  theorem

                                                                                                  Lean2Js.Arr.flatten_nil

                                                                                                  source
                                                                                                  @[simp]
                                                                                                  {α : Type u_1} :
                                                                                                  Used by
                                                                                                    theorem

                                                                                                    Lean2Js.Arr.flatten_cons

                                                                                                    source
                                                                                                    @[simp]
                                                                                                    {α : Type u_1} (xs : List α) (xss : List (List α)) :
                                                                                                    flatten (xs :: xss) = xs ++ flatten xss
                                                                                                    Used by
                                                                                                      theorem

                                                                                                      Lean2Js.Arr.flatMap_nil

                                                                                                      source
                                                                                                      @[simp]
                                                                                                      {α : Type u_1} {β : Type u_2} (f : α → List β) :
                                                                                                      Used by
                                                                                                        theorem

                                                                                                        Lean2Js.Arr.flatMap_cons

                                                                                                        source
                                                                                                        @[simp]
                                                                                                        {α : Type u_1} {β : Type u_2} (x : α) (xs : List α) (f : α → List β) :
                                                                                                        flatMap (x :: xs) f = f x ++ flatMap xs f
                                                                                                        Used by
                                                                                                          def

                                                                                                          Lean2Js.Str.length

                                                                                                          source
                                                                                                          (s : String) :

                                                                                                          How many code points, as the Int53 the subset counts in. JS's own .length counts UTF-16 units; the generated code goes through Array.from so that it counts what this counts.

                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            Used by
                                                                                                              def

                                                                                                              Lean2Js.Str.trim

                                                                                                              source
                                                                                                              (s : String) :

                                                                                                              Strips space, tab, carriage return and newline. JS's trim also takes NBSP, the BOM and the line separators, so an author who wants exactly those four writes this.

                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                Used by
                                                                                                                  def

                                                                                                                  Lean2Js.Str.upper

                                                                                                                  source
                                                                                                                  (s : String) :

                                                                                                                  ASCII case folding. String.toUpper is full Unicode and can change the length of the string.

                                                                                                                  Equations
                                                                                                                  Instances For
                                                                                                                    Used by
                                                                                                                      def

                                                                                                                      Lean2Js.Str.lower

                                                                                                                      source
                                                                                                                      (s : String) :

                                                                                                                      ASCII case folding. String.toLower is full Unicode.

                                                                                                                      Equations
                                                                                                                      Instances For
                                                                                                                        Used by
                                                                                                                          def

                                                                                                                          Lean2Js.Str.startsWith

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

                                                                                                                              Lean2Js.Str.endsWith

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

                                                                                                                                  Lean2Js.Str.includes

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

                                                                                                                                      Lean2Js.Str.split

                                                                                                                                      source
                                                                                                                                      (s sep : String) :

                                                                                                                                      Splitting on the empty separator gives back the whole string, where JS's split("") would give the UTF-16 units.

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        Used by
                                                                                                                                          def

                                                                                                                                          Lean2Js.Str.substring

                                                                                                                                          source
                                                                                                                                          (s : String) (lo hi : Int) :

                                                                                                                                          The code points from lo up to but not including hi. Bounds that do not fit trap.

                                                                                                                                          Equations
                                                                                                                                          Instances For
                                                                                                                                            Used by
                                                                                                                                              def

                                                                                                                                              Lean2Js.Str.toInt?

                                                                                                                                              source

                                                                                                                                              Reads back what Int53.toString prints, and nothing else. "007", "+5", " 5" and "-0" are refused along with everything outside the Int53 range, because none of them is what the printer would have written. JS's own Number() reads all four.

                                                                                                                                              Equations
                                                                                                                                              Instances For
                                                                                                                                                Used by
                                                                                                                                                  def

                                                                                                                                                  Lean2Js.Str.indexOf?

                                                                                                                                                  source
                                                                                                                                                  (s t : String) :

                                                                                                                                                  Where t first sits in s, counted in code points, or none when it does not sit there at all. The empty needle sits at 0. JS's own indexOf counts UTF-16 units and answers -1 for absence.

                                                                                                                                                  Equations
                                                                                                                                                  Instances For
                                                                                                                                                    Used by
                                                                                                                                                      def

                                                                                                                                                      Lean2Js.Str.join

                                                                                                                                                      source
                                                                                                                                                      (xs : List String) (sep : String) :

                                                                                                                                                      The strings in order with sep between them, the way JS's own Array.prototype.join puts it together. An empty list joins to the empty string.

                                                                                                                                                      Equations
                                                                                                                                                      Instances For
                                                                                                                                                        Used by
                                                                                                                                                          def

                                                                                                                                                          Lean2Js.Str.replace

                                                                                                                                                          source
                                                                                                                                                          (s pat rep : String) :

                                                                                                                                                          Every occurrence of pat, not just the first: this is JS's replaceAll, where JS's replace takes only the first. An empty pat leaves s as it is, where replaceAll("", r) inserts at every position.

                                                                                                                                                          Equations
                                                                                                                                                          Instances For
                                                                                                                                                            Used by
                                                                                                                                                              def

                                                                                                                                                              Lean2Js.Str.repeat

                                                                                                                                                              source
                                                                                                                                                              (s : String) (n : Int) :

                                                                                                                                                              s written n times over, counted in code points the way Str.length counts them. A count of zero or less gives the empty string, where JS's own repeat throws on a negative one. A result longer than an Int53 traps, the same bound Str.length lives under.

                                                                                                                                                              Equations
                                                                                                                                                              Instances For
                                                                                                                                                                Used by
                                                                                                                                                                  def

                                                                                                                                                                  Lean2Js.Str.isEmpty

                                                                                                                                                                  source
                                                                                                                                                                  (s : String) :
                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For
                                                                                                                                                                    Used by
                                                                                                                                                                      def

                                                                                                                                                                      Lean2Js.Str.padStart

                                                                                                                                                                      source
                                                                                                                                                                      (s : String) (n : Int) (pad : String) :

                                                                                                                                                                      s widened to n code points by writing pad in front of it, cut to fit exactly. A width s already reaches, and an empty pad, leave s as it is. JS's own padStart counts UTF-16 units, so it pads astral text short.

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

                                                                                                                                                                          The equations to reason with #

                                                                                                                                                                          Str.join is the one that needs saying. It is written from joinStr, which is written from joinFrom, and unfolding it walks a goal one private name at a time to a fold whose accumulator has already eaten the first element. What an author wants is the list peeled from the front, which is what these three give.

                                                                                                                                                                          theorem

                                                                                                                                                                          Lean2Js.Str.length_empty

                                                                                                                                                                          source
                                                                                                                                                                          @[simp]
                                                                                                                                                                          :
                                                                                                                                                                          length "" = 0
                                                                                                                                                                          Used by
                                                                                                                                                                            theorem

                                                                                                                                                                            Lean2Js.Str.isEmpty_empty

                                                                                                                                                                            source
                                                                                                                                                                            @[simp]
                                                                                                                                                                            Used by
                                                                                                                                                                              theorem

                                                                                                                                                                              Lean2Js.Str.join_nil

                                                                                                                                                                              source
                                                                                                                                                                              @[simp]
                                                                                                                                                                              (sep : String) :
                                                                                                                                                                              join [] sep = ""
                                                                                                                                                                              Used by
                                                                                                                                                                                theorem

                                                                                                                                                                                Lean2Js.Str.join_singleton

                                                                                                                                                                                source
                                                                                                                                                                                @[simp]
                                                                                                                                                                                (s sep : String) :
                                                                                                                                                                                join [s] sep = s
                                                                                                                                                                                Used by
                                                                                                                                                                                  theorem

                                                                                                                                                                                  Lean2Js.Str.join_cons

                                                                                                                                                                                  source
                                                                                                                                                                                  @[simp]
                                                                                                                                                                                  (a b sep : String) (rest : List String) :
                                                                                                                                                                                  join (a :: b :: rest) sep = a ++ sep ++ join (b :: rest) sep
                                                                                                                                                                                  Used by
                                                                                                                                                                                    theorem

                                                                                                                                                                                    Lean2Js.Str.repeat_zero

                                                                                                                                                                                    source
                                                                                                                                                                                    @[simp]
                                                                                                                                                                                    (s : String) :
                                                                                                                                                                                    «repeat» s 0 = ""
                                                                                                                                                                                    Used by
                                                                                                                                                                                      theorem

                                                                                                                                                                                      Lean2Js.Str.repeat_nonpos

                                                                                                                                                                                      source
                                                                                                                                                                                      @[simp]
                                                                                                                                                                                      (s : String) {n : Int} (h : n ≤ 0) :
                                                                                                                                                                                      «repeat» s n = ""
                                                                                                                                                                                      Used by
                                                                                                                                                                                        theorem

                                                                                                                                                                                        Lean2Js.Str.padStart_of_le

                                                                                                                                                                                        source
                                                                                                                                                                                        @[simp]
                                                                                                                                                                                        (s pad : String) {n : Int} (h : n ≤ length s) :
                                                                                                                                                                                        padStart s n pad = s

                                                                                                                                                                                        The width already reached is the case a padding theorem starts from, and the guard is what says so.

                                                                                                                                                                                        Used by
                                                                                                                                                                                          def

                                                                                                                                                                                          Lean2Js.Int53.div

                                                                                                                                                                                          source
                                                                                                                                                                                          (a b : Int) :

                                                                                                                                                                                          Truncating division, which is what the generated Math.trunc performs. Lean's / on Int rounds towards negative infinity, so -7 / 2 is -4 there and -3 here. A zero divisor traps.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            Used by
                                                                                                                                                                                              def

                                                                                                                                                                                              Lean2Js.Int53.mod

                                                                                                                                                                                              source
                                                                                                                                                                                              (a b : Int) :

                                                                                                                                                                                              The remainder that goes with div. A zero divisor traps.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              Instances For
                                                                                                                                                                                                Used by
                                                                                                                                                                                                  def

                                                                                                                                                                                                  Lean2Js.Int53.abs

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

                                                                                                                                                                                                      Lean2Js.Int53.divFloor

                                                                                                                                                                                                      source
                                                                                                                                                                                                      (a b : Int) :

                                                                                                                                                                                                      Division rounding towards negative infinity, where div rounds towards zero: divFloor (-7) 2 is -4 and div (-7) 2 is -3. A zero divisor traps, as div does.

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

                                                                                                                                                                                                          Lean2Js.Int53.divCeil

                                                                                                                                                                                                          source
                                                                                                                                                                                                          (a b : Int) :

                                                                                                                                                                                                          Division rounding towards positive infinity.

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

                                                                                                                                                                                                              Lean2Js.Int53.divRound

                                                                                                                                                                                                              source
                                                                                                                                                                                                              (a b : Int) :

                                                                                                                                                                                                              Division rounding a half away from zero, which is how an amount in minor units is rounded where nothing says otherwise: divRound 5 2 is 3 and divRound (-5) 2 is -3. The remainder is compared against what is left of the divisor rather than doubled, so a divisor near the top of the range decides the same way as any other rather than trapping on the way to the answer.

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

                                                                                                                                                                                                                  Lean2Js.Int53.toString

                                                                                                                                                                                                                  source
                                                                                                                                                                                                                  (a : Int) :

                                                                                                                                                                                                                  The decimal spelling. JS's String(n) falls back to exponent notation only at 1e21, which is above the Int53 range, so the two agree on every Int53.

                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                    Used by

                                                                                                                                                                                                                      The civil calendar #

                                                                                                                                                                                                                      Days counted from 1970-01-01, and the civil date of a day, by Howard Hinnant's algorithms. Both are integer arithmetic and nothing else, which is why the calendar can be in the subset where Date cannot: a date is an amount of days, an instant is an amount of milliseconds, and neither reads a clock or a zone. The calendar is proleptic Gregorian — carried backwards past its adoption rather than switching, which is what an epoch day count is everywhere.

                                                                                                                                                                                                                      Each of year, month and day reads the whole date out of the day number, so asking for all three writes the arithmetic out three times. There is no tuple in the subset to hand back instead.

                                                                                                                                                                                                                      def

                                                                                                                                                                                                                      Lean2Js.Cal.fromCivil

                                                                                                                                                                                                                      source
                                                                                                                                                                                                                      (year month day : Int) :

                                                                                                                                                                                                                      The day a civil date falls on, counting from 1970-01-01, which is day zero. A month outside 1..12 or a day outside the month is not refused: the arithmetic carries it, so 2026-13-01 is 2027-01-01.

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

                                                                                                                                                                                                                          Lean2Js.Cal.era

                                                                                                                                                                                                                          source
                                                                                                                                                                                                                          (days : Int) :

                                                                                                                                                                                                                          The four-hundred-year era a day falls in, counted from the one holding 0000-03-01. Written out because the three readings below each need it, and the subset has nothing to share it with.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                              def

                                                                                                                                                                                                                              Lean2Js.Cal.dayOfEra

                                                                                                                                                                                                                              source
                                                                                                                                                                                                                              (days : Int) :

                                                                                                                                                                                                                              The day's place inside its era, in 0..146096.

                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                  Lean2Js.Cal.yearOfEra

                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                  (days : Int) :

                                                                                                                                                                                                                                  The day's year inside its era, in 0..399.

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

                                                                                                                                                                                                                                      Lean2Js.Cal.dayOfYear

                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                      (days : Int) :

                                                                                                                                                                                                                                      The day's place inside its year, counting from the first of March, in 0..365.

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

                                                                                                                                                                                                                                          Lean2Js.Cal.monthOfYear

                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                          (days : Int) :

                                                                                                                                                                                                                                          The month in March-first numbering, in 0..11. January and February are 10 and 11, which is what makes a leap day the last day of the year and the arithmetic above carry no special case.

                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                              Lean2Js.Cal.year

                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                              (days : Int) :

                                                                                                                                                                                                                                              The civil year the day falls in.

                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                  Lean2Js.Cal.month

                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                  (days : Int) :

                                                                                                                                                                                                                                                  The civil month, 1..12.

                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                      Lean2Js.Cal.day

                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                      (days : Int) :

                                                                                                                                                                                                                                                      The civil day of the month, 1..31.

                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                                          Lean2Js.Cal.weekday

                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                          (days : Int) :

                                                                                                                                                                                                                                                          The day of the week, 0 for Sunday through 6 for Saturday. Day zero is a Thursday.

                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                                              Lean2Js.Cal.isLeapYear

                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                              (year : Int) :

                                                                                                                                                                                                                                                              Whether a year carries a leap day, by the Gregorian rule.

                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                                  Lean2Js.Cal.daysInMonth

                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                  (year month : Int) :

                                                                                                                                                                                                                                                                  How many days a month holds, read as the distance to the first of the next month so that it cannot disagree with fromCivil about a leap February.

                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                      Lean2Js.Cal.dayOfInstant

                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                      (ms : Int) :

                                                                                                                                                                                                                                                                      The day an instant falls in, an instant being milliseconds from the epoch. An instant before the epoch belongs to the day it is inside, which is divFloor and not div.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                                                          Lean2Js.Cal.instantOfDay

                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                          (days : Int) :

                                                                                                                                                                                                                                                                          The first instant of a day.

                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                                                              Lean2Js.Opt.getD

                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                              {α : Type u_1} (o : Option α) (dflt : α) :
                                                                                                                                                                                                                                                                              α
                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                                                  Lean2Js.Opt.map

                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                  {α : Type u_1} {β : Type u_2} (o : Option α) (f : α → β) :
                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                      Lean2Js.Opt.getD_some

                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                      @[simp]
                                                                                                                                                                                                                                                                                      {α : Type u_1} (a dflt : α) :
                                                                                                                                                                                                                                                                                      getD (some a) dflt = a
                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                        Lean2Js.Opt.getD_none

                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                        @[simp]
                                                                                                                                                                                                                                                                                        {α : Type u_1} (dflt : α) :
                                                                                                                                                                                                                                                                                        getD none dflt = dflt
                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                          Lean2Js.Opt.map_some

                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                          @[simp]
                                                                                                                                                                                                                                                                                          {α : Type u_1} {β : Type u_2} (a : α) (f : α → β) :
                                                                                                                                                                                                                                                                                          map (some a) f = some (f a)
                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                            Lean2Js.Opt.map_none

                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                            @[simp]
                                                                                                                                                                                                                                                                                            {α : Type u_1} {β : Type u_2} (f : α → β) :
                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                              def

                                                                                                                                                                                                                                                                                              Lean2Js.Exc.getD

                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                              {ε : Type u_1} {α : Type u_2} (e : Except ε α) (dflt : α) :
                                                                                                                                                                                                                                                                                              α
                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                  def

                                                                                                                                                                                                                                                                                                  Lean2Js.Exc.map

                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                  {ε : Type u_1} {α : Type u_2} {β : Type u_3} (e : Except ε α) (f : α → β) :
                                                                                                                                                                                                                                                                                                  Except ε β
                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                      def

                                                                                                                                                                                                                                                                                                      Lean2Js.Exc.mapError

                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                      {ε : Type u_1} {α : Type u_2} {ε' : Type u_3} (e : Except ε α) (f : ε → ε') :
                                                                                                                                                                                                                                                                                                      Except ε' α
                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                          def

                                                                                                                                                                                                                                                                                                          Lean2Js.Exc.toOption

                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                          {ε : Type u_1} {α : Type u_2} (e : Except ε α) :

                                                                                                                                                                                                                                                                                                          What the check accepted, with why it refused dropped.

                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                              theorem

                                                                                                                                                                                                                                                                                                              Lean2Js.Exc.getD_ok

                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                              @[simp]
                                                                                                                                                                                                                                                                                                              {α : Type u_1} {ε : Type u_2} (a dflt : α) :
                                                                                                                                                                                                                                                                                                              getD (Except.ok a) dflt = a
                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                Lean2Js.Exc.getD_error

                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                @[simp]
                                                                                                                                                                                                                                                                                                                {ε : Type u_1} {α : Type u_2} (err : ε) (dflt : α) :
                                                                                                                                                                                                                                                                                                                getD (Except.error err) dflt = dflt
                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                                  Lean2Js.Exc.map_ok

                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                  @[simp]
                                                                                                                                                                                                                                                                                                                  {α : Type u_1} {β : Type u_2} {ε : Type u_3} (a : α) (f : α → β) :
                                                                                                                                                                                                                                                                                                                  map (Except.ok a) f = Except.ok (f a)
                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                                                    Lean2Js.Exc.map_error

                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                    @[simp]
                                                                                                                                                                                                                                                                                                                    {ε : Type u_1} {α : Type u_2} {β : Type u_3} (err : ε) (f : α → β) :
                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                                                      Lean2Js.Exc.mapError_ok

                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                      @[simp]
                                                                                                                                                                                                                                                                                                                      {α : Type u_1} {ε : Type u_2} {ε' : Type u_3} (a : α) (f : ε → ε') :
                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                        theorem

                                                                                                                                                                                                                                                                                                                        Lean2Js.Exc.mapError_error

                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                        @[simp]
                                                                                                                                                                                                                                                                                                                        {ε : Type u_1} {ε' : Type u_2} {α : Type u_3} (err : ε) (f : ε → ε') :
                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                          Lean2Js.Exc.toOption_ok

                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                          @[simp]
                                                                                                                                                                                                                                                                                                                          {α : Type u_1} {ε : Type u_2} (a : α) :
                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                            Lean2Js.Exc.toOption_error

                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                            @[simp]
                                                                                                                                                                                                                                                                                                                            {ε : Type u_1} {α : Type u_2} (err : ε) :
                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                              structure

                                                                                                                                                                                                                                                                                                                              Lean2Js.BigInt

                                                                                                                                                                                                                                                                                                                              source

                                                                                                                                                                                                                                                                                                                              The subset's arbitrary-precision integer. Int is already the one that has to fit in a JS number, so the one that does not is a wrapper: the two are told apart by their type, never by their values.

                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                                  Lean2Js.instDecidableEqBigInt

                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                    Lean2Js.instDecidableEqBigInt.decEq

                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                    (x✝ x✝¹ : BigInt) :
                                                                                                                                                                                                                                                                                                                                    Decidable (x✝ = x✝¹)
                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                        instance

                                                                                                                                                                                                                                                                                                                                        Lean2Js.instInhabitedBigInt

                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                                          instance

                                                                                                                                                                                                                                                                                                                                          Lean2Js.instReprBigInt

                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                            Lean2Js.instReprBigInt.repr

                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                instance

                                                                                                                                                                                                                                                                                                                                                Lean2Js.BigInt.instBEq

                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                @[instance_reducible, instance 10000]

                                                                                                                                                                                                                                                                                                                                                == is the subset's equality, so it is the one on the value rather than the one DecidableEq would derive through the wrapper.

                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                                                  Lean2Js.BigInt.instReflBEq

                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                                                                                    Lean2Js.BigInt.instLawfulBEq

                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                      instance

                                                                                                                                                                                                                                                                                                                                                      Lean2Js.BigInt.instAdd

                                                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                                                      @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                        instance

                                                                                                                                                                                                                                                                                                                                                        Lean2Js.BigInt.instSub

                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                                                          instance

                                                                                                                                                                                                                                                                                                                                                          Lean2Js.BigInt.instMul

                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                          @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                            instance

                                                                                                                                                                                                                                                                                                                                                            Lean2Js.BigInt.instNeg

                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                            @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                                                                                                                                                              Lean2Js.BigInt.instLT

                                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                instance

                                                                                                                                                                                                                                                                                                                                                                Lean2Js.BigInt.instLE

                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.BigInt.instDecidableLt

                                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                  (a b : BigInt) :
                                                                                                                                                                                                                                                                                                                                                                  Decidable (a < b)
                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                    instance

                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.BigInt.instDecidableLe

                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                    @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                    (a b : BigInt) :
                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                                      instance

                                                                                                                                                                                                                                                                                                                                                                      Lean2Js.BigInt.instOfNat

                                                                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                                                                      @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                      {n : Nat} :
                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.BigInt.div

                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                        (a b : BigInt) :

                                                                                                                                                                                                                                                                                                                                                                        Truncating division, as on Int53. A zero divisor traps.

                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.BigInt.mod

                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                            (a b : BigInt) :
                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.BigInt.abs

                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                (a : BigInt) :
                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                    structure

                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict

                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                    (α : Type) :

                                                                                                                                                                                                                                                                                                                                                                                    A Map on the JS side. The entries are a list rather than a set because iteration order is observable through keys, so the two sides have to agree on it: a write to a key already present leaves it where it is, and a write to a new one appends.

                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.ofList

                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (entries : List (String × α)) :
                                                                                                                                                                                                                                                                                                                                                                                        Dict α
                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Dict.get

                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} (d : Dict α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Dict.has

                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                {α : Type} (d : Dict α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict.set

                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} (d : Dict α) (k : String) (v : α) :
                                                                                                                                                                                                                                                                                                                                                                                                    Dict α

                                                                                                                                                                                                                                                                                                                                                                                                    Writing a key already present leaves it where it is; writing a new one appends.

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

                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.erase

                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (d : Dict α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                                        Dict α
                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Dict.keys

                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} (d : Dict α) :
                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Dict.values

                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                {α : Type} (d : Dict α) :
                                                                                                                                                                                                                                                                                                                                                                                                                List α
                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict.size

                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} (d : Dict α) :

                                                                                                                                                                                                                                                                                                                                                                                                                    How many entries, as the Int53 the subset counts in.

                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.getD

                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (d : Dict α) (k : String) (dflt : α) :
                                                                                                                                                                                                                                                                                                                                                                                                                        α

                                                                                                                                                                                                                                                                                                                                                                                                                        What k is bound to, or dflt where it is bound to nothing.

                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Dict.ofPairs

                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} (xs : List α) (key : α → String) :
                                                                                                                                                                                                                                                                                                                                                                                                                            Dict α

                                                                                                                                                                                                                                                                                                                                                                                                                            An array indexed by a key read off each element. Where two elements give the same key the later one wins, and keeps the place the earlier one took. ofList takes literal keys; this one takes computed ones.

                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                structure

                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Dict.Obj

                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                (α : Type) :

                                                                                                                                                                                                                                                                                                                                                                                                                                The same dictionary as Dict, declared to cross the boundary as a plain object rather than as a Map. Inside the module the two are one thing — a value of either is a Value.dict, and every operation runs on the same Map — so what the constructor decides is only what a consumer meets: JSON.stringify of a Map is {}, and what a consumer stringifies is a return value.

                                                                                                                                                                                                                                                                                                                                                                                                                                ofList writes one out key by key, and set and erase give back the spelling they were handed, so a declaration can build one as readily as it can be handed one.

                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict.Obj.ofList

                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} (entries : List (String × α)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                    Obj α
                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.Obj.get

                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (d : Obj α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Dict.Obj.has

                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} (d : Obj α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Dict.Obj.set

                                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                                {α : Type} (d : Obj α) (k : String) (v : α) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                Obj α

                                                                                                                                                                                                                                                                                                                                                                                                                                                Writing a key already present leaves it where it is; writing a new one appends.

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

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict.Obj.erase

                                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} (d : Obj α) (k : String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Obj α
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.Obj.keys

                                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (d : Obj α) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Dict.Obj.values

                                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} (d : Obj α) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                            List α
                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                def

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Dict.Obj.size

                                                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                {α : Type} (d : Obj α) :

                                                                                                                                                                                                                                                                                                                                                                                                                                                                How many entries, as the Int53 the subset counts in.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    def

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Dict.Obj.getD

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} (d : Obj α) (k : String) (dflt : α) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    α

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    What k is bound to, or dflt where it is bound to nothing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        def

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Dict.Obj.ofPairs

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} (xs : List α) (key : α → String) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Obj α

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        An array indexed by a key read off each element, at this spelling. Dict.ofPairs is the same over a Map.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            def

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.encEntry

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            {α : Type} [Enc α] (e : String × α) :

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The entry an encoded Dict carries for one of its own.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Enc.keys_encEntry

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                {α : Type} [Enc α] (es : List (String × α)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                List.map (fun (x : String × Value) => x.fst) (List.map encEntry es) = List.map (fun (x : String × α) => x.fst) es

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The keys survive the encoding untouched, which is what lets the entry check ask about the author's own dictionary rather than about the encoded one.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Enc.instDict

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  {α : Type} [Enc α] :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Enc (Dict α)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Lean2Js.Enc.ty_dict

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    {α : Type} [Enc α] :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ty (Dict α) = (ty α).dict
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Lean2Js.Enc.toValue_dict

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      {α : Type} [Enc α] (d : Dict α) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Lean2Js.Enc.instObj

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        {α : Type} [Enc α] :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Lean2Js.Enc.ty_dictObj

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          {α : Type} [Enc α] :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ty (Dict.Obj α) = (ty α).dictObj
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lean2Js.Enc.toValue_dictObj

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              instance

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Lean2Js.Enc.instBigInt

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[instance_reducible]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Lean2Js.Enc.ty_bigint

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Used by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Lean2Js.Enc.toValue_bigint

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  source
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[simp]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Used by