| Intuitionistic Logic Explorer |
< Previous
Next >
Nearby theorems |
||
| Mirrors > Home > ILE Home > Th. List > modqval | GIF version | ||
| 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 10629 we only prove this for rationals although other particular kinds of real numbers may be possible. (Contributed by Jim Kingdon, 16-Oct-2021.) |
| Ref | Expression |
|---|---|
| modqval | ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵))))) |
| Step | Hyp | Ref | Expression |
|---|---|---|---|
| 1 | qre 9953 | . . 3 ⊢ (𝐴 ∈ ℚ → 𝐴 ∈ ℝ) | |
| 2 | 1 | 3ad2ant1 1045 | . 2 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐴 ∈ ℝ) |
| 3 | qre 9953 | . . . 4 ⊢ (𝐵 ∈ ℚ → 𝐵 ∈ ℝ) | |
| 4 | 3 | 3ad2ant2 1046 | . . 3 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ∈ ℝ) |
| 5 | simp3 1026 | . . 3 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 0 < 𝐵) | |
| 6 | 4, 5 | elrpd 10022 | . 2 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ∈ ℝ+) |
| 7 | 5 | gt0ne0d 8782 | . . . . . . 7 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → 𝐵 ≠ 0) |
| 8 | qdivcl 9971 | . . . . . . 7 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 𝐵 ≠ 0) → (𝐴 / 𝐵) ∈ ℚ) | |
| 9 | 7, 8 | syld3an3 1319 | . . . . . 6 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 / 𝐵) ∈ ℚ) |
| 10 | 9 | flqcld 10633 | . . . . 5 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (⌊‘(𝐴 / 𝐵)) ∈ ℤ) |
| 11 | 10 | zred 9696 | . . . 4 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (⌊‘(𝐴 / 𝐵)) ∈ ℝ) |
| 12 | 4, 11 | remulcld 8300 | . . 3 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐵 · (⌊‘(𝐴 / 𝐵))) ∈ ℝ) |
| 13 | 2, 12 | resubcld 8650 | . 2 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))) ∈ ℝ) |
| 14 | oveq1 6056 | . . . . . 6 ⊢ (𝑥 = 𝐴 → (𝑥 / 𝑦) = (𝐴 / 𝑦)) | |
| 15 | 14 | fveq2d 5673 | . . . . 5 ⊢ (𝑥 = 𝐴 → (⌊‘(𝑥 / 𝑦)) = (⌊‘(𝐴 / 𝑦))) |
| 16 | 15 | oveq2d 6065 | . . . 4 ⊢ (𝑥 = 𝐴 → (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦)))) |
| 17 | oveq12 6058 | . . . 4 ⊢ ((𝑥 = 𝐴 ∧ (𝑦 · (⌊‘(𝑥 / 𝑦))) = (𝑦 · (⌊‘(𝐴 / 𝑦)))) → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦))))) | |
| 18 | 16, 17 | mpdan 421 | . . 3 ⊢ (𝑥 = 𝐴 → (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦)))) = (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦))))) |
| 19 | oveq2 6057 | . . . . . 6 ⊢ (𝑦 = 𝐵 → (𝐴 / 𝑦) = (𝐴 / 𝐵)) | |
| 20 | 19 | fveq2d 5673 | . . . . 5 ⊢ (𝑦 = 𝐵 → (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵))) |
| 21 | oveq12 6058 | . . . . 5 ⊢ ((𝑦 = 𝐵 ∧ (⌊‘(𝐴 / 𝑦)) = (⌊‘(𝐴 / 𝐵))) → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵)))) | |
| 22 | 20, 21 | mpdan 421 | . . . 4 ⊢ (𝑦 = 𝐵 → (𝑦 · (⌊‘(𝐴 / 𝑦))) = (𝐵 · (⌊‘(𝐴 / 𝐵)))) |
| 23 | 22 | oveq2d 6065 | . . 3 ⊢ (𝑦 = 𝐵 → (𝐴 − (𝑦 · (⌊‘(𝐴 / 𝑦)))) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵))))) |
| 24 | df-mod 10681 | . . 3 ⊢ mod = (𝑥 ∈ ℝ, 𝑦 ∈ ℝ+ ↦ (𝑥 − (𝑦 · (⌊‘(𝑥 / 𝑦))))) | |
| 25 | 18, 23, 24 | ovmpog 6187 | . 2 ⊢ ((𝐴 ∈ ℝ ∧ 𝐵 ∈ ℝ+ ∧ (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵)))) ∈ ℝ) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵))))) |
| 26 | 2, 6, 13, 25 | syl3anc 1274 | 1 ⊢ ((𝐴 ∈ ℚ ∧ 𝐵 ∈ ℚ ∧ 0 < 𝐵) → (𝐴 mod 𝐵) = (𝐴 − (𝐵 · (⌊‘(𝐴 / 𝐵))))) |
| Colors of variables: wff set class |
| Syntax hints: → wi 4 ∧ w3a 1005 = wceq 1398 ∈ wcel 2203 ≠ wne 2412 class class class wbr 4108 ‘cfv 5351 (class class class)co 6049 ℝcr 8122 0cc0 8123 · cmul 8128 < clt 8304 − cmin 8440 / cdiv 8942 ℚcq 9947 ℝ+crp 9982 ⌊cfl 10624 mod cmo 10680 |
| 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 619 ax-in2 620 ax-io 717 ax-5 1496 ax-7 1497 ax-gen 1498 ax-ie1 1542 ax-ie2 1543 ax-8 1553 ax-10 1554 ax-11 1555 ax-i12 1556 ax-bndl 1558 ax-4 1559 ax-17 1575 ax-i9 1579 ax-ial 1583 ax-i5r 1584 ax-13 2205 ax-14 2206 ax-ext 2214 ax-sep 4227 ax-pow 4286 ax-pr 4321 ax-un 4553 ax-setind 4658 ax-cnex 8214 ax-resscn 8215 ax-1cn 8216 ax-1re 8217 ax-icn 8218 ax-addcl 8219 ax-addrcl 8220 ax-mulcl 8221 ax-mulrcl 8222 ax-addcom 8223 ax-mulcom 8224 ax-addass 8225 ax-mulass 8226 ax-distr 8227 ax-i2m1 8228 ax-0lt1 8229 ax-1rid 8230 ax-0id 8231 ax-rnegex 8232 ax-precex 8233 ax-cnre 8234 ax-pre-ltirr 8235 ax-pre-ltwlin 8236 ax-pre-lttrn 8237 ax-pre-apti 8238 ax-pre-ltadd 8239 ax-pre-mulgt0 8240 ax-pre-mulext 8241 ax-arch 8242 |
| This theorem depends on definitions: df-bi 117 df-3or 1006 df-3an 1007 df-tru 1401 df-fal 1404 df-nf 1510 df-sb 1812 df-eu 2083 df-mo 2084 df-clab 2219 df-cleq 2225 df-clel 2228 df-nfc 2373 df-ne 2413 df-nel 2508 df-ral 2525 df-rex 2526 df-reu 2527 df-rmo 2528 df-rab 2529 df-v 2814 df-sbc 3042 df-csb 3138 df-dif 3212 df-un 3214 df-in 3216 df-ss 3223 df-pw 3670 df-sn 3694 df-pr 3695 df-op 3697 df-uni 3914 df-int 3949 df-iun 3992 df-br 4109 df-opab 4171 df-mpt 4172 df-id 4413 df-po 4416 df-iso 4417 df-xp 4754 df-rel 4755 df-cnv 4756 df-co 4757 df-dm 4758 df-rn 4759 df-res 4760 df-ima 4761 df-iota 5311 df-fun 5353 df-fn 5354 df-f 5355 df-fv 5359 df-riota 6002 df-ov 6052 df-oprab 6053 df-mpo 6054 df-1st 6333 df-2nd 6334 df-pnf 8306 df-mnf 8307 df-xr 8308 df-ltxr 8309 df-le 8310 df-sub 8442 df-neg 8443 df-reap 8845 df-ap 8852 df-div 8943 df-inn 9234 df-n0 9493 df-z 9574 df-q 9948 df-rp 9983 df-fl 10626 df-mod 10681 |
| This theorem is referenced by: modqvalr 10683 modqcl 10684 modq0 10687 modqge0 10690 modqlt 10691 modqdiffl 10693 modqfrac 10695 modqmulnn 10700 zmodcl 10702 modqid 10707 modqcyc 10717 modqadd1 10719 modqmul1 10735 modqdi 10750 modqsubdir 10751 iexpcyc 11002 dvdsmod 12541 divalgmod 12606 modgcd 12680 prmdiv 12925 odzdvds 12936 fldivp1 13039 mulgmodid 13867 lgseisenlem4 15933 |
| Copyright terms: Public domain | W3C validator |