annotate Paper/src/agda-term.agda.replaced @ 0:c59202657321

init
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Tue, 02 Nov 2021 06:55:58 +0900
parents
children 339fb67b4375
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 module agda-term where
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Data.Nat.Base
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Relation.Binary.PropositionalEquality
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 +zero : {y : @$\mathbb{N}$@} @$\rightarrow$@ y + zero @$\equiv$@ y
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 +zero {zero} = refl
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 +zero {suc y} = cong (@$\lambda$@ yy @$\rightarrow$@ suc yy) (+zero {y})
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 +-suc : {x y : @$\mathbb{N}$@} @$\rightarrow$@ x + suc y @$\equiv$@ suc (x + y)
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 +-suc {zero} {y} = refl
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 +-suc {suc x} {y} = cong suc (+-suc {x} {y})
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 +-comm : (x y : @$\mathbb{N}$@) @$\rightarrow$@ x + y @$\equiv$@ y + x
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 +-comm zero y rewrite (+zero {y}) = refl
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 +-comm (suc x) y = let open @$\equiv$@-Reasoning in
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 begin
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 suc (x + y) @$\equiv$@@$\langle$@@$\rangle$@
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 suc (x + y) @$\equiv$@@$\langle$@ cong suc (+-comm x y) @$\rangle$@
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 suc (y + x) @$\equiv$@@$\langle$@ sym (+-suc {y} {x}) @$\rangle$@
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 y + suc x @$\blacksquare$@
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 +-come : (x y : @$\mathbb{N}$@) @$\rightarrow$@ x + y @$\equiv$@ y + x
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 +-come zero y rewrite (+zero {y}) = refl
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 +-come (suc x) y
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 rewrite (cong suc (+-come x y)) | sym (+-suc {y} {x}) = refl
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28