Skip to content

Commit b814e05

Browse files
Tanebandreasabel
authored andcommitted
Move suc≢0 slightly and add suc-injective to Data.Nat.Binary.Properties
1 parent efa58ed commit b814e05

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,10 @@ Other minor changes
20402040
+-*-rawSemiring : RawSemiring 0ℓ 0ℓ
20412041
```
20422042

2043+
* Added a new proof to `Data.Nat.Binary.Properties`:
2044+
```agda
2045+
suc-injective : Injective _≡_ _≡_ suc
2046+
```
20432047

20442048
* Added new definitions and proofs to `Data.Nat.Primality`:
20452049
```agda

src/Data/Nat/Binary/Properties.agda

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,18 @@ double-suc x = begin
13091309
-- Properties of suc
13101310
------------------------------------------------------------------------
13111311

1312+
suc≢0 : suc x ≢ zero
1313+
suc≢0 {zero} ()
1314+
suc≢0 {2[1+ _ ]} ()
1315+
suc≢0 {1+[2 _ ]} ()
1316+
1317+
suc-injective : Injective _≡_ _≡_ suc
1318+
suc-injective {zero} {zero} p = refl
1319+
suc-injective {zero} {2[1+ y ]} p = contradiction 1+[2 p ]-injective (suc≢0 ∘ sym)
1320+
suc-injective {2[1+ x ]} {zero} p = contradiction 1+[2 p ]-injective suc≢0
1321+
suc-injective {2[1+ x ]} {2[1+ y ]} p = cong 2[1+_] (suc-injective 1+[2 p ]-injective)
1322+
suc-injective {1+[2 x ]} {1+[2 y ]} refl = refl
1323+
13121324
2[1+_]-double-suc : 2[1+_] ≗ double ∘ suc
13131325
2[1+_]-double-suc zero = refl
13141326
2[1+_]-double-suc 2[1+ x ] = cong 2[1+_] (2[1+_]-double-suc x)
@@ -1325,11 +1337,6 @@ double-suc x = begin
13251337
suc (double 1+[2 x ]) ∎
13261338
where open ≡-Reasoning; 2x = double x
13271339

1328-
suc≢0 : suc x ≢ zero
1329-
suc≢0 {zero} ()
1330-
suc≢0 {2[1+ _ ]} ()
1331-
suc≢0 {1+[2 _ ]} ()
1332-
13331340
x+suc[y]≡suc[x]+y : x y x + suc y ≡ suc x + y
13341341
x+suc[y]≡suc[x]+y x y = begin
13351342
x + suc y ≡⟨ +-comm x _ ⟩

0 commit comments

Comments
 (0)