Metamath Proof Explorer


Theorem addmodidr

Description: The sum of a positive integer and a nonnegative integer less than the positive integer is equal to the nonnegative integer modulo the positive integer. (Contributed by AV, 19-Mar-2021)

Ref Expression
Assertion addmodidr A 0 M A < M A + M mod M = A

Proof

Step Hyp Ref Expression
1 nn0cn A 0 A
2 nncn M M
3 addcom A M A + M = M + A
4 1 2 3 syl2an A 0 M A + M = M + A
5 4 3adant3 A 0 M A < M A + M = M + A
6 5 oveq1d A 0 M A < M A + M mod M = M + A mod M
7 addmodid A 0 M A < M M + A mod M = A
8 6 7 eqtrd A 0 M A < M A + M mod M = A