Metamath Proof Explorer


Theorem modvalp1

Description: The value of the modulo operation (expressed with sum of denominator and nominator). (Contributed by Alexander van der Vekens, 14-Apr-2018)

Ref Expression
Assertion modvalp1 A B + A + B - A B + 1 B = A mod B

Proof

Step Hyp Ref Expression
1 recn A A
2 1 adantr A B + A
3 refldivcl A B + A B
4 3 recnd A B + A B
5 rpcn B + B
6 5 adantl A B + B
7 4 6 mulcld A B + A B B
8 2 7 6 pnpcan2d A B + A + B - A B B + B = A A B B
9 4 6 adddirp1d A B + A B + 1 B = A B B + B
10 9 oveq2d A B + A + B - A B + 1 B = A + B - A B B + B
11 modvalr A B + A mod B = A A B B
12 8 10 11 3eqtr4d A B + A + B - A B + 1 B = A mod B