{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.Type.Nat.LT (
LT (..),
LTProof,
withLTProof,
ltReflAbsurd,
ltSymAbsurd,
ltTrans,
) where
import Data.Type.Nat
import Data.Type.Nat.LE
type LTProof n m = LEProof ('S n) m
class LT (n :: Nat) (m :: Nat) where
ltProof :: LTProof n m
instance LE ('S n) m => LT n m where
ltProof = leProof
withLTProof :: LTProof n m -> (LT n m => r) -> r
withLTProof p f = withLEProof p f
ltReflAbsurd :: LTProof n n -> a
ltReflAbsurd (LESucc p) = ltReflAbsurd p
ltSymAbsurd :: LTProof n m -> LTProof m n -> a
ltSymAbsurd (LESucc p) (LESucc q) = ltSymAbsurd p q
ltTrans :: LTProof n m -> LTProof m p -> LTProof n p
ltTrans p (LESucc q) = leStep $ leTrans p q