Files
agdaproofs/Numbers/Naturals/Definition.agda
2019-11-17 17:37:10 +00:00

32 lines
953 B
Agda
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# OPTIONS --warning=error --safe --without-K #-}
open import LogicalFormulae
module Numbers.Naturals.Definition where
data : Set where
zero :
succ :
infix 100 succ
{-# BUILTIN NATURAL #-}
succInjective : {a b : } (succ a succ b) a b
succInjective {a} {.a} refl = refl
naughtE : {a : } zero succ a False
naughtE ()
aIsNotSuccA : (a : ) (a succ a) False
aIsNotSuccA zero pr = naughtE pr
aIsNotSuccA (succ a) pr = aIsNotSuccA a (succInjective pr)
DecideEquality : (a b : ) ((a b) || ((a b) False))
DecideEquality zero zero = inl refl
DecideEquality zero (succ b) = inr (λ ())
DecideEquality (succ a) zero = inr (λ ())
DecideEquality (succ a) (succ b) with DecideEquality a b
DecideEquality (succ a) (succ b) | inl x = inl (applyEquality succ x)
DecideEquality (succ a) (succ b) | inr x = inr λ pr x (succInjective pr)