<?xml version="1.0"?>
<div class="add">

<b>let </b><font color="Maroon" title="c1">a</font> be   <a href="int_1.html#NM1" title="INT_1:NM.1">Integer</a>;<br/><b>let </b><font color="Maroon" title="c2">p</font> be   <a href="newton.html#NM1" title="NEWTON:NM.1">Prime</a>;<br/>



<b>assume </b><a NAME="E1:37"/><i><font color="Green" title="E28">A1</font></i>: 
( <font color="Maroon" title="c2">p</font> <a href="xxreal_0.html#NR4" title="XXREAL_0:NR.4">&gt;</a> 2 &amp; <font color="Maroon" title="c1">a</font> <a href="int_2.html#K3" title="INT_2:func.3">gcd</a> <font color="Maroon" title="c2">p</font> <a href="hidden.html#R1" title="HIDDEN:pred.1">=</a> 1 )
 ;<br/>

<a NAME="E2:37"/><i><font color="Green" title="E29">A2</font></i>: 
<font color="Maroon" title="c2">p</font> <a href="xxreal_0.html#NR4" title="XXREAL_0:NR.4">&gt;</a> 1
 
<b>by </b><i><a class="ref" href="int_2.html#D5" title="INT_2:def.5">INT_2:def 5</a></i>;<br/>
<a NAME="E3:37"/><b>then </b>
 <a href="xcmplx_0.html#K4" title="XCMPLX_0:func.4">-</a> <font color="Maroon" title="c2">p</font> <a href="xxreal_0.html#NR3" title="XXREAL_0:NR.3">&lt;</a>  <a href="xcmplx_0.html#K4" title="XCMPLX_0:func.4">-</a> 1
 
