Simpler proof

jozefg 2014-07-02 03:07:59.388021 UTC

1module teaching where
2open import Data.Nat
3open import Data.Empty
4open import Data.Product
5open import Relation.Binary.PropositionalEquality
6open import Relation.Nullary
7
8postulate unsafeDiv :
9
10div : (top bot :) ¬ (bot ≡ 0)
11div top zero p = ⊥-elim (p refl) -- The absurd case
12div top (suc bot) p = unsafeDiv top (suc bot) -- The normal case
13
14
15-- Some example usages
16
17obviously-not-zero : {n :} ¬ (suc n ≡ 0)
18obviously-not-zero () -- The proof is trivial
19
20test :
21test = div 5 2 obviously-not-zero
22
23test2 :
24test2 = div 0 2 obviously-not-zero
25
26test3 :
27test3 = div 1 6 obviously-not-zero