forked from Saizan/cubical-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInt.agda
43 lines (33 loc) · 959 Bytes
/
Int.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module Int where
open import Data.Product
open import PathPrelude
open import GradLemma
-- open import Data.Nat renaming (ℕ to Nat) public
data Nat : Set where
zero : Nat
suc : Nat -> Nat
data Int : Set where
pos : (n : Nat) → Int
negsuc : (n : Nat) → Int
sucZ : Int → Int
sucZ (pos n) = pos (suc n)
sucZ (negsuc zero) = pos zero
sucZ (negsuc (suc n)) = negsuc n
predZ : Int → Int
predZ (pos zero) = negsuc zero
predZ (pos (suc n)) = pos n
predZ (negsuc n) = negsuc (suc n)
suc-pred : ∀ i → sucZ (predZ i) ≡ i
suc-pred (pos zero) = refl
suc-pred (pos (suc n)) = refl
suc-pred (negsuc zero) = refl
suc-pred (negsuc (suc n)) = refl
pred-suc : ∀ i → predZ (sucZ i) ≡ i
pred-suc (pos zero) = refl
pred-suc (pos (suc n)) = refl
pred-suc (negsuc zero) = refl
pred-suc (negsuc (suc n)) = refl
open import Univalence
open import GradLemma
sucPathZ : Int ≡ Int
sucPathZ = ua (sucZ , gradLemma sucZ predZ suc-pred pred-suc)