ILE Home Intuitionistic Logic Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  ILE Home  >  Th. List  >  modqval GIF version

Theorem modqval 10476
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 numbers 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.) As with flqcl 10423 we only prove this for rationals although other particular kinds of real numbers may be possible. (Contributed by Jim Kingdon, 16-Oct-2021.)
Assertion
Ref Expression
modqval ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))

Proof of Theorem modqval
Dummy variables 𝑥 𝑦 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 qre 9753 . . 3 (𝐴 ∈ ℚ → 𝐴 ∈ ℝ)
213ad2ant1 1021 . 2 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐴 ∈ ℝ)
3 qre 9753 . . . 4 (𝐵 ∈ ℚ → 𝐵 ∈ ℝ)
433ad2ant2 1022 . . 3 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ∈ ℝ)
5 simp3 1002 . . 3 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 0 < 𝐵)
64, 5elrpd 9822 . 2 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ∈ ℝ+)
75gt0ne0d 8592 . . . . . . 7 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ≠ 0)
8 qdivcl 9771 . . . . . . 7 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 𝐵 ≠ 0) → (𝐴 / 𝐵) ∈ ℚ)
97, 8syld3an3 1295 . . . . . 6 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 / 𝐵) ∈ ℚ)
109flqcld 10427 . . . . 5 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (⌊‘(𝐴 / 𝐵)) ∈ ℤ)
1110zred 9502 . . . 4 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (⌊‘(𝐴 / 𝐵)) ∈ ℝ)
124, 11remulcld 8110 . . 3 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐵 · (⌊‘(𝐴 / 𝐵))) ∈ ℝ)
132, 12resubcld 8460 . 2 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))) ∈ ℝ)
14 oveq1 5958 . . . . . 6 (𝑥 = 𝐴 → (𝑥 / 𝑦) = (𝐴 / 𝑦))
1514fveq2d 5587 . . . . 5 (𝑥 = 𝐴 → (⌊‘(𝑥 / 𝑦)) = (⌊‘(𝐴 / 𝑦)))
1615oveq2d 5967 . . . 4 (𝑥 = 𝐴 → (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦))))
17 oveq12 5960 . . . 4 ((𝑥 = 𝐴 ∧ (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦)))) → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))))
1816, 17mpdan 421 . . 3 (𝑥 = 𝐴 → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))))
19 oveq2 5959 . . . . . 6 (𝑦 = 𝐵 → (𝐴 / 𝑦) = (𝐴 / 𝐵))
2019fveq2d 5587 . . . . 5 (𝑦 = 𝐵 → (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵)))
21 oveq12 5960 . . . . 5 ((𝑦 = 𝐵 ∧ (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵))) → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵))))
2220, 21mpdan 421 . . . 4 (𝑦 = 𝐵 → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵))))
2322oveq2d 5967 . . 3 (𝑦 = 𝐵 → (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))
24 df-mod 10475 . . 3 mod = (𝑥 ∈ ℝ, 𝑦 ∈ ℝ+ ↦ (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))))
2518, 23, 24ovmpog 6087 . 2 ((𝐴 ∈ ℝ ∧ 𝐵 ∈ ℝ+ ∧ (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))) ∈ ℝ) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))
262, 6, 13, 25syl3anc 1250 1 ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))))
Colors of variables: wff set class
Syntax hints:  wi 4  w3a 981   = wceq 1373  wcel 2177  wne 2377   class class class wbr 4047  cfv 5276  (class class class)co 5951  cr 7931  0cc0 7932   · cmul 7937   < clt 8114  cmin 8250   / cdiv 8752  cq 9747  +crp 9782  cfl 10418   mod cmo 10474
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-ia1 106  ax-ia2 107  ax-ia3 108  ax-in1 615  ax-in2 616  ax-io 711  ax-5 1471  ax-7 1472  ax-gen 1473  ax-ie1 1517  ax-ie2 1518  ax-8 1528  ax-10 1529  ax-11 1530  ax-i12 1531  ax-bndl 1533  ax-4 1534  ax-17 1550  ax-i9 1554  ax-ial 1558  ax-i5r 1559  ax-13 2179  ax-14 2180  ax-ext 2188  ax-sep 4166  ax-pow 4222  ax-pr 4257  ax-un 4484  ax-setind 4589  ax-cnex 8023  ax-resscn 8024  ax-1cn 8025  ax-1re 8026  ax-icn 8027  ax-addcl 8028  ax-addrcl 8029  ax-mulcl 8030  ax-mulrcl 8031  ax-addcom 8032  ax-mulcom 8033  ax-addass 8034  ax-mulass 8035  ax-distr 8036  ax-i2m1 8037  ax-0lt1 8038  ax-1rid 8039  ax-0id 8040  ax-rnegex 8041  ax-precex 8042  ax-cnre 8043  ax-pre-ltirr 8044  ax-pre-ltwlin 8045  ax-pre-lttrn 8046  ax-pre-apti 8047  ax-pre-ltadd 8048  ax-pre-mulgt0 8049  ax-pre-mulext 8050  ax-arch 8051
This theorem depends on definitions:  df-bi 117  df-3or 982  df-3an 983  df-tru 1376  df-fal 1379  df-nf 1485  df-sb 1787  df-eu 2058  df-mo 2059  df-clab 2193  df-cleq 2199  df-clel 2202  df-nfc 2338  df-ne 2378  df-nel 2473  df-ral 2490  df-rex 2491  df-reu 2492  df-rmo 2493  df-rab 2494  df-v 2775  df-sbc 3000  df-csb 3095  df-dif 3169  df-un 3171  df-in 3173  df-ss 3180  df-pw 3619  df-sn 3640  df-pr 3641  df-op 3643  df-uni 3853  df-int 3888  df-iun 3931  df-br 4048  df-opab 4110  df-mpt 4111  df-id 4344  df-po 4347  df-iso 4348  df-xp 4685  df-rel 4686  df-cnv 4687  df-co 4688  df-dm 4689  df-rn 4690  df-res 4691  df-ima 4692  df-iota 5237  df-fun 5278  df-fn 5279  df-f 5280  df-fv 5284  df-riota 5906  df-ov 5954  df-oprab 5955  df-mpo 5956  df-1st 6233  df-2nd 6234  df-pnf 8116  df-mnf 8117  df-xr 8118  df-ltxr 8119  df-le 8120  df-sub 8252  df-neg 8253  df-reap 8655  df-ap 8662  df-div 8753  df-inn 9044  df-n0 9303  df-z 9380  df-q 9748  df-rp 9783  df-fl 10420  df-mod 10475
This theorem is referenced by:  modqvalr  10477  modqcl  10478  modq0  10481  modqge0  10484  modqlt  10485  modqdiffl  10487  modqfrac  10489  modqmulnn  10494  zmodcl  10496  modqid  10501  modqcyc  10511  modqadd1  10513  modqmul1  10529  modqdi  10544  modqsubdir  10545  iexpcyc  10796  dvdsmod  12217  divalgmod  12282  modgcd  12356  prmdiv  12601  odzdvds  12612  fldivp1  12715  mulgmodid  13541  lgseisenlem4  15594
  Copyright terms: Public domain W3C validator