MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  modval Structured version   Visualization version   GIF version

Theorem modval 13834
Description: The value of the modulo operation. The modulo congruence notation of number theory, 𝐽𝐾 (modulo 𝑁), can be expressed in our notation as (𝐽 mod 𝑁) = (𝐾 mod 𝑁). 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.)
Assertion
Ref Expression
modval ((𝐴 ∈ ℝ ∧ 𝐵 ∈ ℝ+) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))

Proof of Theorem modval
Dummy variables 𝑥 𝑦 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 fvoveq1 7425 . . . 4 (𝑥 = 𝐴 → (⌊‘(𝑥 / 𝑦)) = (⌊‘(𝐴 / 𝑦)))
21oveq2d 7418 . . 3 (𝑥 = 𝐴 → (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦))))
3 oveq12 7411 . . 3 ((𝑥 = 𝐴 ∧ (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦)))) → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))))
42, 3mpdan 684 . 2 (𝑥 = 𝐴 → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))))
5 oveq2 7410 . . . . 5 (𝑦 = 𝐵 → (𝐴 / 𝑦) = (𝐴 / 𝐵))
65fveq2d 6886 . . . 4 (𝑦 = 𝐵 → (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵)))
7 oveq12 7411 . . . 4 ((𝑦 = 𝐵 ∧ (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵))) → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵))))
86, 7mpdan 684 . . 3 (𝑦 = 𝐵 → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵))))
98oveq2d 7418 . 2 (𝑦 = 𝐵 → (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))
10 df-mod 13833 . 2 mod = (𝑥 ∈ ℝ, 𝑦 ∈ ℝ+ ↦ (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))))
11 ovex 7435 . 2 (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))) ∈ V
124, 9, 10, 11ovmpo 7561 1 ((𝐴 ∈ ℝ ∧ 𝐵 ∈ ℝ+) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wa 395   = wceq 1533  wcel 2098  cfv 6534  (class class class)co 7402  cr 11106   · cmul 11112  cmin 11442   / cdiv 11869  +crp 12972  cfl 13753   mod cmo 13832
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1789  ax-4 1803  ax-5 1905  ax-6 1963  ax-7 2003  ax-8 2100  ax-9 2108  ax-10 2129  ax-11 2146  ax-12 2163  ax-ext 2695  ax-sep 5290  ax-nul 5297  ax-pr 5418
This theorem depends on definitions:  df-bi 206  df-an 396  df-or 845  df-3an 1086  df-tru 1536  df-fal 1546  df-ex 1774  df-nf 1778  df-sb 2060  df-mo 2526  df-eu 2555  df-clab 2702  df-cleq 2716  df-clel 2802  df-nfc 2877  df-ne 2933  df-ral 3054  df-rex 3063  df-rab 3425  df-v 3468  df-sbc 3771  df-dif 3944  df-un 3946  df-in 3948  df-ss 3958  df-nul 4316  df-if 4522  df-sn 4622  df-pr 4624  df-op 4628  df-uni 4901  df-br 5140  df-opab 5202  df-id 5565  df-xp 5673  df-rel 5674  df-cnv 5675  df-co 5676  df-dm 5677  df-iota 6486  df-fun 6536  df-fv 6542  df-ov 7405  df-oprab 7406  df-mpo 7407  df-mod 13833
This theorem is referenced by:  modvalr  13835  modcl  13836  mod0  13839  modge0  13842  modlt  13843  moddiffl  13845  modfrac  13847  modmulnn  13852  zmodcl  13854  modid  13859  modcyc  13869  modadd1  13871  modmul1  13887  moddi  13902  modsubdir  13903  modirr  13905  iexpcyc  14169  digit2  14197  dvdsmod  16271  divalgmod  16348  modgcd  16473  bezoutlem3  16482  prmdiv  16719  odzdvds  16729  fldivp1  16831  mulgmodid  19032  odmodnn0  19452  odmod  19458  gexdvds  19496  zringlpirlem3  21321  sineq0  26377  efif1olem2  26396  lgseisenlem4  27230  dchrisumlem1  27341  ostth2lem2  27486  sineq0ALT  44212  ltmod  44864  fourierswlem  45456
  Copyright terms: Public domain W3C validator