annotate paper/src/Reasoning.agda.replaced @ 4:bf1f62556b81

add while_test_init_imple
author soto
date Thu, 11 Feb 2021 17:03:31 +0900
parents 959f4b34d6f4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
1 open import Relation.Binary.PropositionalEquality
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
2 open import nat
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
3 open import nat_add
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
4 open @$\equiv$@-Reasoning
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
5
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
6 module nat_add_sym_reasoning where
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
7
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
8 addToRight : (n m : Nat) @$\rightarrow$@ S (n + m) @$\equiv$@ n + (S m)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
9 addToRight O m = refl
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
10 addToRight (S n) m = cong S (addToRight n m)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
11
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
12 addSym : (n m : Nat) @$\rightarrow$@ n + m @$\equiv$@ m + n
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
13 addSym O O = refl
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
14 addSym O (S m) = cong S (addSym O m)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
15 addSym (S n) O = cong S (addSym n O)
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
16 addSym (S n) (S m) = begin
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
17 (S n) + (S m) @$\equiv$@@$\langle$@ refl @$\rangle$@
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
18 S (n + S m) @$\equiv$@@$\langle$@ cong S (addSym n (S m)) @$\rangle$@
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
19 S ((S m) + n) @$\equiv$@@$\langle$@ addToRight (S m) n @$\rangle$@
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
20 S (m + S n) @$\equiv$@@$\langle$@ refl @$\rangle$@
959f4b34d6f4 add final thesis
soto
parents:
diff changeset
21 (S m) + (S n) @$\blacksquare$@