Metamath Proof Explorer


Theorem modn0mul

Description: If an integer is not 0 modulo a positive integer, this integer must be the sum of a multiple of the modulus and a positive integer less than the modulus. (Contributed by AV, 7-Jun-2020)

Ref Expression
Assertion modn0mul ⊢ A ∈ ℤ ∧ N ∈ ℕ → A mod N ≠ 0 → ∃ x ∈ ℤ ∃ y ∈ 1 ..^ N A = x ⋅ N + y

Proof

Step Hyp Ref Expression
1 zre ⊢ A ∈ ℤ → A ∈ ℝ
2 1 adantr ⊢ A ∈ ℤ ∧ N ∈ ℕ → A ∈ ℝ
3 nnre ⊢ N ∈ ℕ → N ∈ ℝ
4 3 adantl ⊢ A ∈ ℤ ∧ N ∈ ℕ → N ∈ ℝ
5 nnne0 ⊢ N ∈ ℕ → N ≠ 0
6 5 adantl ⊢ A ∈ ℤ ∧ N ∈ ℕ → N ≠ 0
7 2 4 6 redivcld ⊢ A ∈ ℤ ∧ N ∈ ℕ → A N ∈ ℝ
8 7 flcld ⊢ A ∈ ℤ ∧ N ∈ ℕ → A N ∈ ℤ
9 8 adantr ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A N ∈ ℤ
10 zmodfzo ⊢ A ∈ ℤ ∧ N ∈ ℕ → A mod N ∈ 0 ..^ N
11 10 anim1i ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A mod N ∈ 0 ..^ N ∧ A mod N ≠ 0
12 fzo1fzo0n0 ⊢ A mod N ∈ 1 ..^ N ↔ A mod N ∈ 0 ..^ N ∧ A mod N ≠ 0
13 11 12 sylibr ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A mod N ∈ 1 ..^ N
14 nnrp ⊢ N ∈ ℕ → N ∈ ℝ +
15 1 14 anim12i ⊢ A ∈ ℤ ∧ N ∈ ℕ → A ∈ ℝ ∧ N ∈ ℝ +
16 15 adantr ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A ∈ ℝ ∧ N ∈ ℝ +
17 flpmodeq ⊢ A ∈ ℝ ∧ N ∈ ℝ + → A N ⋅ N + A mod N = A
18 16 17 syl ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A N ⋅ N + A mod N = A
19 18 eqcomd ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → A = A N ⋅ N + A mod N
20 oveq1 ⊢ x = A N → x ⋅ N = A N ⋅ N
21 20 oveq1d ⊢ x = A N → x ⋅ N + y = A N ⋅ N + y
22 21 eqeq2d ⊢ x = A N → A = x ⋅ N + y ↔ A = A N ⋅ N + y
23 oveq2 ⊢ y = A mod N → A N ⋅ N + y = A N ⋅ N + A mod N
24 23 eqeq2d ⊢ y = A mod N → A = A N ⋅ N + y ↔ A = A N ⋅ N + A mod N
25 22 24 rspc2ev ⊢ A N ∈ ℤ ∧ A mod N ∈ 1 ..^ N ∧ A = A N ⋅ N + A mod N → ∃ x ∈ ℤ ∃ y ∈ 1 ..^ N A = x ⋅ N + y
26 9 13 19 25 syl3anc ⊢ A ∈ ℤ ∧ N ∈ ℕ ∧ A mod N ≠ 0 → ∃ x ∈ ℤ ∃ y ∈ 1 ..^ N A = x ⋅ N + y
27 26 ex ⊢ A ∈ ℤ ∧ N ∈ ℕ → A mod N ≠ 0 → ∃ x ∈ ℤ ∃ y ∈ 1 ..^ N A = x ⋅ N + y