3UNR6V4M3O7ABUVW7NXBQFPKQXOXIDIGPRNJKMEMQXIOQRN2W6RAC -> {auto heightCheck : diff leftHeight rightHeight `LTE` 1}-- TODO: Figure out how to make Idris2 happy about this signature-- -> {auto leftBoundOk : (optional leftBounds ((`LT` @{o} pivot) . Builtin.snd) Unit)}-- -> {auto rightBoundOk : (optional rightBounds ((`GT` @{o} pivot) . Builtin.fst) Unit)}
-> {auto heightOk : diff leftHeight rightHeight `LTE` 1}-> {auto leftBoundOk : (optional leftBounds ((\b => LT @{o} b pivot) . Builtin.snd) Unit)}-> {auto rightBoundOk : (optional rightBounds ((\b => GT @{o} b pivot) . Builtin.fst) Unit)}
IsNode : NonEmpty (Node _ _ _ @{o})
IsNode : {leftTree : AVLTree t leftHeight leftBounds {o}}-> {pivot : t}-> {rightTree : AVLTree t rightHeight rightBounds {o}}-> {auto leftBound : (optional leftBounds ((\b => LT @{o} b pivot) . Builtin.snd) Unit)}-> {auto rightBound : (optional rightBounds ((\b => GT @{o} b pivot) . Builtin.fst) Unit)}-> {auto height : diff leftHeight rightHeight `LTE` 1}-> NonEmpty (Node leftTree pivot rightTree {leftHeight} {rightHeight})
-> {auto heightCheck : diff h1 h2 `LTE` 1}-> RotatableLeft (Node leftTree _ rightTree {heightCheck=ok})
-> {auto leftBound : (optional leftBounds ((\b => LT @{o} b pivot) . Builtin.snd) Unit)}-> {auto rightBound : (optional rightBounds ((\b => GT @{o} b pivot) . Builtin.fst) Unit)}-> {auto height : diff leftHeight rightHeight `LTE` 1}-> RotatableLeft (Node leftTree pivot rightTree {leftHeight} {rightHeight})
IsRotatableRight : {h1, h2 : Natural} -> {leftTree : AVLTree t h1 b1 {o}} -> {rightTree : AVLTree t h2 b2 {o}}-> {auto leftNonEmpty : NonEmpty leftTree}-> {auto heightCheck : diff h1 h2 `LTE` 1}-> RotatableRight (Node leftTree _ rightTree {leftHeight=h1} {rightHeight=h2} {heightCheck=heightCheck})
IsRotatableRight : {leftTree : AVLTree t leftHeight leftBounds {o}}-> {pivot : t}-> {rightTree : AVLTree t rightHeight rightBounds {o}}-> {auto leftNonEmpty : NonEmpty leftTree}-> {auto leftBound : (optional leftBounds ((\b => LT @{o} b pivot) . Builtin.snd) Unit)}-> {auto rightBound : (optional rightBounds ((\b => GT @{o} b pivot) . Builtin.fst) Unit)}-> {auto height : diff leftHeight rightHeight `LTE` 1}-> RotatableRight (Node leftTree pivot rightTree {leftHeight} {rightHeight})
IsRotatableRight {heightCheck} => ?holeRotateRightpartialinsert : Order t => AVLTree t h b {o} -> (x : t)-> Either(AVLTree t h (Some (optional b (min x . Builtin.fst) x, optional b (max x . Builtin.snd) x)) {o})(AVLTree t (Succesor h) (Some (optional b (min x . Builtin.fst) x, optional b (max x . Builtin.snd) x)) {o})insert Empty x = Right $ Node Empty x Emptyinsert (Node leftTree pivot rightTree {leftHeight} {rightHeight}) x =case compare x pivot of(Left equiv) => Left $ ?hole1(Right (Left lt)) => ?hole2(Right (Right gt)) => ?hole3
IsRotatableRight {height} => ?holeRotateRight