<b>by </b><i><a class="ref" href="xreal_1.html#T26" title="XREAL_1:th.26">XREAL_1:26</a></i>;<br/>
<a NAME="E4:37"/><b>then </b><i><font color="Green" title="E30">A3</font></i>: 
<span class="p1">(<span class="default"><a href="xcmplx_0.html#K4" title="XCMPLX_0:func.4">-</a> 1</span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font> <a href="hidden.html#R1" title="HIDDEN:pred.1">=</a> <font color="Maroon" title="c2">p</font> <a href="xcmplx_0.html#K2" title="XCMPLX_0:func.2">+</a> <span class="p1">(<span class="default"><a href="xcmplx_0.html#K4" title="XCMPLX_0:func.4">-</a> 1</span>)</span>
 
<b>by </b><i><a class="ref" href="int_3.html#T10" title="INT_3:th.10">INT_3:10</a></i>;<br/>
<div><a class="txt" onclick="hsNdiv(this)" href="javascript:()" title="37_1"><b>per </b></a><a class="txt" onclick="hs(this)" href="javascript:()"><b>cases </b></a><span class="hide"><a NAME="E1:37_1"/>
( <font color="Maroon" title="c1">a</font> <a href="int_5.html#R1" title="INT_5:pred.1">is_quadratic_residue_mod</a> <font color="Maroon" title="c2">p</font> or  not <font color="Maroon" title="c1">a</font> <a href="int_5.html#R1" title="INT_5:pred.1">is_quadratic_residue_mod</a> <font color="Maroon" title="c2">p</font> )
 </span>;<br/><div class="add"><div><a class="txt" onclick="hsNdiv(this)" href="javascript:()" title="37_1_1"><b>suppose </b></a><a NAME="E1:37_1_1"/><i><font color="Green" title="E31">A4</font></i>: 
<font color="Maroon" title="c1">a</font> <a href="int_5.html#R1" title="INT_5:pred.1">is_quadratic_residue_mod</a> <font color="Maroon" title="c2">p</font>
 ;<br/><div class="add"><a NAME="E2:37_1_1"/><b>then </b>
<span class="p1">(<span class="default"><font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p2">(<span class="default"><span class="p3">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font> <a href="hidden.html#R1" title="HIDDEN:pred.1">=</a> 1
 <b>by </b><i><a class="txt" href="int_5.html#E1:37"><i><font color="Green" title="E28">A1</font></i></a>, <a class="ref" href="int_5.html#T17" target="_self" title="INT_5:th.17">Th17</a></i>;<br/><a NAME="E3:37_1_1"/><b>then </b>
<span class="p1">(<span class="default"><font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p2">(<span class="default"><span class="p3">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font> <a href="hidden.html#R1" title="HIDDEN:pred.1">=</a> 1 <a href="nat_d.html#K4" title="NAT_D:func.4">mod</a> <font color="Maroon" title="c2">p</font>
 <b>by </b><i><a class="txt" href="int_5.html#E2:37"><i><font color="Green" title="E29">A2</font></i></a>, <a class="ref" href="nat_d.html#T14" title="NAT_D:th.14">NAT_D:14</a></i>;<br/><a NAME="E4:37_1_1"/><b>then </b>
<span class="p1">(<span class="default"><font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p2">(<span class="default"><span class="p3">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font> <a href="hidden.html#R1" title="HIDDEN:pred.1">=</a> <span class="p1">(<span class="default"><a href="int_5.html#K2" title="INT_5:func.2">Lege</a> <font color="Maroon" title="c1">a</font>,<font color="Maroon" title="c2">p</font></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font>
 <b>by </b><i><a class="txt" href="int_5.html#E1:37_1_1"><i><font color="Green" title="E31">A4</font></i></a>, <a class="ref" href="int_5.html#D3" target="_self" title="INT_5:def.3">Def3</a></i>;<br/><b>hence </b><a NAME="E5:37_1_1"/>
 <a href="int_5.html#K2" title="INT_5:func.2">Lege</a> <font color="Maroon" title="c1">a</font>,<font color="Maroon" title="c2">p</font>,<font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p1">(<span class="default"><span class="p2">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span> <a href="int_1.html#R1" title="INT_1:pred.1">are_congruent_mod</a> <font color="Maroon" title="c2">p</font>
 <b>by </b><i><a class="ref" href="int_3.html#T12" title="INT_3:th.12">INT_3:12</a></i>;<br/></div><b>end;</b></div><div><a class="txt" onclick="hsNdiv(this)" href="javascript:()" title="37_1_2"><b>suppose </b></a><a NAME="E1:37_1_2"/><i><font color="Green" title="E31">A5</font></i>: 
not <font color="Maroon" title="c1">a</font> <a href="int_5.html#R1" title="INT_5:pred.1">is_quadratic_residue_mod</a> <font color="Maroon" title="c2">p</font>
 ;<br/><div class="add"><b>then </b><span class="p1">(<span class="default"><font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p2">(<span class="default"><span class="p3">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font> = 
<font color="Maroon" title="c2">p</font> <a href="xcmplx_0.html#K6" title="XCMPLX_0:func.6">-</a> 1
<b>by </b><i><a class="txt" href="int_5.html#E1:37"><i><font color="Green" title="E28">A1</font></i></a>, <a class="ref" href="int_5.html#T19" target="_self" title="INT_5:th.19">Th19</a></i>
<br/>.= 
<span class="p1">(<span class="default"><a href="int_5.html#K2" title="INT_5:func.2">Lege</a> <font color="Maroon" title="c1">a</font>,<font color="Maroon" title="c2">p</font></span>)</span> <a href="int_1.html#K6" title="INT_1:func.6">mod</a> <font color="Maroon" title="c2">p</font>
<b>by </b><i><a class="txt" href="int_5.html#E4:37"><i><font color="Green" title="E30">A3</font></i></a>, <a class="txt" href="int_5.html#E1:37_1_2"><i><font color="Green" title="E31">A5</font></i></a>, <a class="ref" href="int_5.html#D3" target="_self" title="INT_5:def.3">Def3</a></i>
;<br/><b>hence </b><a NAME="E3:37_1_2"/>
 <a href="int_5.html#K2" title="INT_5:func.2">Lege</a> <font color="Maroon" title="c1">a</font>,<font color="Maroon" title="c2">p</font>,<font color="Maroon" title="c1">a</font> <a href="newton.html#K2" title="NEWTON:func.2">|^</a> <span class="p1">(<span class="default"><span class="p2">(<span class="default"><font color="Maroon" title="c2">p</font> <a href="binarith.html#K3" title="BINARITH:func.3">-'</a> 1</span>)</span> <a href="nat_d.html#K3" title="NAT_D:func.3">div</a> 2</span>)</span> <a href="int_1.html#R1" title="INT_1:pred.1">are_congruent_mod</a> <font color="Maroon" title="c2">p</font>
 <b>by </b><i><a class="ref" href="int_3.html#T12" title="INT_3:th.12">INT_3:12</a></i>;<br/></div><b>end;</b></div></div><b>end;</b></div>

</div>
