Files
agdaproofs/Numbers/Integers/Definition.agda
2020-04-16 13:41:51 +01:00

30 lines
1.2 KiB
Agda
Raw Permalink 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 --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Numbers.Naturals.Definition
module Numbers.Integers.Definition where
data : Set where
nonneg :
negSucc :
{-# BUILTIN INTEGER #-}
{-# BUILTIN INTEGERPOS nonneg #-}
{-# BUILTIN INTEGERNEGSUC negSucc #-}
nonnegInjective : {a b : } nonneg a nonneg b a b
nonnegInjective refl = refl
negSuccInjective : {a b : } negSucc a negSucc b a b
negSuccInjective refl = refl
DecideEquality : (a b : ) ((a b) || ((a b) False))
DecideEquality (nonneg x) (nonneg y) with DecideEquality x y
DecideEquality (nonneg x) (nonneg y) | inl eq = inl (applyEquality nonneg eq)
DecideEquality (nonneg x) (nonneg y) | inr non = inr λ i non (nonnegInjective i)
DecideEquality (nonneg x) (negSucc y) = inr λ ()
DecideEquality (negSucc x) (nonneg x₁) = inr λ ()
DecideEquality (negSucc x) (negSucc y) with DecideEquality x y
DecideEquality (negSucc x) (negSucc y) | inl eq = inl (applyEquality negSucc eq)
DecideEquality (negSucc x) (negSucc y) | inr non = inr λ i non (negSuccInjective i)