Metamath Proof Explorer


Theorem modval

Description: The value of the modulo operation. The modulo congruence notation of number theory, J == K (modulo N ), can be expressed in our notation as ( J mod N ) = ( K mod N ) . Definition 1 in Knuth,The Art of Computer Programming, Vol. I (1972), p. 38. Knuth uses "mod" for the operation and "modulo" for the congruence. Unlike Knuth, we restrict the second argument to positive reals to simplify certain theorems. (This also gives us future flexibility to extend it to any one of several different conventions for a zero or negative second argument, should there be an advantage in doing so.) (Contributed by NM, 10-Nov-2008) (Revised by Mario Carneiro, 3-Nov-2013)

Ref Expression
Assertion modval A B + A mod B = A B A B

Proof

Step Hyp Ref Expression
1 fvoveq1 x = A x y = A y
2 1 oveq2d x = A y x y = y A y
3 oveq12 x = A y x y = y A y x y x y = A y A y
4 2 3 mpdan x = A x y x y = A y A y
5 oveq2 y = B A y = A B
6 5 fveq2d y = B A y = A B
7 oveq12 y = B A y = A B y A y = B A B
8 6 7 mpdan y = B y A y = B A B
9 8 oveq2d y = B A y A y = A B A B
10 df-mod mod = x , y + x y x y
11 ovex A B A B V
12 4 9 10 11 ovmpo A B + A mod B = A B A B