Metamath Proof Explorer


Theorem modexp2m1d

Description: The square of an integer which is -1 modulo a number greater than 1 is 1 modulo the same modulus. (Contributed by AV, 5-Jul-2020)

Ref Expression
Hypotheses modexp2m1d.a φ A
modexp2m1d.e φ E +
modexp2m1d.g φ 1 < E
modexp2m1d.m φ A mod E = -1 mod E
Assertion modexp2m1d φ A 2 mod E = 1

Proof

Step Hyp Ref Expression
1 modexp2m1d.a φ A
2 modexp2m1d.e φ E +
3 modexp2m1d.g φ 1 < E
4 modexp2m1d.m φ A mod E = -1 mod E
5 1 zcnd φ A
6 5 sqvald φ A 2 = A A
7 6 oveq1d φ A 2 mod E = A A mod E
8 neg1z 1
9 8 a1i φ 1
10 1 9 1 9 2 4 4 modmul12d φ A A mod E = -1 -1 mod E
11 7 10 eqtrd φ A 2 mod E = -1 -1 mod E
12 neg1mulneg1e1 -1 -1 = 1
13 12 a1i φ -1 -1 = 1
14 13 oveq1d φ -1 -1 mod E = 1 mod E
15 2 rpred φ E
16 1mod E 1 < E 1 mod E = 1
17 15 3 16 syl2anc φ 1 mod E = 1
18 14 17 eqtrd φ -1 -1 mod E = 1
19 11 18 eqtrd φ A 2 mod E = 1