-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOPE.agda
56 lines (46 loc) · 1.67 KB
/
OPE.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
44
45
46
47
48
49
50
51
52
53
54
55
56
module OPE where
open import Basics
data _<=_ : Nat -> Nat -> Set where
oz : ze <= ze
os : forall {n m} -> n <= m -> su n <= su m
o' : forall {n m} -> n <= m -> n <= su m
oi : forall {n} -> n <= n
oi {ze} = oz
oi {su x} = os oi
_-<-_ : forall {n m l} -> m <= l -> n <= m -> n <= l
oz -<- oz = oz
os th -<- os ph = os (th -<- ph)
os th -<- o' ph = o' (th -<- ph)
o' th -<- ph = o' (th -<- ph)
_-<-oiQ : forall {n m}(th : n <= m) -> (th -<- oi) == th
oz -<-oiQ = refl
os th -<-oiQ rewrite th -<-oiQ = refl
o' th -<-oiQ rewrite th -<-oiQ = refl
oi-<-Q : forall {n m}(th : n <= m) -> (oi -<- th) == th
oi-<-Q oz = refl
oi-<-Q (os th) rewrite oi-<-Q th = refl
oi-<-Q (o' th) rewrite oi-<-Q th = refl
thin : forall {n m} -> n <= m -> Fin n -> Fin m
thin oz ()
thin (o' th) i = su (thin th i)
thin (os th) ze = ze
thin (os th) (su i) = su (thin th i)
oiQ : forall {n}(i : Fin n) -> thin oi i == i
oiQ ze = refl
oiQ (su i) rewrite oiQ i = refl
thinCo : forall {n m l}(th : m <= l)(ph : n <= m)(i : Fin n) ->
thin th (thin ph i) == thin (th -<- ph) i
thinCo oz oz ()
thinCo (os th) (os ph) ze = refl
thinCo (os th) (os ph) (su i) rewrite thinCo th ph i = refl
thinCo (os th) (o' ph) i rewrite thinCo th ph i = refl
thinCo (o' th) ph i rewrite thinCo th ph i = refl
thinInj : forall {n m}(th : m <= n){i j : Fin m}
-> thin th i == thin th j -> i == j
thinInj th {ze} {ze} p = refl
thinInj (os th) {ze} {su j} ()
thinInj (o' th) {ze} {su j} p = thinInj th (suInj p)
thinInj (os th) {su i} {ze} ()
thinInj (o' th) {su i} {ze} p = thinInj th (suInj p)
thinInj (os th) {su i} {su j} p rewrite thinInj th (suInj p) = refl
thinInj (o' th) {su i} {su j} p rewrite thinInj th (suInj p) = refl