Copyright | (c) Nicolás Rodríguez 2021 |
---|---|
License | GPL-3 |
Maintainer | Nicolás Rodríguez |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Implementation of the deletion algorithm over internalist BST trees, along with the necessary proofs to ensure (at compile time) that the key ordering still holds.
Synopsis
- class MaxKeyDeletable (t :: Tree) where
- type MaxKeyDelete (t :: Tree) :: Tree
- maxKeyDelete :: t ~ 'ForkTree l (Node n a1) r => BST t -> BST (MaxKeyDelete t)
- class Maxable (t :: Tree) where
- class Deletable (x :: Nat) (t :: Tree) where
- class Deletable' (x :: Nat) (t :: Tree) (o :: Ordering) where
- class ProofLtNDelete' (x :: Nat) (t :: Tree) (n :: Nat) (o :: Ordering) where
- class ProofGtNDelete' (x :: Nat) (t :: Tree) (n :: Nat) (o :: Ordering) where
- class ProofGTMaxKey (t :: Tree) (n :: Nat) where
- class ProofGtNMaxKeyDelete (t :: Tree) (n :: Nat) where
- proofGtNMaxKeyDelete :: GtN t n ~ 'True => BST t -> Proxy n -> GtN (MaxKeyDelete t) n :~: 'True
- class ProofLTMaxKey (t :: Tree) (n :: Nat) where
- class ProofLtNMaxKeyDelete (t :: Tree) (n :: Nat) where
- proofLtNMaxKeyDelete :: LtN t n ~ 'True => BST t -> Proxy n -> LtN (MaxKeyDelete t) n :~: 'True
Documentation
class MaxKeyDeletable (t :: Tree) where Source #
This type class provides the functionality to delete the node with maximum key value
in a BST
t
.
The deletion is defined at the value level and the type level.
type MaxKeyDelete (t :: Tree) :: Tree Source #
maxKeyDelete :: t ~ 'ForkTree l (Node n a1) r => BST t -> BST (MaxKeyDelete t) Source #
class Maxable (t :: Tree) where Source #
This type class provides the functionality to get the key, type and value of the node
with maximum key value in a BST
t
.
The lookup is defined at the value level and the type level.
Since the keys are only kept at the type level,
there's no value level getter of the maximum key.
class Deletable (x :: Nat) (t :: Tree) where Source #
This type class provides the functionality to delete a node with key x
in a BST
t
.
The deletion is defined at the value level and the type level.
The returned tree verifies the BST invariant.
class Deletable' (x :: Nat) (t :: Tree) (o :: Ordering) where Source #
class ProofLtNDelete' (x :: Nat) (t :: Tree) (n :: Nat) (o :: Ordering) where Source #
class ProofGtNDelete' (x :: Nat) (t :: Tree) (n :: Nat) (o :: Ordering) where Source #
class ProofGTMaxKey (t :: Tree) (n :: Nat) where Source #
class ProofGtNMaxKeyDelete (t :: Tree) (n :: Nat) where Source #
class ProofLTMaxKey (t :: Tree) (n :: Nat) where Source #
Prove that in a BST
t
which verifies that LtN t n ~ 'True
,
the maximum key of t
is also less than n
.
This proof is needed for the delete operation.