Documentation

Auto.Lib.BinTree

@[irreducible]
def Auto.Bin.inductionOn {motive : NatSort u} (x : Nat) (ind : (x : Nat) → motive ((x + 2) / 2)motive (x + 2)) (base₀ : motive 0) (base₁ : motive 1) :
motive x
Equations
Instances For
    @[irreducible]
    def Auto.Bin.induction {motive : NatSort u} (ind : (x : Nat) → motive ((x + 2) / 2)motive (x + 2)) (base₀ : motive 0) (base₁ : motive 1) (x : Nat) :
    motive x
    Equations
    Instances For
      inductive Auto.BinTree (α : Type u) :
      Instances For
        def Auto.instReprBinTree.repr {α✝ : Type u_1} [Repr α✝] :
        BinTree α✝NatStd.Format
        Equations
        Instances For
          instance Auto.instReprBinTree {α✝ : Type u_1} [Repr α✝] :
          Repr (BinTree α✝)
          Equations
          def Auto.BinTree.beq {α : Type u_1} [BEq α] (a b : BinTree α) :
          Equations
          Instances For
            instance Auto.BinTree.instBEq {α : Type u_1} [BEq α] :
            Equations
            theorem Auto.BinTree.beq_def {α : Type u_1} [BEq α] {x y : BinTree α} :
            (x == y) = x.beq y
            theorem Auto.BinTree.beq_refl {α : Type u_1} [BEq α] (α_beq_refl : ∀ (x : α), (x == x) = true) {a : BinTree α} :
            (a == a) = true
            def Auto.BinTree.toString {α : Type u_1} [ToString α] :
            Equations
            Instances For
              theorem Auto.BinTree.eq_of_beq_eq_true {α : Type u_1} [BEq α] (α_eq_of_beq_eq_true : ∀ (x y : α), (x == y) = truex = y) {a b : BinTree α} (H : (a == b) = true) :
              a = b
              def Auto.BinTree.val? {α : Type u_1} (bt : BinTree α) :
              Equations
              Instances For
                def Auto.BinTree.valD {α : Type u_1} (bt : BinTree α) (default : α) :
                α
                Equations
                Instances For
                  def Auto.BinTree.left! {α : Type u_1} (bt : BinTree α) :
                  Equations
                  Instances For
                    def Auto.BinTree.right! {α : Type u_1} (bt : BinTree α) :
                    Equations
                    Instances For
                      @[irreducible]
                      def Auto.BinTree.get?'WF {α : Type u_1} (bt : BinTree α) (n : Nat) :
                      Equations
                      Instances For
                        theorem Auto.BinTree.get?'WF.succSucc {α : Type u_1} (bt : BinTree α) (n : Nat) :
                        bt.get?'WF (n + 2) = match (n + 2).mod 2 with | 0 => bt.left!.get?'WF ((n + 2).div 2) | n_1.succ => bt.right!.get?'WF ((n + 2).div 2)
                        def Auto.BinTree.get?'Aux {α : Type u_1} (bt : BinTree α) (n rd : Nat) :
                        Equations
                        Instances For
                          theorem Auto.BinTree.get?'Aux.equiv {α : Type u_1} (bt : BinTree α) (n rd : Nat) :
                          rd nbt.get?'Aux n rd = bt.get?'WF n
                          def Auto.BinTree.get?' {α : Type u_1} (bt : BinTree α) (n : Nat) :
                          Equations
                          Instances For
                            def Auto.BinTree.get? {α : Type u_1} (bt : BinTree α) (n : Nat) :
                            Equations
                            Instances For
                              theorem Auto.BinTree.get?'.equiv {α : Type u_1} (bt : BinTree α) (n : Nat) :
                              bt.get?' n = bt.get?'WF n
                              theorem Auto.BinTree.get?'_succSucc {α : Type u_1} (bt : BinTree α) (n : Nat) :
                              bt.get?' (n + 2) = match (n + 2) % 2 with | 0 => bt.left!.get?' ((n + 2) / 2) | n_1.succ => bt.right!.get?' ((n + 2) / 2)
                              theorem Auto.BinTree.get?'_leaf {α : Type u_1} (n : Nat) :
                              @[irreducible]
                              def Auto.BinTree.insert'WF {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                              Equations
                              Instances For
                                theorem Auto.BinTree.insert'WF.succSucc {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                                bt.insert'WF (n + 2) x = match (n + 2).mod 2 with | 0 => match bt with | leaf => (leaf.insert'WF ((n + 2).div 2) x).node none leaf | l.node v r => (l.insert'WF ((n + 2).div 2) x).node v r | n_1.succ => match bt with | leaf => leaf.node none (leaf.insert'WF ((n + 2).div 2) x) | l.node v r => l.node v (r.insert'WF ((n + 2).div 2) x)
                                def Auto.BinTree.insert'Aux {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) (rd : Nat) :
                                Equations
                                Instances For
                                  theorem Auto.BinTree.insert'Aux.equiv {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) (rd : Nat) :
                                  rd nbt.insert'Aux n x rd = bt.insert'WF n x
                                  def Auto.BinTree.insert' {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                                  Equations
                                  Instances For
                                    def Auto.BinTree.insert {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                                    Equations
                                    Instances For
                                      theorem Auto.BinTree.insert'.equiv {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                                      bt.insert' n x = bt.insert'WF n x
                                      theorem Auto.BinTree.insert'.succSucc {α : Type u_1} (bt : BinTree α) (n : Nat) (x : α) :
                                      bt.insert' (n + 2) x = match (n + 2) % 2 with | 0 => match bt with | leaf => (leaf.insert' ((n + 2) / 2) x).node none leaf | l.node v r => (l.insert' ((n + 2) / 2) x).node v r | n_1.succ => match bt with | leaf => leaf.node none (leaf.insert' ((n + 2) / 2) x) | l.node v r => l.node v (r.insert' ((n + 2) / 2) x)
                                      theorem Auto.BinTree.insert'.correct₁ {β : Type u_1} (bt : BinTree β) (n : Nat) (x : β) :
                                      n 0(bt.insert' n x).get?' n = some x
                                      theorem Auto.BinTree.insert.correct₁ {β : Type u_1} (bt : BinTree β) (n : Nat) (x : β) :
                                      (bt.insert n x).get? n = some x
                                      theorem Auto.BinTree.insert'.correct₂ {β : Type u_1} (bt : BinTree β) (n₁ n₂ : Nat) (x : β) :
                                      n₁ n₂(bt.insert' n₁ x).get?' n₂ = bt.get?' n₂
                                      theorem Auto.BinTree.insert.correct₂ {β : Type u_1} (bt : BinTree β) (n₁ n₂ : Nat) (x : β) (H : n₁ n₂) :
                                      (bt.insert n₁ x).get? n₂ = bt.get? n₂
                                      def Auto.BinTree.foldl {α : Sort u_1} {β : Type u_2} (f : αβα) (init : α) :
                                      BinTree βα

                                      Depth-first preorder traversal of the BinTree

                                      Equations
                                      Instances For
                                        theorem Auto.BinTree.foldl_inv {α : Sort u_1} {β : Type u_2} {f : αβα} {init : α} {bt : BinTree β} (inv : αProp) (zero : inv init) (ind : ∀ (a : α) (b : β), inv ainv (f a b)) :
                                        inv (foldl f init bt)
                                        def Auto.BinTree.allp' {α : Type u_1} (p : αProp) (bt : BinTree α) :
                                        Equations
                                        Instances For
                                          def Auto.BinTree.allp {α : Type u_1} (p : αProp) (bt : BinTree α) :
                                          Equations
                                          Instances For
                                            theorem Auto.BinTree.allp_equiv {α✝ : Type u_1} {p : α✝Prop} {bt : BinTree α✝} :
                                            allp' p bt allp p bt
                                            theorem Auto.BinTree.allp'_leaf {α : Type u_1} (p : αProp) :
                                            theorem Auto.BinTree.allp'_node {α : Type u_1} {l : BinTree α} {x : Option α} {r : BinTree α} (p : αProp) :
                                            allp' p (l.node x r) allp' p l Option.allp p x allp' p r
                                            theorem Auto.BinTree.allp'_insert' {α : Type u_1} (p : αProp) (bt : BinTree α) (n : Nat) (x : α) :
                                            allp' p (bt.insert' n x) (n 0p x) ∀ (n' : Nat), n' nOption.allp p (bt.get?' n')
                                            theorem Auto.BinTree.allp_insert {α : Type u_1} (p : αProp) (bt : BinTree α) (n : Nat) (x : α) :
                                            allp p (bt.insert n x) p x ∀ (n' : Nat), n' nOption.allp p (bt.get? n')
                                            def Auto.BinTree.all {α : Type u_1} (p : αBool) :
                                            BinTree αBool
                                            Equations
                                            Instances For
                                              theorem Auto.BinTree.all_with_init {α : Type u_1} (p : αBool) (bt : BinTree α) (init : Bool) :
                                              foldl (fun (i : Bool) (x : α) => i && p x) init bt = (all p bt && init)
                                              theorem Auto.BinTree.all_node {α : Type u_1} {l : BinTree α} {x : Option α} {r : BinTree α} (p : αBool) :
                                              all p (l.node x r) = (all p l && Option.all p x && all p r)
                                              theorem Auto.BinTree.all_allp' {α : Type u_1} (p : αBool) (bt : BinTree α) :
                                              all p bt = true allp' (fun (x : α) => p x = true) bt
                                              theorem Auto.BinTree.all_allp {α : Type u_1} (p : αBool) (bt : BinTree α) :
                                              all p bt = true allp (fun (x : α) => p x = true) bt
                                              theorem Auto.BinTree.all_spec' {α : Type u_1} (p : αBool) (bt : BinTree α) :
                                              all p bt = true ∀ (n : Nat), Option.all p (bt.get?' n) = true
                                              theorem Auto.BinTree.all_spec {α : Type u_1} (p : αBool) (bt : BinTree α) :
                                              all p bt = true ∀ (n : Nat), Option.all p (bt.get? n) = true
                                              theorem Auto.BinTree.all_insert' {α : Type u_1} (p : αBool) (bt : BinTree α) (n : Nat) (x : α) :
                                              all p (bt.insert' n x) = true (n 0p x = true) ∀ (n' : Nat), n' nOption.all p (bt.get?' n') = true
                                              theorem Auto.BinTree.all_insert {α : Type u_1} (p : αBool) (bt : BinTree α) (n : Nat) (x : α) :
                                              all p (bt.insert n x) = true p x = true ∀ (n' : Nat), n' nOption.all p (bt.get? n') = true
                                              def Auto.BinTree.mapOpt {α : Type u_1} {β : Type u_2} (f : αOption β) :
                                              BinTree αBinTree β
                                              Equations
                                              Instances For
                                                theorem Auto.BinTree.mapOpt_allp' {α : Type u_1} {β : Type u_2} (f : αOption β) (p : βProp) (bt : BinTree α) :
                                                allp' p (mapOpt f bt) allp' (fun (x : α) => Option.allp p (f x)) bt
                                                theorem Auto.BinTree.mapOpt_allp {α : Type u_1} {β : Type u_2} (f : αOption β) (p : βProp) (bt : BinTree α) :
                                                allp p (mapOpt f bt) allp (fun (x : α) => Option.allp p (f x)) bt
                                                theorem Auto.BinTree.get?'_mapOpt {α : Type u_1} {β : Type u_2} {n : Nat} (f : αOption β) (bt : BinTree α) :
                                                (mapOpt f bt).get?' n = (bt.get?' n).bind f
                                                theorem Auto.BinTree.get?_mapOpt {α : Type u_1} {β : Type u_2} {n : Nat} (f : αOption β) (bt : BinTree α) :
                                                (mapOpt f bt).get? n = (bt.get? n).bind f
                                                def Auto.BinTree.ofListGet {α : Type u_1} (xs : List α) :
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  partial def Auto.BinTree.ofListFoldl {α : Type u_1} (xs : List α) :

                                                  Property : xs.foldl f init = (ofListFoldl xs).foldl f init

                                                  def Auto.BinTree.toLCtx {α : Type u} [ToLevel] [Lean.ToExpr α] (bl : BinTree α) (default : α) :

                                                  Given a bl : BinTree α, return Lean.toExpr (fun n => (BinTree.get? bl n).getD default)

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    def Auto.BinTree.get?Pos {α : Type u_1} (bt : BinTree α) (p : Pos) :
                                                    Equations
                                                    Instances For
                                                      theorem Auto.BinTree.insertPos.correct₁ {β : Type u_1} (bt : BinTree β) (p : Pos) (x : β) :
                                                      (bt.insertPos p x).get?Pos p = some x
                                                      theorem Auto.BinTree.insertPos.correct₂ {β : Type u_1} (bt : BinTree β) (p₁ p₂ : Pos) (x : β) :
                                                      p₁ p₂(bt.insertPos p₁ x).get?Pos p₂ = bt.get?Pos p₂
                                                      def Auto.BinTree.allpPos {α : Type u_1} (p : αProp) (bt : BinTree α) :
                                                      Equations
                                                      Instances For
                                                        theorem Auto.BinTree.allpPos_leaf {α : Type u_1} (p : αProp) :
                                                        theorem Auto.BinTree.allpPos_node {α : Type u_1} {l : BinTree α} {x : Option α} {r : BinTree α} (p : αProp) :
                                                        theorem Auto.BinTree.allpPos_insert {α : Type u_1} (p : αProp) (bt : BinTree α) (q : Pos) (x : α) :
                                                        allpPos p (bt.insertPos q x) p x ∀ (q' : Pos), q q'Option.allp p (bt.get?Pos q')
                                                        theorem Auto.BinTree.mapOpt_allpPos {α : Type u_1} {β : Type u_2} (f : αOption β) (p : βProp) (bt : BinTree α) :
                                                        allpPos p (mapOpt f bt) allpPos (fun (x : α) => Option.allp p (f x)) bt
                                                        def Auto.BinTree.toLCtxPos {α : Type u} [ToLevel] [Lean.ToExpr α] (bl : BinTree α) (default : α) :

                                                        Given a bl : BinTree α, return Lean.toExpr (fun n => (BinTree.get?Pos bl n).getD default)

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