File size: 588 Bytes
eec79f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Mathlib

/-- A large power of x has the stated residue. -/
theorem congr_pow (x : ℤ) (h : x ≡ 5 [ZMOD 12]) :
    x ^ 36 ≡ 1 [ZMOD 12] := by
  refine (h.pow 36).trans ?_
  norm_num [Int.ModEq]

/-- The combined expression has the stated residue. -/
theorem congr_product (x y : ℤ) (hx : x ≡ 5 [ZMOD 12]) (hy : y ≡ 11 [ZMOD 12]) :
    x ^ 36 * y ^ 39 + 6 ≡ 5 [ZMOD 12] := by
  have h1 := congr_pow x hx
  have h2 : y ^ 39 ≡ 11 [ZMOD 12] := by
    refine (hy.pow 39).trans ?_
    norm_num [Int.ModEq]
  refine ((h1.mul h2).add_right 6).trans ?_
  norm_num [Int.ModEq]