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 φAmodE=-1modE
Assertion modexp2m1d φA2modE=1

Proof

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