Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7e70ebd

Browse files
kim-emmergify[bot]
authored andcommitted
feat(data/nat/basic): b = c if b - a = c - a (#862)
1 parent 3000f32 commit 7e70ebd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/data/nat/basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ by rw [add_comm, nat.sub_add_cancel h]
127127
protected theorem sub_eq_of_eq_add (h : k = m + n) : k - m = n :=
128128
begin rw [h, nat.add_sub_cancel_left] end
129129

130+
theorem sub_cancel {a b c : ℕ} (h₁ : a ≤ b) (h₂ : a ≤ c) (w : b - a = c - a) : b = c :=
131+
by rw [←nat.sub_add_cancel h₁, ←nat.sub_add_cancel h₂, w]
132+
130133
lemma sub_sub_sub_cancel_right {a b c : ℕ} (h₂ : c ≤ b) : (a - c) - (b - c) = a - b :=
131134
by rw [nat.sub_sub, ←nat.add_sub_assoc h₂, nat.add_sub_cancel_left]
132135

0 commit comments

Comments
 (0)