@[irreducible]
def
Auto.Bin.inductionOn
{motive : Nat → Sort u}
(ind : (x : Nat) → motive ((x + 2) / 2) → motive (x + 2))
(base₀ : motive 0)
(base₁ : motive 1)
(x : Nat)
:
motive x
Equations
- Auto.Bin.inductionOn ind base₀ base₁ 0 = base₀
- Auto.Bin.inductionOn ind base₀ base₁ 1 = base₁
- Auto.Bin.inductionOn ind base₀ base₁ x'.succ.succ = ind x' (Auto.Bin.inductionOn ind base₀ base₁ ((x' + 2) / 2))
Instances For
@[irreducible]
def
Auto.Bin.induction
{motive : Nat → Sort u}
(ind : (x : Nat) → motive ((x + 2) / 2) → motive (x + 2))
(base₀ : motive 0)
(base₁ : motive 1)
(x : Nat)
:
motive x
Equations
- Auto.Bin.induction ind base₀ base₁ x = Auto.Bin.inductionOn ind base₀ base₁ x
Instances For
Equations
- Auto.instReprBinTree = { reprPrec := Auto.reprBinTree✝ }
instance
Auto.instToExprBinTreeOfToLevel
{α✝ : Type u}
[Lean.ToExpr α✝]
[ToLevel]
:
Lean.ToExpr (BinTree α✝)
Equations
- Auto.instToExprBinTreeOfToLevel = { toExpr := Auto.toExprBinTree✝, toTypeExpr := (Lean.Expr.const `Auto.BinTree [Auto.toLevel]).app (Lean.toTypeExpr α✝) }
Equations
- Auto.BinTree.instInhabited = { default := Auto.BinTree.leaf }
Equations
- Auto.BinTree.instBEq = { beq := Auto.BinTree.beq }
Equations
Instances For
Equations
- bt.toStringDisplay = Auto.BinTree.toStringDisplayAux✝ "R" bt
Instances For
Equations
- Auto.BinTree.leaf.left! = Auto.BinTree.leaf
- (a.node a_1 a_2).left! = a
Instances For
Equations
- Auto.BinTree.leaf.right! = Auto.BinTree.leaf
- (a.node a_1 a_2).right! = a_2
Instances For
@[irreducible]
Equations
Instances For
Equations
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- bt.insert'WF 0 x = bt
- Auto.BinTree.leaf.insert'WF 1 x = Auto.BinTree.leaf.node (some x) Auto.BinTree.leaf
- (a.node a_1 a_2).insert'WF 1 x = a.node (some x) a_2
- (a.node a_1 a_2).insert'WF x'.succ.succ x = match x'.succ.succ.mod 2 with | 0 => (a.insert'WF (x'.succ.succ.div 2) x).node a_1 a_2 | n.succ => a.node a_1 (a_2.insert'WF (x'.succ.succ.div 2) x)
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)
Equations
- One or more equations did not get rendered due to their size.
- bt.insert'Aux n x 0 = bt
- bt.insert'Aux 0 x n_1.succ = bt
- Auto.BinTree.leaf.insert'Aux 1 x n_1.succ = Auto.BinTree.leaf.node (some x) Auto.BinTree.leaf
- (a.node a_1 a_2).insert'Aux 1 x n_1.succ = a.node (some x) a_2
Instances For
theorem
Auto.BinTree.insert'Aux.equiv
{α : Type u_1}
(bt : BinTree α)
(n : Nat)
(x : α)
(rd : Nat)
:
rd ≥ n → bt.insert'Aux n x rd = bt.insert'WF n x
Equations
- bt.insert' n x = bt.insert'Aux n x n
Instances For
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)
Depth-first preorder traversal of the BinTree
Equations
- Auto.BinTree.foldl f init Auto.BinTree.leaf = init
- Auto.BinTree.foldl f init (a.node (some x_2) a_2) = Auto.BinTree.foldl f (f (Auto.BinTree.foldl f init a) x_2) a_2
- Auto.BinTree.foldl f init (a.node none a_2) = Auto.BinTree.foldl f (Auto.BinTree.foldl f init a) a_2
Instances For
Equations
- Auto.BinTree.allp' p bt = ∀ (n : Nat), Auto.Option.allp p (bt.get?' n)
Instances For
Equations
- Auto.BinTree.allp p bt = ∀ (n : Nat), Auto.Option.allp p (bt.get? n)
Instances For
Equations
- Auto.BinTree.all p = Auto.BinTree.foldl (fun (i : Bool) (x : α) => i && p x) true
Instances For
Equations
- Auto.BinTree.mapOpt f Auto.BinTree.leaf = Auto.BinTree.leaf
- Auto.BinTree.mapOpt f (a.node a_1 a_2) = (Auto.BinTree.mapOpt f a).node (a_1.bind f) (Auto.BinTree.mapOpt f a_2)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
Equations
- Auto.BinTree.leaf.insertPos Auto.Pos.xH x = Auto.BinTree.leaf.node (some x) Auto.BinTree.leaf
- (a.node a_1 a_2).insertPos Auto.Pos.xH x = a.node (some x) a_2
- Auto.BinTree.leaf.insertPos p'.xO x = (Auto.BinTree.leaf.insertPos p' x).node none Auto.BinTree.leaf
- (a.node a_1 a_2).insertPos p'.xO x = (a.insertPos p' x).node a_1 a_2
- Auto.BinTree.leaf.insertPos p'.xI x = Auto.BinTree.leaf.node none (Auto.BinTree.leaf.insertPos p' x)
- (a.node a_1 a_2).insertPos p'.xI x = a.node a_1 (a_2.insertPos p' x)
Instances For
Equations
- Auto.BinTree.allpPos p bt = ∀ (q : Auto.Pos), Auto.Option.allp p (bt.get?Pos q)
Instances For
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.