Metamath Proof Explorer


Theorem summodnegmod

Description: The sum of two integers modulo a positive integer equals zero iff the first of the two integers equals the negative of the other integer modulo the positive integer. (Contributed by AV, 25-Jul-2021)

Ref Expression
Assertion summodnegmod A B N A + B mod N = 0 A mod N = B mod N

Proof

Step Hyp Ref Expression
1 simp3 A B N N
2 simp1 A B N A
3 znegcl B B
4 3 3ad2ant2 A B N B
5 moddvds N A B A mod N = B mod N N A B
6 1 2 4 5 syl3anc A B N A mod N = B mod N N A B
7 zcn A A
8 zcn B B
9 7 8 anim12i A B A B
10 9 3adant3 A B N A B
11 subneg A B A B = A + B
12 11 eqcomd A B A + B = A B
13 10 12 syl A B N A + B = A B
14 13 breq2d A B N N A + B N A B
15 zaddcl A B A + B
16 15 3adant3 A B N A + B
17 dvdsval3 N A + B N A + B A + B mod N = 0
18 1 16 17 syl2anc A B N N A + B A + B mod N = 0
19 6 14 18 3bitr2rd A B N A + B mod N = 0 A mod N = B mod N