HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulefin-0.3.2Haskell2010

Data.Type.Nat.LE

Less-than-or-equal relation for (unary) natural numbers Nat.

There are at least three ways to encode this relation.

  • zero : 0 \le m and succ : n \le m \to 1 + n \le 1 + m (this module),

  • refl : n \le n and step : n \le m \to n \le 1 + m (Data.Type.Nat.LE.ReflStep),

  • ex : \exists p. n + p \equiv m (tricky in Haskell).

Depending on a situation, usage ergonomics are different.

  • 1 type
  • 1 class
  • 13 values
  • Packagefin-0.3.2
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceLE.hs

Relation

3 declarations
classclass LE (n :: Nat) (m :: Nat) where
#

Total order of Nat, less-than-or-Equal-to, \le .

Methods

Instances2LE
  • LE 'Z mDefined in fin-0.3.2 · Data.Type.Nat.LE
  • (m ~ 'S m', LE n m') => LE ('S n) mDefined in fin-0.3.2 · Data.Type.Nat.LE
datadata LEProof (n :: Nat) (m :: Nat) where
#

An evidence of n \le m. zero+succ definition.

Constructors

Instances6Eq, Ord, Show, Absurd, Boring, Decidable

Decidability

1 declaration

Lemmas

0 declarations

Constructor like

Partial order

valueleAsym :: LEProof n m -> LEProof m n -> n :~: m
#

\forall n\, m : \mathbb{N}, n \le m \to m \le n \to n \equiv m

Total order

valueleSwap' :: LEProof n m -> LEProof ('S m) n -> void
#

\forall n\, m : \mathbb{N}, n \le m \to \neg (1 + m \le n)

Example1 expression
leProof :: LEProof Nat2 Nat3LESucc (LESucc LEZero)
Example1 expression
leSwap (leSwap' (leProof :: LEProof Nat2 Nat3))LESucc (LESucc (LESucc LEZero))
Example1 expression
lePred (leSwap (leSwap' (leProof :: LEProof Nat2 Nat3)))LESucc (LESucc LEZero)

More