:: INT_5 semantic presentation
begin
theorem Th1: :: INT_5:1
for i1, i2, i3 being Integer st i1 divides i2 & i1 divides i3 holds
i1 divides i2 - i3
proof
let i1, i2, i3 be Integer; ::_thesis: ( i1 divides i2 & i1 divides i3 implies i1 divides i2 - i3 )
assume that
A1: i1 divides i2 and
A2: i1 divides i3 ; ::_thesis: i1 divides i2 - i3
consider i4 being Integer such that
A3: i2 = i1 * i4 by A1, INT_1:def_3;
consider i5 being Integer such that
A4: i3 = i1 * i5 by A2, INT_1:def_3;
i2 - i3 = i1 * (i4 - i5) by A3, A4;
hence i1 divides i2 - i3 by INT_1:def_3; ::_thesis: verum
end;
theorem Th2: :: INT_5:2
for i, a, b being Integer st i divides a & i divides a - b holds
i divides b
proof
let i, a, b be Integer; ::_thesis: ( i divides a & i divides a - b implies i divides b )
assume that
A1: i divides a and
A2: i divides a - b ; ::_thesis: i divides b
A3: b = (- (a - b)) + a ;
i divides - (a - b) by A2, INT_2:10;
hence i divides b by A1, A3, WSIERP_1:4; ::_thesis: verum
end;
Lm1: for x, y being Integer holds
( ( x divides y implies y mod x = 0 ) & ( x <> 0 & y mod x = 0 implies x divides y ) )
proof
let x, y be Integer; ::_thesis: ( ( x divides y implies y mod x = 0 ) & ( x <> 0 & y mod x = 0 implies x divides y ) )
thus ( x divides y implies y mod x = 0 ) ::_thesis: ( x <> 0 & y mod x = 0 implies x divides y )
proof
assume x divides y ; ::_thesis: y mod x = 0
then consider i being Integer such that
A1: y = x * i by INT_1:def_3;
y mod x = ((x * i) + 0) mod x by A1
.= 0 mod x by EULER_1:12
.= 0 by INT_4:12 ;
hence y mod x = 0 ; ::_thesis: verum
end;
assume that
A2: x <> 0 and
A3: y mod x = 0 ; ::_thesis: x divides y
y = ((y div x) * x) + (y mod x) by A2, INT_1:59
.= (y div x) * x by A3 ;
hence x divides y by INT_1:def_3; ::_thesis: verum
end;
definition
let fp be FinSequence of INT ;
func Poly-INT fp -> Function of INT,INT means :Def1: :: INT_5:def 1
for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & it . x = Sum fr );
existence
ex b1 being Function of INT,INT st
for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & b1 . x = Sum fr )
proof
defpred S1[ Element of INT , set ] means ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * ($1 |^ (d -' 1)) ) & $2 = Sum fr );
A1: for x being Element of INT ex y being Element of INT st S1[x,y]
proof
let x be Element of INT ; ::_thesis: ex y being Element of INT st S1[x,y]
deffunc H1( Nat) -> set = (fp . $1) * (x |^ ($1 -' 1));
consider fr being FinSequence such that
A2: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = H1(d) ) ) from FINSEQ_1:sch_2();
for d being Nat st d in dom fr holds
fr . d in INT
proof
let d be Nat; ::_thesis: ( d in dom fr implies fr . d in INT )
assume d in dom fr ; ::_thesis: fr . d in INT
then fr . d = (fp . d) * (x |^ (d -' 1)) by A2;
hence fr . d in INT by INT_1:def_2; ::_thesis: verum
end;
then reconsider fr = fr as FinSequence of INT by FINSEQ_2:12;
take Sum fr ; ::_thesis: S1[x, Sum fr]
take fr ; ::_thesis: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & Sum fr = Sum fr )
thus ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & Sum fr = Sum fr ) by A2; ::_thesis: verum
end;
consider f being Function of INT,INT such that
A3: for x being Element of INT holds S1[x,f . x] from FUNCT_2:sch_3(A1);
take f ; ::_thesis: for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & f . x = Sum fr )
thus for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & f . x = Sum fr ) by A3; ::_thesis: verum
end;
uniqueness
for b1, b2 being Function of INT,INT st ( for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & b1 . x = Sum fr ) ) & ( for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & b2 . x = Sum fr ) ) holds
b1 = b2
proof
let f1, f2 be Function of INT,INT; ::_thesis: ( ( for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & f1 . x = Sum fr ) ) & ( for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & f2 . x = Sum fr ) ) implies f1 = f2 )
assume that
A4: for x being Element of INT ex fr1 being FinSequence of INT st
( len fr1 = len fp & ( for d being Nat st d in dom fr1 holds
fr1 . d = (fp . d) * (x |^ (d -' 1)) ) & f1 . x = Sum fr1 ) and
A5: for x being Element of INT ex fr2 being FinSequence of INT st
( len fr2 = len fp & ( for d being Nat st d in dom fr2 holds
fr2 . d = (fp . d) * (x |^ (d -' 1)) ) & f2 . x = Sum fr2 ) ; ::_thesis: f1 = f2
for x being Element of INT holds f1 . x = f2 . x
proof
let x be Element of INT ; ::_thesis: f1 . x = f2 . x
consider fr1 being FinSequence of INT such that
A6: len fr1 = len fp and
A7: for d being Nat st d in dom fr1 holds
fr1 . d = (fp . d) * (x |^ (d -' 1)) and
A8: f1 . x = Sum fr1 by A4;
consider fr2 being FinSequence of INT such that
A9: len fr2 = len fp and
A10: for d being Nat st d in dom fr2 holds
fr2 . d = (fp . d) * (x |^ (d -' 1)) and
A11: f2 . x = Sum fr2 by A5;
A12: dom fr1 = dom fr2 by A6, A9, FINSEQ_3:29;
for d being Nat st d in dom fr1 holds
fr1 . d = fr2 . d
proof
let d be Nat; ::_thesis: ( d in dom fr1 implies fr1 . d = fr2 . d )
assume A13: d in dom fr1 ; ::_thesis: fr1 . d = fr2 . d
hence fr2 . d = (fp . d) * (x |^ (d -' 1)) by A10, A12
.= fr1 . d by A7, A13 ;
::_thesis: verum
end;
hence f1 . x = f2 . x by A8, A11, A12, FINSEQ_1:13; ::_thesis: verum
end;
hence f1 = f2 by FUNCT_2:63; ::_thesis: verum
end;
end;
:: deftheorem Def1 defines Poly-INT INT_5:def_1_:_
for fp being FinSequence of INT
for b2 being Function of INT,INT holds
( b2 = Poly-INT fp iff for x being Element of INT ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) ) & b2 . x = Sum fr ) );
theorem Th3: :: INT_5:3
for fp being FinSequence of INT st len fp = 1 holds
Poly-INT fp = INT --> (fp . 1)
proof
let fp be FinSequence of INT ; ::_thesis: ( len fp = 1 implies Poly-INT fp = INT --> (fp . 1) )
assume A1: len fp = 1 ; ::_thesis: Poly-INT fp = INT --> (fp . 1)
for x being set st x in dom (Poly-INT fp) holds
(Poly-INT fp) . x = fp . 1
proof
let x be set ; ::_thesis: ( x in dom (Poly-INT fp) implies (Poly-INT fp) . x = fp . 1 )
assume x in dom (Poly-INT fp) ; ::_thesis: (Poly-INT fp) . x = fp . 1
then reconsider x = x as Element of INT ;
consider fr being FinSequence of INT such that
A2: len fr = len fp and
A3: for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) and
A4: (Poly-INT fp) . x = Sum fr by Def1;
1 in dom fr by A1, A2, FINSEQ_3:25;
then A5: fr . 1 = (fp . 1) * (x |^ (1 -' 1)) by A3
.= (fp . 1) * (x |^ 0) by XREAL_1:232
.= (fp . 1) * 1 by NEWTON:4 ;
fr = <*(fr . 1)*> by A1, A2, FINSEQ_1:40;
hence (Poly-INT fp) . x = fp . 1 by A4, A5, RVSUM_1:73; ::_thesis: verum
end;
then Poly-INT fp = (dom (Poly-INT fp)) --> (fp . 1) by FUNCOP_1:11;
hence Poly-INT fp = INT --> (fp . 1) by FUNCT_2:def_1; ::_thesis: verum
end;
theorem :: INT_5:4
for fp being FinSequence of INT st len fp = 1 holds
for x being Element of INT holds (Poly-INT fp) . x = fp . 1
proof
let fp be FinSequence of INT ; ::_thesis: ( len fp = 1 implies for x being Element of INT holds (Poly-INT fp) . x = fp . 1 )
assume A1: len fp = 1 ; ::_thesis: for x being Element of INT holds (Poly-INT fp) . x = fp . 1
let x be Element of INT ; ::_thesis: (Poly-INT fp) . x = fp . 1
consider fr being FinSequence of INT such that
A2: len fr = len fp and
A3: for d being Nat st d in dom fr holds
fr . d = (fp . d) * (x |^ (d -' 1)) and
A4: (Poly-INT fp) . x = Sum fr by Def1;
1 in dom fr by A1, A2, FINSEQ_3:25;
then A5: fr . 1 = (fp . 1) * (x |^ (1 -' 1)) by A3
.= (fp . 1) * (x |^ 0) by XREAL_1:232
.= (fp . 1) * 1 by NEWTON:4 ;
fr = <*(fr . 1)*> by A1, A2, FINSEQ_1:40;
hence (Poly-INT fp) . x = fp . 1 by A4, A5, RVSUM_1:73; ::_thesis: verum
end;
theorem Th5: :: INT_5:5
for n being Nat
for f, f1, f2 being FinSequence of REAL st len f = n + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) holds
ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . (n + 1))) - (f2 . 1) )
proof
let n be Nat; ::_thesis: for f, f1, f2 being FinSequence of REAL st len f = n + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) holds
ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . (n + 1))) - (f2 . 1) )
defpred S1[ Nat] means for f, f1, f2 being FinSequence of REAL st len f = $1 + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) holds
ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . ($1 + 1))) - (f2 . 1) );
A1: for n being Nat st S1[n] holds
S1[n + 1]
proof
let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
let f, f1, f2 be FinSequence of REAL ; ::_thesis: ( len f = (n + 1) + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) implies ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . ((n + 1) + 1))) - (f2 . 1) ) )
assume that
A3: len f = (n + 1) + 1 and
A4: len f1 = len f and
A5: len f2 = len f and
A6: for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ; ::_thesis: ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . ((n + 1) + 1))) - (f2 . 1) )
set ff1 = f1 | (Seg (n + 1));
reconsider ff1 = f1 | (Seg (n + 1)) as FinSequence of REAL by FINSEQ_1:18;
A7: len ff1 = n + 1 by A3, A4, FINSEQ_3:53;
set ff2 = f2 | (Seg (n + 1));
reconsider ff2 = f2 | (Seg (n + 1)) as FinSequence of REAL by FINSEQ_1:18;
A8: f2 = ff2 ^ <*(f2 . ((n + 1) + 1))*> by A3, A5, FINSEQ_3:55;
A9: len ff2 = n + 1 by A3, A5, FINSEQ_3:53;
then ff2 <> {} ;
then 1 in dom ff2 by FINSEQ_5:6;
then A10: ff2 . 1 = f2 . 1 by A8, FINSEQ_1:def_7;
A11: f1 = ff1 ^ <*(f1 . ((n + 1) + 1))*> by A3, A4, FINSEQ_3:55;
(n + 1) + 1 in Seg ((n + 1) + 1) by FINSEQ_1:4;
then (n + 1) + 1 in dom f by A3, FINSEQ_1:def_3;
then A12: f . ((n + 1) + 1) = (f1 . ((n + 1) + 1)) - (f2 . ((n + 1) + 1)) by A6;
set f3 = f | (Seg (n + 1));
reconsider f3 = f | (Seg (n + 1)) as FinSequence of REAL by FINSEQ_1:18;
A13: dom f3 = Seg (n + 1) by A3, FINSEQ_3:54;
then A14: len f3 = n + 1 by FINSEQ_1:def_3;
A15: f = f3 ^ <*(f . ((n + 1) + 1))*> by A3, FINSEQ_3:55;
A16: for d being Nat st d in dom f3 holds
f3 . d = (ff1 . d) - (ff2 . d)
proof
let d be Nat; ::_thesis: ( d in dom f3 implies f3 . d = (ff1 . d) - (ff2 . d) )
A17: dom f3 c= dom f by A15, FINSEQ_1:26;
assume A18: d in dom f3 ; ::_thesis: f3 . d = (ff1 . d) - (ff2 . d)
then A19: d in dom ff2 by A13, A9, FINSEQ_1:def_3;
d in dom ff1 by A13, A7, A18, FINSEQ_1:def_3;
then A20: f1 . d = ff1 . d by A11, FINSEQ_1:def_7;
f3 . d = f . d by A15, A18, FINSEQ_1:def_7
.= (f1 . d) - (f2 . d) by A6, A18, A17 ;
hence f3 . d = (ff1 . d) - (ff2 . d) by A8, A19, A20, FINSEQ_1:def_7; ::_thesis: verum
end;
ff1 <> {} by A7;
then n + 1 in dom ff1 by A7, FINSEQ_5:6;
then ff1 . (n + 1) = f1 . (n + 1) by A11, FINSEQ_1:def_7;
then consider f4 being FinSequence of REAL such that
A21: len f4 = (len f3) - 1 and
A22: for d being Nat st d in dom f4 holds
f4 . d = (ff1 . d) - (ff2 . (d + 1)) and
A23: Sum f3 = ((Sum f4) + (f1 . (n + 1))) - (f2 . 1) by A2, A14, A7, A9, A16, A10;
take f5 = f4 ^ <*((f1 . (n + 1)) - (f2 . (n + 2)))*>; ::_thesis: ( f5 is Element of bool [:NAT,REAL:] & f5 is FinSequence of REAL & len f5 = (len f) - 1 & ( for d being Nat st d in dom f5 holds
f5 . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum f5) + (f1 . ((n + 1) + 1))) - (f2 . 1) )
(f1 . (n + 1)) - (f2 . (n + 2)) is Element of REAL by XREAL_0:def_1;
then <*((f1 . (n + 1)) - (f2 . (n + 2)))*> is FinSequence of REAL by FINSEQ_1:74;
then reconsider f5 = f5 as FinSequence of REAL by FINSEQ_1:75;
A24: Sum f = (((Sum f4) + (f1 . (n + 1))) - (f2 . 1)) + (f . ((n + 1) + 1)) by A15, A23, RVSUM_1:74
.= (((Sum f4) + ((f1 . (n + 1)) - (f2 . (n + 2)))) + (f1 . ((n + 1) + 1))) - (f2 . 1) by A12
.= ((Sum f5) + (f1 . ((n + 1) + 1))) - (f2 . 1) by RVSUM_1:74 ;
A25: (len f4) + 1 = n + 1 by A13, A21, FINSEQ_1:def_3;
A26: for d being Nat st d in dom f5 holds
f5 . d = (f1 . d) - (f2 . (d + 1))
proof
let d be Nat; ::_thesis: ( d in dom f5 implies f5 . d = (f1 . d) - (f2 . (d + 1)) )
assume d in dom f5 ; ::_thesis: f5 . d = (f1 . d) - (f2 . (d + 1))
then d in Seg (len f5) by FINSEQ_1:def_3;
then d in Seg ((len f4) + 1) by FINSEQ_2:16;
then d in (Seg (len f4)) \/ {((len f4) + 1)} by FINSEQ_1:9;
then A27: ( d in Seg (len f4) or d in {((len f4) + 1)} ) by XBOOLE_0:def_3;
percases ( d in Seg (len f4) or d = (len f4) + 1 ) by A27, TARSKI:def_1;
supposeA28: d in Seg (len f4) ; ::_thesis: f5 . d = (f1 . d) - (f2 . (d + 1))
then d + 1 in Seg ((len f4) + 1) by FINSEQ_1:60;
then d + 1 in Seg (len ff2) by A3, A5, A14, A21, FINSEQ_3:53;
then A29: d + 1 in dom ff2 by FINSEQ_1:def_3;
A30: d in dom f4 by A28, FINSEQ_1:def_3;
len f4 <= len ff1 by A14, A7, A21, XREAL_1:147;
then dom f4 c= dom ff1 by FINSEQ_3:30;
then A31: f1 . d = ff1 . d by A11, A30, FINSEQ_1:def_7;
f5 . d = f4 . d by A30, FINSEQ_1:def_7
.= (ff1 . d) - (ff2 . (d + 1)) by A22, A30 ;
hence f5 . d = (f1 . d) - (f2 . (d + 1)) by A8, A31, A29, FINSEQ_1:def_7; ::_thesis: verum
end;
supposeA32: d = (len f4) + 1 ; ::_thesis: f5 . d = (f1 . d) - (f2 . (d + 1))
1 in Seg 1 by FINSEQ_1:2, TARSKI:def_1;
then 1 in dom <*((f1 . (n + 1)) - (f2 . (n + 2)))*> by FINSEQ_1:38;
then f5 . d = <*((f1 . (n + 1)) - (f2 . (n + 2)))*> . 1 by A32, FINSEQ_1:def_7
.= (f1 . d) - (f2 . (d + 1)) by A25, A32, FINSEQ_1:40 ;
hence f5 . d = (f1 . d) - (f2 . (d + 1)) ; ::_thesis: verum
end;
end;
end;
len f5 = (len f4) + 1 by FINSEQ_2:16
.= (len f) - 1 by A3, A13, A21, FINSEQ_1:def_3 ;
hence ( f5 is Element of bool [:NAT,REAL:] & f5 is FinSequence of REAL & len f5 = (len f) - 1 & ( for d being Nat st d in dom f5 holds
f5 . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum f5) + (f1 . ((n + 1) + 1))) - (f2 . 1) ) by A26, A24; ::_thesis: verum
end;
A33: S1[ 0 ]
proof
let f, f1, f2 be FinSequence of REAL ; ::_thesis: ( len f = 0 + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) implies ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . (0 + 1))) - (f2 . 1) ) )
assume that
A34: len f = 0 + 1 and
len f1 = len f and
len f2 = len f and
A35: for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ; ::_thesis: ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . (0 + 1))) - (f2 . 1) )
take <*> REAL ; ::_thesis: ( len (<*> REAL) = (len f) - 1 & ( for d being Nat st d in dom (<*> REAL) holds
(<*> REAL) . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum (<*> REAL)) + (f1 . (0 + 1))) - (f2 . 1) )
0 + 1 in Seg (0 + 1) by FINSEQ_1:4;
then 1 in dom f by A34, FINSEQ_1:def_3;
then f . 1 = (f1 . 1) - (f2 . 1) by A35;
then f = <*((f1 . 1) - (f2 . 1))*> by A34, FINSEQ_1:40;
hence ( len (<*> REAL) = (len f) - 1 & ( for d being Nat st d in dom (<*> REAL) holds
(<*> REAL) . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum (<*> REAL)) + (f1 . (0 + 1))) - (f2 . 1) ) by A34, RVSUM_1:72, RVSUM_1:73; ::_thesis: verum
end;
for n being Nat holds S1[n] from NAT_1:sch_2(A33, A1);
hence for f, f1, f2 being FinSequence of REAL st len f = n + 1 & len f1 = len f & len f2 = len f & ( for d being Nat st d in dom f holds
f . d = (f1 . d) - (f2 . d) ) holds
ex fr being FinSequence of REAL st
( len fr = (len f) - 1 & ( for d being Nat st d in dom fr holds
fr . d = (f1 . d) - (f2 . (d + 1)) ) & Sum f = ((Sum fr) + (f1 . (n + 1))) - (f2 . 1) ) ; ::_thesis: verum
end;
theorem Th6: :: INT_5:6
for n being Nat
for fp being FinSequence of INT st len fp = n + 2 holds
for a being Integer ex fr being FinSequence of INT ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
proof
let n be Nat; ::_thesis: for fp being FinSequence of INT st len fp = n + 2 holds
for a being Integer ex fr being FinSequence of INT ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
let fp be FinSequence of INT ; ::_thesis: ( len fp = n + 2 implies for a being Integer ex fr being FinSequence of INT ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) ) )
assume A1: len fp = n + 2 ; ::_thesis: for a being Integer ex fr being FinSequence of INT ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
(n + 1) + 1 in Seg ((n + 1) + 1) by FINSEQ_1:4;
then n + 2 in dom fp by A1, FINSEQ_1:def_3;
then reconsider A = fp . (n + 2) as Element of INT by FINSEQ_2:11;
reconsider n1 = n + 1 as Element of NAT ;
let a be Integer; ::_thesis: ex fr being FinSequence of INT ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
defpred S1[ Nat, Integer, set ] means $3 = (fp . ((n + 2) - $1)) + (a * $2);
A2: for d being Element of NAT st 1 <= d & d < n1 holds
for x being Element of INT ex y being Element of INT st S1[d,x,y]
proof
let d be Element of NAT ; ::_thesis: ( 1 <= d & d < n1 implies for x being Element of INT ex y being Element of INT st S1[d,x,y] )
assume that
1 <= d and
d < n1 ; ::_thesis: for x being Element of INT ex y being Element of INT st S1[d,x,y]
let x be Element of INT ; ::_thesis: ex y being Element of INT st S1[d,x,y]
set y = (fp . ((n + 2) - d)) + (a * x);
reconsider y = (fp . ((n + 2) - d)) + (a * x) as Element of INT by INT_1:def_2;
take y ; ::_thesis: S1[d,x,y]
thus S1[d,x,y] ; ::_thesis: verum
end;
consider p being FinSequence of INT such that
A3: ( len p = n1 & ( p . 1 = A or n1 = 0 ) & ( for d being Element of NAT st 1 <= d & d < n1 holds
S1[d,p . d,p . (d + 1)] ) ) from RECDEF_1:sch_4(A2);
take fr = Rev p; ::_thesis: ex r being Integer st
( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
take r = (fp . 1) + (a * (fr . 1)); ::_thesis: ( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) )
A4: len fr = n + 1 by A3, FINSEQ_5:def_3;
for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r
proof
let x be Element of INT ; ::_thesis: (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r
deffunc H1( Nat) -> set = (fr . $1) * (x |^ $1);
deffunc H2( Nat) -> set = (a * (fr . $1)) * (x |^ ($1 -' 1));
consider f1 being FinSequence of INT such that
A5: len f1 = len fp and
A6: for d being Nat st d in dom f1 holds
f1 . d = (fp . d) * (x |^ (d -' 1)) and
A7: (Poly-INT fp) . x = Sum f1 by Def1;
A8: f1 <> {} by A1, A5;
then n + 2 in dom f1 by A1, A5, FINSEQ_5:6;
then f1 . (n + 2) = (fp . (n + 2)) * (x |^ (((n + 1) + 1) -' 1)) by A6;
then A9: f1 . (n + 2) = (fp . (n + 2)) * (x |^ (n + 1)) by NAT_D:34;
f1 . 1 = (fp . 1) * (x |^ (1 -' 1)) by A6, A8, FINSEQ_5:6;
then f1 . 1 = (fp . 1) * (x |^ 0) by XREAL_1:232;
then A10: f1 . 1 = (fp . 1) * 1 by NEWTON:4;
reconsider n = n as Element of NAT by ORDINAL1:def_12;
consider f4 being FinSequence such that
A11: ( len f4 = n + 1 & ( for d being Nat st d in dom f4 holds
f4 . d = H1(d) ) ) from FINSEQ_1:sch_2();
A12: for d being Nat st d in dom f4 holds
f4 . d in INT
proof
let d be Nat; ::_thesis: ( d in dom f4 implies f4 . d in INT )
reconsider d1 = d as Element of NAT by ORDINAL1:def_12;
assume d in dom f4 ; ::_thesis: f4 . d in INT
then f4 . d1 = (fr . d1) * (x |^ d1) by A11;
hence f4 . d in INT by INT_1:def_2; ::_thesis: verum
end;
f4 <> {} by A11;
then n + 1 in dom f4 by A11, FINSEQ_5:6;
then f4 . (n + 1) = (fr . (n + 1)) * (x |^ (n + 1)) by A11;
then A13: f4 . (n + 1) = (fp . (n + 2)) * (x |^ (n + 1)) by A3, FINSEQ_5:62;
reconsider f4 = f4 as FinSequence of INT by A12, FINSEQ_2:12;
consider f5 being FinSequence such that
A14: ( len f5 = n + 1 & ( for d being Nat st d in dom f5 holds
f5 . d = H2(d) ) ) from FINSEQ_1:sch_2();
A15: for d being Nat st d in dom f5 holds
f5 . d in INT
proof
let d be Nat; ::_thesis: ( d in dom f5 implies f5 . d in INT )
assume d in dom f5 ; ::_thesis: f5 . d in INT
then f5 . d = (a * (fr . d)) * (x |^ (d -' 1)) by A14;
hence f5 . d in INT by INT_1:def_2; ::_thesis: verum
end;
f5 <> {} by A14;
then 1 in dom f5 by FINSEQ_5:6;
then f5 . 1 = (a * (fr . 1)) * (x |^ (1 -' 1)) by A14;
then f5 . 1 = (a * (fr . 1)) * (x |^ 0) by XREAL_1:232;
then A16: f5 . 1 = (a * (fr . 1)) * 1 by NEWTON:4;
reconsider f5 = f5 as FinSequence of INT by A15, FINSEQ_2:12;
A17: f4 is FinSequence of REAL by FINSEQ_3:117;
consider f2 being FinSequence of INT such that
A18: len f2 = len fr and
A19: for d being Nat st d in dom f2 holds
f2 . d = (fr . d) * (x |^ (d -' 1)) and
A20: (Poly-INT fr) . x = Sum f2 by Def1;
set f3 = (x - a) * f2;
A21: dom ((x - a) * f2) = dom f2 by VALUED_1:def_5;
then A22: len ((x - a) * f2) = len f2 by FINSEQ_3:29;
A23: dom ((x - a) * f2) = dom f4 by A4, A18, A11, A21, FINSEQ_3:29;
A24: for k being Element of NAT st k in dom ((x - a) * f2) holds
((x - a) * f2) . k = ((fr . k) * (x |^ k)) - ((a * (fr . k)) * (x |^ (k -' 1)))
proof
let k be Element of NAT ; ::_thesis: ( k in dom ((x - a) * f2) implies ((x - a) * f2) . k = ((fr . k) * (x |^ k)) - ((a * (fr . k)) * (x |^ (k -' 1))) )
assume A25: k in dom ((x - a) * f2) ; ::_thesis: ((x - a) * f2) . k = ((fr . k) * (x |^ k)) - ((a * (fr . k)) * (x |^ (k -' 1)))
then A26: k >= 1 by FINSEQ_3:25;
A27: k in dom f2 by A25, VALUED_1:def_5;
thus ((x - a) * f2) . k = (x - a) * (f2 . k) by A25, VALUED_1:def_5
.= (x - a) * ((fr . k) * (x |^ (k -' 1))) by A19, A27
.= ((fr . k) * ((x |^ (k -' 1)) * x)) - ((a * (fr . k)) * (x |^ (k -' 1)))
.= ((fr . k) * (x |^ ((k -' 1) + 1))) - ((a * (fr . k)) * (x |^ (k -' 1))) by NEWTON:6
.= ((fr . k) * (x |^ k)) - ((a * (fr . k)) * (x |^ (k -' 1))) by A26, XREAL_1:235 ; ::_thesis: verum
end;
A28: dom ((x - a) * f2) = dom f5 by A4, A18, A14, A21, FINSEQ_3:29;
A29: for d being Nat st d in dom ((x - a) * f2) holds
((x - a) * f2) . d = (f4 . d) - (f5 . d)
proof
let d be Nat; ::_thesis: ( d in dom ((x - a) * f2) implies ((x - a) * f2) . d = (f4 . d) - (f5 . d) )
assume A30: d in dom ((x - a) * f2) ; ::_thesis: ((x - a) * f2) . d = (f4 . d) - (f5 . d)
then A31: f5 . d = (a * (fr . d)) * (x |^ (d -' 1)) by A14, A28;
f4 . d = (fr . d) * (x |^ d) by A11, A23, A30;
hence ((x - a) * f2) . d = (f4 . d) - (f5 . d) by A24, A30, A31; ::_thesis: verum
end;
f5 is FinSequence of REAL by FINSEQ_3:117;
then consider f6 being FinSequence of REAL such that
A32: len f6 = (len ((x - a) * f2)) - 1 and
A33: for d being Nat st d in dom f6 holds
f6 . d = (f4 . d) - (f5 . (d + 1)) and
A34: Sum ((x - a) * f2) = ((Sum f6) + (f4 . (n + 1))) - (f5 . 1) by A4, A18, A11, A14, A22, A29, A17, Th5;
A35: len f6 <= len ((x - a) * f2) by A4, A18, A22, A32, XREAL_1:145;
then A36: dom f6 c= dom ((x - a) * f2) by FINSEQ_3:30;
A37: for d being Element of NAT st d in dom f6 holds
f6 . d = f1 . (d + 1)
proof
let d be Element of NAT ; ::_thesis: ( d in dom f6 implies f6 . d = f1 . (d + 1) )
A38: dom f6 c= dom p by A3, A4, A18, A22, A35, FINSEQ_3:30;
assume A39: d in dom f6 ; ::_thesis: f6 . d = f1 . (d + 1)
then A40: d in Seg n by A4, A18, A22, A32, FINSEQ_1:def_3;
then A41: d <= n by FINSEQ_1:1;
then A42: n - d >= 0 by XREAL_1:48;
then reconsider d9 = (n - d) + 1 as Element of NAT by INT_1:3;
d >= 1 by A40, FINSEQ_1:1;
then n - d <= n - 1 by XREAL_1:10;
then d9 <= (n - 1) + 1 by XREAL_1:6;
then A43: d9 < n + 1 by XREAL_1:145;
d9 >= 0 + 1 by A42, XREAL_1:6;
then A44: p . (d9 + 1) = (fp . ((n + 2) - d9)) + (a * (p . d9)) by A3, A43;
d < n + 1 by A41, XREAL_1:145;
then A45: d + 1 in Seg (n + 1) by FINSEQ_3:11;
then A46: d + 1 in dom f5 by A14, FINSEQ_1:def_3;
d + 0 < n + 2 by A41, XREAL_1:8;
then d + 1 in Seg (n + 2) by FINSEQ_3:11;
then A47: d + 1 in dom f1 by A1, A5, FINSEQ_1:def_3;
A48: d + 1 in dom p by A3, A45, FINSEQ_1:def_3;
thus f6 . d = (f4 . d) - (f5 . (d + 1)) by A33, A39
.= ((fr . d) * (x |^ d)) - (f5 . (d + 1)) by A11, A23, A36, A39
.= ((fr . d) * (x |^ d)) - ((a * (fr . (d + 1))) * (x |^ ((d + 1) -' 1))) by A14, A46
.= ((fr . d) * (x |^ d)) - ((a * (fr . (d + 1))) * (x |^ d)) by NAT_D:34
.= ((fr . d) - (a * (fr . (d + 1)))) * (x |^ d)
.= ((p . (((n + 1) - d) + 1)) - (a * (fr . (d + 1)))) * (x |^ d) by A3, A39, A38, FINSEQ_5:58
.= ((p . (((n - d) + 1) + 1)) - (a * (p . (((n + 1) - (d + 1)) + 1)))) * (x |^ d) by A3, A48, FINSEQ_5:58
.= (fp . (d + 1)) * (x |^ ((d + 1) -' 1)) by A44, NAT_D:34
.= f1 . (d + 1) by A6, A47 ; ::_thesis: verum
end;
f1 = (<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>
proof
set K = (<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>;
A49: for d being Nat st d in dom f1 holds
f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d
proof
let d be Nat; ::_thesis: ( d in dom f1 implies f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d )
assume A50: d in dom f1 ; ::_thesis: f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d
then A51: d >= 1 by FINSEQ_3:25;
A52: d <= n + 2 by A1, A5, A50, FINSEQ_3:25;
percases ( d = 1 or ( d > 1 & d < n + 2 ) or d = n + 2 ) by A51, A52, XXREAL_0:1;
supposeA53: d = 1 ; ::_thesis: f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d
hence ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d = (<*(f1 . 1)*> ^ (f6 ^ <*(f1 . (n + 2))*>)) . 1 by FINSEQ_1:32
.= f1 . d by A53, FINSEQ_1:41 ;
::_thesis: verum
end;
supposeA54: ( d > 1 & d < n + 2 ) ; ::_thesis: f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d
then d - 1 > 0 by XREAL_1:50;
then reconsider w = d - 1 as Element of NAT by INT_1:3;
d - 1 < (n + 2) - 1 by A54, XREAL_1:9;
then A55: d - 1 <= (n + 1) - 1 by INT_1:7;
d - 1 >= 0 + 1 by A54, INT_1:7, XREAL_1:50;
then w in Seg n by A55, FINSEQ_1:1;
then A56: w in dom f6 by A4, A18, A22, A32, FINSEQ_1:def_3;
then A57: w in dom (f6 ^ <*(f1 . (n + 2))*>) by FINSEQ_2:15;
thus ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d = (<*(f1 . 1)*> ^ (f6 ^ <*(f1 . (n + 2))*>)) . (w + 1) by FINSEQ_1:32
.= (f6 ^ <*(f1 . (n + 2))*>) . w by A57, FINSEQ_3:103
.= f6 . w by A56, FINSEQ_1:def_7
.= f1 . (w + 1) by A37, A56
.= f1 . d ; ::_thesis: verum
end;
supposeA58: d = n + 2 ; ::_thesis: f1 . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d
set K1 = <*(f1 . 1)*> ^ f6;
thus ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . d = ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . ((n + 1) + 1) by A58
.= ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) . ((len (<*(f1 . 1)*> ^ f6)) + 1) by A4, A18, A22, A32, FINSEQ_5:8
.= f1 . d by A58, FINSEQ_1:42 ; ::_thesis: verum
end;
end;
end;
len ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) = len (<*(f1 . 1)*> ^ (f6 ^ <*(f1 . (n + 2))*>)) by FINSEQ_1:32
.= 1 + (len (f6 ^ <*(f1 . (n + 2))*>)) by FINSEQ_5:8
.= (1 + (len f6)) + 1 by FINSEQ_2:16
.= len f1 by A1, A4, A5, A18, A22, A32 ;
then dom f1 = dom ((<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*>) by FINSEQ_3:29;
hence f1 = (<*(f1 . 1)*> ^ f6) ^ <*(f1 . (n + 2))*> by A49, FINSEQ_1:13; ::_thesis: verum
end;
then Sum f1 = Sum (<*(f1 . 1)*> ^ (f6 ^ <*(f1 . (n + 2))*>)) by FINSEQ_1:32
.= (f1 . 1) + (Sum (f6 ^ <*(f1 . (n + 2))*>)) by RVSUM_1:76
.= (f1 . 1) + ((Sum f6) + (f1 . (n + 2))) by RVSUM_1:74
.= (Sum ((x - a) * f2)) + r by A10, A9, A13, A16, A34
.= ((x - a) * ((Poly-INT fr) . x)) + r by A20, RVSUM_1:87 ;
hence (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r by A7; ::_thesis: verum
end;
hence ( len fr = n + 1 & ( for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fr) . x)) + r ) & fp . (n + 2) = fr . (n + 1) ) by A3, FINSEQ_5:62, FINSEQ_5:def_3; ::_thesis: verum
end;
theorem Th7: :: INT_5:7
for i, j being Integer
for p being Prime holds
( not p divides i * j or p divides i or p divides j )
proof
let i, j be Integer; ::_thesis: for p being Prime holds
( not p divides i * j or p divides i or p divides j )
let p be Prime; ::_thesis: ( not p divides i * j or p divides i or p divides j )
assume A1: p divides i * j ; ::_thesis: ( p divides i or p divides j )
percases ( ( i >= 0 & j >= 0 ) or ( i >= 0 & j < 0 ) or ( i < 0 & j >= 0 ) or ( i < 0 & j < 0 ) ) ;
suppose ( i >= 0 & j >= 0 ) ; ::_thesis: ( p divides i or p divides j )
then reconsider i = i, j = j as Element of NAT by INT_1:3;
p divides i * j by A1;
hence ( p divides i or p divides j ) by NEWTON:80; ::_thesis: verum
end;
suppose ( i >= 0 & j < 0 ) ; ::_thesis: ( p divides i or p divides j )
then reconsider i = i, j9 = - j as Element of NAT by INT_1:3;
p divides - (i * j) by A1, INT_2:10;
then p divides i * j9 ;
then ( p divides i or p divides j9 ) by NEWTON:80;
hence ( p divides i or p divides j ) by INT_2:10; ::_thesis: verum
end;
suppose ( i < 0 & j >= 0 ) ; ::_thesis: ( p divides i or p divides j )
then reconsider i9 = - i, j = j as Element of NAT by INT_1:3;
p divides - (i * j) by A1, INT_2:10;
then p divides i9 * j ;
then ( p divides i9 or p divides j ) by NEWTON:80;
hence ( p divides i or p divides j ) by INT_2:10; ::_thesis: verum
end;
suppose ( i < 0 & j < 0 ) ; ::_thesis: ( p divides i or p divides j )
then reconsider i9 = - i, j9 = - j as Element of NAT by INT_1:3;
p divides i9 * j9 by A1;
then ( p divides i9 or p divides j9 ) by NEWTON:80;
hence ( p divides i or p divides j ) by INT_2:10; ::_thesis: verum
end;
end;
end;
theorem Th8: :: INT_5:8
for n being Nat
for p being Prime
for fp being FinSequence of INT st len fp = n + 1 & p > 2 & not p divides fp . (n + 1) holds
for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n
proof
let n be Nat; ::_thesis: for p being Prime
for fp being FinSequence of INT st len fp = n + 1 & p > 2 & not p divides fp . (n + 1) holds
for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n
let p be Prime; ::_thesis: for fp being FinSequence of INT st len fp = n + 1 & p > 2 & not p divides fp . (n + 1) holds
for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n
defpred S1[ Nat] means for fp being FinSequence of INT st len fp = $1 + 1 & p > 2 & not p divides fp . ($1 + 1) holds
for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= $1;
A1: for n being Nat st S1[n] holds
S1[n + 1]
proof
let n be Nat; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
let fp be FinSequence of INT ; ::_thesis: ( len fp = (n + 1) + 1 & p > 2 & not p divides fp . ((n + 1) + 1) implies for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n + 1 )
assume that
A3: len fp = (n + 1) + 1 and
A4: p > 2 and
A5: not p divides fp . ((n + 1) + 1) ; ::_thesis: for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n + 1
percases ( for x being Integer holds ((Poly-INT fp) . x) mod p <> 0 or ex a being Integer st ((Poly-INT fp) . a) mod p = 0 ) ;
supposeA6: for x being Integer holds ((Poly-INT fp) . x) mod p <> 0 ; ::_thesis: for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n + 1
assume ex fr being FinSequence of INT st
( ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) & len fr > n + 1 ) ; ::_thesis: contradiction
then consider fr being FinSequence of INT such that
A7: for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 and
for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p and
A8: len fr > n + 1 ;
fr <> {} by A8;
then ((Poly-INT fp) . (fr . 1)) mod p = 0 by A7, FINSEQ_5:6;
hence contradiction by A6; ::_thesis: verum
end;
suppose ex a being Integer st ((Poly-INT fp) . a) mod p = 0 ; ::_thesis: for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n + 1
then consider a being Integer such that
A9: ((Poly-INT fp) . a) mod p = 0 ;
assume ex f being FinSequence of INT st
( ( for d being Nat st d in dom f holds
((Poly-INT fp) . (f . d)) mod p = 0 ) & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
not f . d,f . e are_congruent_mod p ) & len f > n + 1 ) ; ::_thesis: contradiction
then consider f being FinSequence of INT such that
A10: for d being Nat st d in dom f holds
((Poly-INT fp) . (f . d)) mod p = 0 and
A11: for d, e being Nat st d in dom f & e in dom f & d <> e holds
not f . d,f . e are_congruent_mod p and
A12: len f > n + 1 ;
consider fk being FinSequence of INT , r being Integer such that
A13: len fk = n + 1 and
A14: for x being Element of INT holds (Poly-INT fp) . x = ((x - a) * ((Poly-INT fk) . x)) + r and
A15: fp . (n + 2) = fk . (n + 1) by A3, Th6;
a is Element of INT by INT_1:def_2;
then A16: ((Poly-INT fp) . a) mod p = (((a - a) * ((Poly-INT fk) . a)) + r) mod p by A14
.= r mod p ;
A17: for d being Element of NAT st d in dom f holds
p divides ((f . d) - a) * ((Poly-INT fk) . (f . d))
proof
let d be Element of NAT ; ::_thesis: ( d in dom f implies p divides ((f . d) - a) * ((Poly-INT fk) . (f . d)) )
f . d is Element of INT by INT_1:def_2;
then A18: ((Poly-INT fp) . (f . d)) mod p = ((((f . d) - a) * ((Poly-INT fk) . (f . d))) + r) mod p by A14
.= (((((f . d) - a) * ((Poly-INT fk) . (f . d))) mod p) + (r mod p)) mod p by NAT_D:66
.= (((f . d) - a) * ((Poly-INT fk) . (f . d))) mod p by A9, A16, NAT_D:65 ;
assume d in dom f ; ::_thesis: p divides ((f . d) - a) * ((Poly-INT fk) . (f . d))
then (((f . d) - a) * ((Poly-INT fk) . (f . d))) mod p = 0 by A10, A18;
hence p divides ((f . d) - a) * ((Poly-INT fk) . (f . d)) by INT_1:62; ::_thesis: verum
end;
percases ( for d being Nat st d in dom f holds
not p divides (f . d) - a or ex d being Nat st
( d in dom f & p divides (f . d) - a ) ) ;
supposeA19: for d being Nat st d in dom f holds
not p divides (f . d) - a ; ::_thesis: contradiction
for d being Nat st d in dom f holds
((Poly-INT fk) . (f . d)) mod p = 0
proof
let d be Nat; ::_thesis: ( d in dom f implies ((Poly-INT fk) . (f . d)) mod p = 0 )
assume A20: d in dom f ; ::_thesis: ((Poly-INT fk) . (f . d)) mod p = 0
then p divides ((f . d) - a) * ((Poly-INT fk) . (f . d)) by A17;
then ( p divides (f . d) - a or p divides (Poly-INT fk) . (f . d) ) by Th7;
hence ((Poly-INT fk) . (f . d)) mod p = 0 by A19, A20, INT_1:62; ::_thesis: verum
end;
then len f <= n by A2, A4, A5, A13, A15, A11;
hence contradiction by A12, XREAL_1:145; ::_thesis: verum
end;
suppose ex d being Nat st
( d in dom f & p divides (f . d) - a ) ; ::_thesis: contradiction
then consider d9 being Element of NAT such that
A21: d9 in dom f and
A22: p divides (f . d9) - a ;
set f9 = f - {(f . d9)};
A23: for d being Nat st d in dom (f - {(f . d9)}) holds
not p divides ((f - {(f . d9)}) . d) - a
proof
given k being Nat such that A24: k in dom (f - {(f . d9)}) and
A25: p divides ((f - {(f . d9)}) . k) - a ; ::_thesis: contradiction
(f - {(f . d9)}) . k in rng (f - {(f . d9)}) by A24, FUNCT_1:3;
then A26: (f - {(f . d9)}) . k in (rng f) \ {(f . d9)} by FINSEQ_3:65;
then (f - {(f . d9)}) . k in rng f by XBOOLE_0:def_5;
then consider w being set such that
A27: w in dom f and
A28: f . w = (f - {(f . d9)}) . k by FUNCT_1:def_3;
reconsider w = w as Element of NAT by A27;
p divides ((f . w) - a) - ((f . d9) - a) by A22, A25, A28, Th1;
then p divides (f . w) - (f . d9) ;
then A29: f . w,f . d9 are_congruent_mod p by INT_2:15;
not (f - {(f . d9)}) . k in {(f . d9)} by A26, XBOOLE_0:def_5;
then w <> d9 by A28, TARSKI:def_1;
hence contradiction by A11, A21, A27, A29; ::_thesis: verum
end;
A30: for d being Nat st d in dom (f - {(f . d9)}) holds
((Poly-INT fk) . ((f - {(f . d9)}) . d)) mod p = 0
proof
let d be Nat; ::_thesis: ( d in dom (f - {(f . d9)}) implies ((Poly-INT fk) . ((f - {(f . d9)}) . d)) mod p = 0 )
assume A31: d in dom (f - {(f . d9)}) ; ::_thesis: ((Poly-INT fk) . ((f - {(f . d9)}) . d)) mod p = 0
then (f - {(f . d9)}) . d in rng (f - {(f . d9)}) by FUNCT_1:3;
then (f - {(f . d9)}) . d in (rng f) \ {(f . d9)} by FINSEQ_3:65;
then (f - {(f . d9)}) . d in rng f by XBOOLE_0:def_5;
then ex w being set st
( w in dom f & f . w = (f - {(f . d9)}) . d ) by FUNCT_1:def_3;
then p divides (((f - {(f . d9)}) . d) - a) * ((Poly-INT fk) . ((f - {(f . d9)}) . d)) by A17;
then ( p divides ((f - {(f . d9)}) . d) - a or p divides (Poly-INT fk) . ((f - {(f . d9)}) . d) ) by Th7;
hence ((Poly-INT fk) . ((f - {(f . d9)}) . d)) mod p = 0 by A23, A31, INT_1:62; ::_thesis: verum
end;
A32: f is one-to-one
proof
let x1, x2 be set ; :: according to FUNCT_1:def_4 ::_thesis: ( not x1 in K64(f) or not x2 in K64(f) or not f . x1 = f . x2 or x1 = x2 )
assume that
A33: x1 in dom f and
A34: x2 in dom f and
A35: f . x1 = f . x2 and
A36: x1 <> x2 ; ::_thesis: contradiction
thus contradiction by A11, A33, A34, A35, A36, INT_1:11; ::_thesis: verum
end;
then A37: f - {(f . d9)} is one-to-one by FINSEQ_3:87;
A38: for d, e being Nat st d in dom (f - {(f . d9)}) & e in dom (f - {(f . d9)}) & d <> e holds
not (f - {(f . d9)}) . d,(f - {(f . d9)}) . e are_congruent_mod p
proof
let d, e be Nat; ::_thesis: ( d in dom (f - {(f . d9)}) & e in dom (f - {(f . d9)}) & d <> e implies not (f - {(f . d9)}) . d,(f - {(f . d9)}) . e are_congruent_mod p )
assume that
A39: d in dom (f - {(f . d9)}) and
A40: e in dom (f - {(f . d9)}) and
A41: d <> e ; ::_thesis: not (f - {(f . d9)}) . d,(f - {(f . d9)}) . e are_congruent_mod p
(f - {(f . d9)}) . e in rng (f - {(f . d9)}) by A40, FUNCT_1:3;
then (f - {(f . d9)}) . e in (rng f) \ {(f . d9)} by FINSEQ_3:65;
then (f - {(f . d9)}) . e in rng f by XBOOLE_0:def_5;
then consider w2 being set such that
A42: w2 in dom f and
A43: (f - {(f . d9)}) . e = f . w2 by FUNCT_1:def_3;
(f - {(f . d9)}) . d in rng (f - {(f . d9)}) by A39, FUNCT_1:3;
then (f - {(f . d9)}) . d in (rng f) \ {(f . d9)} by FINSEQ_3:65;
then (f - {(f . d9)}) . d in rng f by XBOOLE_0:def_5;
then consider w1 being set such that
A44: w1 in dom f and
A45: (f - {(f . d9)}) . d = f . w1 by FUNCT_1:def_3;
reconsider w1 = w1, w2 = w2 as Element of NAT by A44, A42;
w1 <> w2 by A37, A39, A40, A41, A45, A43, FUNCT_1:def_4;
hence not (f - {(f . d9)}) . d,(f - {(f . d9)}) . e are_congruent_mod p by A11, A44, A45, A42, A43; ::_thesis: verum
end;
f . d9 in rng f by A21, FUNCT_1:3;
then len (f - {(f . d9)}) = (len f) - 1 by A32, FINSEQ_3:90;
then len (f - {(f . d9)}) > (n + 1) - 1 by A12, XREAL_1:9;
hence contradiction by A2, A4, A5, A13, A15, A30, A38; ::_thesis: verum
end;
end;
end;
end;
end;
A46: S1[ 0 ]
proof
let fp be FinSequence of INT ; ::_thesis: ( len fp = 0 + 1 & p > 2 & not p divides fp . (0 + 1) implies for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= 0 )
assume that
A47: len fp = 0 + 1 and
p > 2 and
A48: not p divides fp . (0 + 1) ; ::_thesis: for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= 0
assume ex fr being FinSequence of INT st
( ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) & len fr > 0 ) ; ::_thesis: contradiction
then consider fr being FinSequence of INT such that
A49: for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 and
for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p and
A50: len fr > 0 ;
fr <> {} by A50;
then A51: ((Poly-INT fp) . (fr . 1)) mod p = 0 by A49, FINSEQ_5:6;
A52: fr . 1 in INT by INT_1:def_2;
(Poly-INT fp) . (fr . 1) = (INT --> (fp . 1)) . (fr . 1) by A47, Th3
.= fp . 1 by A52, FUNCOP_1:7 ;
hence contradiction by A48, A51, Lm1; ::_thesis: verum
end;
for n being Nat holds S1[n] from NAT_1:sch_2(A46, A1);
hence for fp being FinSequence of INT st len fp = n + 1 & p > 2 & not p divides fp . (n + 1) holds
for fr being FinSequence of INT st ( for d being Nat st d in dom fr holds
((Poly-INT fp) . (fr . d)) mod p = 0 ) & ( for d, e being Nat st d in dom fr & e in dom fr & d <> e holds
not fr . d,fr . e are_congruent_mod p ) holds
len fr <= n ; ::_thesis: verum
end;
definition
let a be Integer;
let m be Nat;
preda is_quadratic_residue_mod m means :Def2: :: INT_5:def 2
ex x being Integer st ((x ^2) - a) mod m = 0 ;
end;
:: deftheorem Def2 defines is_quadratic_residue_mod INT_5:def_2_:_
for a being Integer
for m being Nat holds
( a is_quadratic_residue_mod m iff ex x being Integer st ((x ^2) - a) mod m = 0 );
theorem Th9: :: INT_5:9
for a being Integer
for m being Nat holds a ^2 is_quadratic_residue_mod m
proof
let a be Integer; ::_thesis: for m being Nat holds a ^2 is_quadratic_residue_mod m
let m be Nat; ::_thesis: a ^2 is_quadratic_residue_mod m
((a ^2) - (a ^2)) mod m = 0 by INT_4:12;
hence a ^2 is_quadratic_residue_mod m by Def2; ::_thesis: verum
end;
theorem :: INT_5:10
1 is_quadratic_residue_mod 2
proof
1 ^2 is_quadratic_residue_mod 2 by Th9;
hence 1 is_quadratic_residue_mod 2 ; ::_thesis: verum
end;
theorem Th11: :: INT_5:11
for i, j being Integer
for m being Nat st i is_quadratic_residue_mod m & i,j are_congruent_mod m holds
j is_quadratic_residue_mod m
proof
let i, j be Integer; ::_thesis: for m being Nat st i is_quadratic_residue_mod m & i,j are_congruent_mod m holds
j is_quadratic_residue_mod m
let m be Nat; ::_thesis: ( i is_quadratic_residue_mod m & i,j are_congruent_mod m implies j is_quadratic_residue_mod m )
assume that
A1: i is_quadratic_residue_mod m and
A2: i,j are_congruent_mod m ; ::_thesis: j is_quadratic_residue_mod m
consider x being Integer such that
A3: ((x ^2) - i) mod m = 0 by A1, Def2;
m divides i - j by A2, INT_2:15;
then A4: (i - j) mod m = 0 by Lm1;
((x ^2) - j) mod m = (((x ^2) - i) + (i - j)) mod m
.= ((((x ^2) - i) mod m) + ((i - j) mod m)) mod m by NAT_D:66
.= 0 by A3, A4, NAT_D:65 ;
hence j is_quadratic_residue_mod m by Def2; ::_thesis: verum
end;
Lm2: for i being Integer
for p being Prime holds
( i,p are_relative_prime or p divides i )
proof
let i be Integer; ::_thesis: for p being Prime holds
( i,p are_relative_prime or p divides i )
let p be Prime; ::_thesis: ( i,p are_relative_prime or p divides i )
percases ( i >= 0 or i < 0 ) ;
suppose i >= 0 ; ::_thesis: ( i,p are_relative_prime or p divides i )
then reconsider i = i as Element of NAT by INT_1:3;
( i,p are_relative_prime or i gcd p = p ) by PEPIN:2;
hence ( i,p are_relative_prime or p divides i ) by NAT_D:def_5; ::_thesis: verum
end;
supposeA1: i < 0 ; ::_thesis: ( i,p are_relative_prime or p divides i )
then reconsider m = - i as Element of NAT by INT_1:3;
A2: ( m,p are_relative_prime or m gcd p = p ) by PEPIN:2;
percases ( m,p are_relative_prime or p divides m ) by A2, NAT_D:def_5;
supposeA3: m,p are_relative_prime ; ::_thesis: ( i,p are_relative_prime or p divides i )
m = abs i by A1, ABSVALUE:def_1;
then i gcd p = m gcd (abs p) by INT_2:34
.= m gcd p by ABSVALUE:def_1
.= 1 by A3, INT_2:def_3 ;
hence ( i,p are_relative_prime or p divides i ) by INT_2:def_3; ::_thesis: verum
end;
suppose p divides m ; ::_thesis: ( i,p are_relative_prime or p divides i )
then consider t being Nat such that
A4: m = p * t by NAT_D:def_3;
i = p * (- t) by A4;
hence ( i,p are_relative_prime or p divides i ) by INT_1:def_3; ::_thesis: verum
end;
end;
end;
end;
end;
theorem Th12: :: INT_5:12
for i, j being Integer st i divides j holds
i gcd j = abs i
proof
let i, j be Integer; ::_thesis: ( i divides j implies i gcd j = abs i )
assume i divides j ; ::_thesis: i gcd j = abs i
then abs i divides abs j by INT_2:16;
then (abs i) gcd (abs j) = abs i by NEWTON:49;
hence i gcd j = abs i by INT_2:34; ::_thesis: verum
end;
theorem Th13: :: INT_5:13
for n being Nat
for i, j, m being Integer st i mod m = j mod m holds
(i |^ n) mod m = (j |^ n) mod m
proof
let n be Nat; ::_thesis: for i, j, m being Integer st i mod m = j mod m holds
(i |^ n) mod m = (j |^ n) mod m
let i, j, m be Integer; ::_thesis: ( i mod m = j mod m implies (i |^ n) mod m = (j |^ n) mod m )
defpred S1[ Nat] means (i |^ $1) mod m = (j |^ $1) mod m;
assume A1: i mod m = j mod m ; ::_thesis: (i |^ n) mod m = (j |^ n) mod m
A2: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A3: S1[n] ; ::_thesis: S1[n + 1]
thus (i |^ (n + 1)) mod m = ((i |^ n) * i) mod m by NEWTON:6
.= (((j |^ n) mod m) * (j mod m)) mod m by A1, A3, NAT_D:67
.= ((j |^ n) * j) mod m by NAT_D:67
.= (j |^ (n + 1)) mod m by NEWTON:6 ; ::_thesis: verum
end;
i |^ 0 = 1 by NEWTON:4;
then A4: S1[ 0 ] by NEWTON:4;
A5: for n being Element of NAT holds S1[n] from NAT_1:sch_1(A4, A2);
for n being Nat holds S1[n]
proof
let n be Nat; ::_thesis: S1[n]
n in NAT by ORDINAL1:def_12;
hence S1[n] by A5; ::_thesis: verum
end;
hence (i |^ n) mod m = (j |^ n) mod m ; ::_thesis: verum
end;
theorem Th14: :: INT_5:14
for a, x being Integer
for p being Prime st a gcd p = 1 & ((x ^2) - a) mod p = 0 holds
x,p are_relative_prime
proof
let a, x be Integer; ::_thesis: for p being Prime st a gcd p = 1 & ((x ^2) - a) mod p = 0 holds
x,p are_relative_prime
let p be Prime; ::_thesis: ( a gcd p = 1 & ((x ^2) - a) mod p = 0 implies x,p are_relative_prime )
assume that
A1: a gcd p = 1 and
A2: ((x ^2) - a) mod p = 0 ; ::_thesis: x,p are_relative_prime
assume not x,p are_relative_prime ; ::_thesis: contradiction
then A3: p divides x ^2 by Lm2, INT_2:2;
p divides (x ^2) - a by A2, Lm1;
then p divides (x ^2) - ((x ^2) - a) by A3, Th1;
then p gcd a = abs p by Th12
.= p by ABSVALUE:def_1 ;
hence contradiction by A1, INT_2:def_4; ::_thesis: verum
end;
theorem :: INT_5:15
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
ex x, y being Integer st
( ((x ^2) - a) mod p = 0 & ((y ^2) - a) mod p = 0 & not x,y are_congruent_mod p )
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
ex x, y being Integer st
( ((x ^2) - a) mod p = 0 & ((y ^2) - a) mod p = 0 & not x,y are_congruent_mod p )
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p implies ex x, y being Integer st
( ((x ^2) - a) mod p = 0 & ((y ^2) - a) mod p = 0 & not x,y are_congruent_mod p ) )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a is_quadratic_residue_mod p ; ::_thesis: ex x, y being Integer st
( ((x ^2) - a) mod p = 0 & ((y ^2) - a) mod p = 0 & not x,y are_congruent_mod p )
consider x being Integer such that
A4: ((x ^2) - a) mod p = 0 by A3, Def2;
take x ; ::_thesis: ex y being Integer st
( ((x ^2) - a) mod p = 0 & ((y ^2) - a) mod p = 0 & not x,y are_congruent_mod p )
take - x ; ::_thesis: ( ((x ^2) - a) mod p = 0 & (((- x) ^2) - a) mod p = 0 & not x, - x are_congruent_mod p )
not x, - x are_congruent_mod p
proof
assume x, - x are_congruent_mod p ; ::_thesis: contradiction
then p divides x - (- x) by INT_2:15;
then A5: p divides 2 * x ;
2,p are_relative_prime by A1, INT_2:28, INT_2:30;
then 2 gcd p = 1 by INT_2:def_3;
then p divides x by A5, WSIERP_1:29;
then consider i being Integer such that
A6: x = p * i by INT_1:def_3;
x gcd p = (p * i) gcd (p * 1) by A6
.= p * (i gcd 1) by EULER_1:15
.= p * 1 by WSIERP_1:8 ;
then x gcd p <> 1 by INT_2:def_4;
then not x,p are_relative_prime by INT_2:def_3;
hence contradiction by A2, A4, Th14; ::_thesis: verum
end;
hence ( ((x ^2) - a) mod p = 0 & (((- x) ^2) - a) mod p = 0 & not x, - x are_congruent_mod p ) by A4; ::_thesis: verum
end;
theorem Th16: :: INT_5:16
for p being Prime st p > 2 holds
ex fp being FinSequence of NAT st
( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) & ( for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p ) & ( for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p ) )
proof
let p be Prime; ::_thesis: ( p > 2 implies ex fp being FinSequence of NAT st
( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) & ( for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p ) & ( for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p ) ) )
deffunc H1( Nat) -> Element of NAT = $1 ^2 ;
consider fp being FinSequence such that
A1: ( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
fp . d = H1(d) ) ) from FINSEQ_1:sch_2();
for d being Nat st d in dom fp holds
fp . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom fp implies fp . d in NAT )
assume d in dom fp ; ::_thesis: fp . d in NAT
then fp . d = d ^2 by A1;
hence fp . d in NAT ; ::_thesis: verum
end;
then reconsider fp = fp as FinSequence of NAT by FINSEQ_2:12;
A2: p > 1 by INT_2:def_4;
then A3: p -' 1 = p - 1 by XREAL_1:233;
assume p > 2 ; ::_thesis: ex fp being FinSequence of NAT st
( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) & ( for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p ) & ( for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p ) )
then p is odd by PEPIN:17;
then p - 1 is even by HILBERT3:2;
then 2 divides p -' 1 by A3, PEPIN:22;
then (p -' 1) mod 2 = 0 by PEPIN:6;
then A4: (p -' 1) div 2 = (p -' 1) / 2 by PEPIN:63;
A5: for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p
proof
p - 1 > 0 by A2, XREAL_1:50;
then (p - 1) / 2 < (p - 1) / 1 by XREAL_1:76;
then (p -' 1) div 2 < p by A3, A4, XREAL_1:147;
then A6: ((p -' 1) div 2) - 1 < p by XREAL_1:147;
let d, e be Nat; ::_thesis: ( d in dom fp & e in dom fp & d <> e implies not fp . d,fp . e are_congruent_mod p )
assume that
A7: d in dom fp and
A8: e in dom fp and
A9: d <> e ; ::_thesis: not fp . d,fp . e are_congruent_mod p
A10: e in Seg ((p -' 1) div 2) by A1, A8, FINSEQ_1:def_3;
then A11: e <= (p -' 1) div 2 by FINSEQ_1:1;
A12: d in Seg ((p -' 1) div 2) by A1, A7, FINSEQ_1:def_3;
then A13: d >= 1 by FINSEQ_1:1;
then 1 - ((p -' 1) div 2) <= d - e by A11, XREAL_1:13;
then A14: - (((p -' 1) div 2) - 1) <= d - e ;
A15: d <= (p -' 1) div 2 by A12, FINSEQ_1:1;
then d + e <= ((p -' 1) div 2) + ((p -' 1) div 2) by A11, XREAL_1:7;
then d + e < p by A3, A4, XREAL_1:147;
then d + e,p are_relative_prime by A13, EULER_1:2;
then A16: (d + e) gcd p = 1 by INT_2:def_3;
assume fp . d,fp . e are_congruent_mod p ; ::_thesis: contradiction
then p divides (fp . d) - (fp . e) by INT_2:15;
then p divides (d ^2) - (fp . e) by A1, A7;
then p divides (d ^2) - (e ^2) by A1, A8;
then A17: p divides (d - e) * (d + e) ;
d - e <> 0 by A9;
then abs p <= abs (d - e) by A16, A17, INT_4:6, WSIERP_1:29;
then A18: p <= abs (d - e) by ABSVALUE:def_1;
e >= 1 by A10, FINSEQ_1:1;
then d - e <= ((p -' 1) div 2) - 1 by A15, XREAL_1:13;
then abs (d - e) <= ((p -' 1) div 2) - 1 by A14, ABSVALUE:5;
hence contradiction by A18, A6, XXREAL_0:2; ::_thesis: verum
end;
A19: for d being Nat st d in dom fp holds
d gcd p = 1
proof
let d be Nat; ::_thesis: ( d in dom fp implies d gcd p = 1 )
A20: 1 * d <= 2 * d by XREAL_1:64;
assume d in dom fp ; ::_thesis: d gcd p = 1
then A21: d in Seg ((p -' 1) div 2) by A1, FINSEQ_1:def_3;
then d <= (p -' 1) div 2 by FINSEQ_1:1;
then 2 * d <= ((p -' 1) / 2) * 2 by A4, XREAL_1:64;
then d <= p -' 1 by A20, XXREAL_0:2;
then A22: d < p by A3, XREAL_1:147;
d >= 1 by A21, FINSEQ_1:1;
then d,p are_relative_prime by A22, EULER_1:2;
hence d gcd p = 1 by INT_2:def_3; ::_thesis: verum
end;
A23: for d being Nat st d in dom fp holds
(fp . d) gcd p = 1
proof
let d be Nat; ::_thesis: ( d in dom fp implies (fp . d) gcd p = 1 )
assume A24: d in dom fp ; ::_thesis: (fp . d) gcd p = 1
then d gcd p = 1 by A19;
then (d ^2) gcd p = 1 by WSIERP_1:7;
hence (fp . d) gcd p = 1 by A1, A24; ::_thesis: verum
end;
take fp ; ::_thesis: ( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) & ( for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p ) & ( for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p ) )
for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p
proof
let d be Nat; ::_thesis: ( d in dom fp implies fp . d is_quadratic_residue_mod p )
assume A25: d in dom fp ; ::_thesis: fp . d is_quadratic_residue_mod p
d ^2 is_quadratic_residue_mod p by Th9;
hence fp . d is_quadratic_residue_mod p by A1, A25; ::_thesis: verum
end;
hence ( len fp = (p -' 1) div 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) & ( for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p ) & ( for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p ) ) by A1, A23, A5; ::_thesis: verum
end;
theorem Th17: :: INT_5:17
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
(a |^ ((p -' 1) div 2)) mod p = 1
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
(a |^ ((p -' 1) div 2)) mod p = 1
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p implies (a |^ ((p -' 1) div 2)) mod p = 1 )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a is_quadratic_residue_mod p ; ::_thesis: (a |^ ((p -' 1) div 2)) mod p = 1
consider s being Integer such that
A4: ((s ^2) - a) mod p = 0 by A3, Def2;
A5: p > 1 by INT_2:def_4;
p is odd by A1, PEPIN:17;
then p - 1 is even by HILBERT3:2;
then p -' 1 is even by A5, XREAL_1:233;
then 2 divides p -' 1 by PEPIN:22;
then A6: p -' 1 = 2 * ((p -' 1) div 2) by NAT_D:3;
p divides (s ^2) - a by A4, INT_1:62;
then s ^2 ,a are_congruent_mod p by INT_2:15;
then a mod p = (s ^2) mod p by NAT_D:64;
then A7: (a |^ ((p -' 1) div 2)) mod p = ((s ^2) |^ ((p -' 1) div 2)) mod p by Th13
.= ((s |^ 2) |^ ((p -' 1) div 2)) mod p by NEWTON:81
.= (s |^ (p -' 1)) mod p by A6, NEWTON:9 ;
A8: s,p are_relative_prime by A2, A4, Th14;
percases ( s >= 0 or s < 0 ) ;
suppose s >= 0 ; ::_thesis: (a |^ ((p -' 1) div 2)) mod p = 1
then reconsider s = s as Element of NAT by INT_1:3;
s,p are_relative_prime by A2, A4, Th14;
hence (a |^ ((p -' 1) div 2)) mod p = 1 by A7, PEPIN:37; ::_thesis: verum
end;
supposeA9: s < 0 ; ::_thesis: (a |^ ((p -' 1) div 2)) mod p = 1
then reconsider s9 = - s as Element of NAT by INT_1:3;
A10: abs p = p by ABSVALUE:def_1;
s9 gcd p = (abs s) gcd p by A9, ABSVALUE:def_1
.= s gcd p by A10, INT_2:34
.= 1 by A8, INT_2:def_3 ;
then s9,p are_relative_prime by INT_2:def_3;
then A11: (s9 |^ (p -' 1)) mod p = 1 by PEPIN:37;
(s |^ (p -' 1)) mod p = ((s |^ 2) |^ ((p -' 1) div 2)) mod p by A6, NEWTON:9
.= (((- s) |^ 2) |^ ((p -' 1) div 2)) mod p by WSIERP_1:1
.= 1 by A6, A11, NEWTON:9 ;
hence (a |^ ((p -' 1) div 2)) mod p = 1 by A7; ::_thesis: verum
end;
end;
end;
theorem Th18: :: INT_5:18
for p being Prime
for b being Nat st p > 2 & b gcd p = 1 & not b is_quadratic_residue_mod p holds
(b |^ ((p -' 1) div 2)) mod p = p - 1
proof
let p be Prime; ::_thesis: for b being Nat st p > 2 & b gcd p = 1 & not b is_quadratic_residue_mod p holds
(b |^ ((p -' 1) div 2)) mod p = p - 1
let b be Nat; ::_thesis: ( p > 2 & b gcd p = 1 & not b is_quadratic_residue_mod p implies (b |^ ((p -' 1) div 2)) mod p = p - 1 )
assume that
A1: p > 2 and
A2: b gcd p = 1 and
A3: not b is_quadratic_residue_mod p ; ::_thesis: (b |^ ((p -' 1) div 2)) mod p = p - 1
reconsider b = b as Element of NAT by ORDINAL1:def_12;
A4: p > 1 by INT_2:def_4;
then A5: 1 mod p = 1 by NAT_D:14;
p is odd by A1, PEPIN:17;
then p - 1 is even by HILBERT3:2;
then p -' 1 is even by A4, XREAL_1:233;
then 2 divides p -' 1 by PEPIN:22;
then p -' 1 = 2 * ((p -' 1) div 2) by NAT_D:3;
then A6: (b |^ (p -' 1)) - 1 = ((b |^ ((p -' 1) div 2)) |^ 2) - 1 by NEWTON:9
.= ((b |^ ((p -' 1) div 2)) ^2) - 1 by NEWTON:81
.= ((b |^ ((p -' 1) div 2)) + 1) * ((b |^ ((p -' 1) div 2)) - 1) ;
b,p are_relative_prime by A2, INT_2:def_3;
then (b |^ (p -' 1)) mod p = 1 by PEPIN:37;
then ((b |^ (p -' 1)) - 1) mod p = 0 by A5, INT_4:22;
then A7: p divides ((b |^ ((p -' 1) div 2)) + 1) * ((b |^ ((p -' 1) div 2)) - 1) by A6, Lm1;
p - 1 > 2 - 1 by A1, XREAL_1:9;
then p - 1 >= 1 + 1 by INT_1:7;
then p -' 1 >= 2 by A4, XREAL_1:233;
then (p -' 1) div 2 >= 2 div 2 by NAT_2:24;
then A8: (p -' 1) div 2 >= 1 by PEPIN:44;
percases ( (p -' 1) div 2 = 1 or (p -' 1) div 2 > 1 ) by A8, XXREAL_0:1;
supposeA9: (p -' 1) div 2 = 1 ; ::_thesis: (b |^ ((p -' 1) div 2)) mod p = p - 1
A10: now__::_thesis:_not_p_divides_b_-_1
assume p divides b - 1 ; ::_thesis: contradiction
then p divides - (b - 1) by INT_2:10;
then ((1 ^2) - b) mod p = 0 by Lm1;
hence contradiction by A3, Def2; ::_thesis: verum
end;
p divides (b + 1) * ((b |^ 1) - 1) by A7, A9, NEWTON:5;
then p divides (b + 1) * (b - 1) by NEWTON:5;
then p divides b - (- 1) by A10, Th7;
then b, - 1 are_congruent_mod p by INT_2:15;
then A11: b mod p = (- 1) mod p by NAT_D:64;
- p < - 2 by A1, XREAL_1:24;
then - p < (- 2) + 1 by XREAL_1:39;
then b mod p = p - 1 by A11, NAT_D:63;
hence (b |^ ((p -' 1) div 2)) mod p = p - 1 by A9, NEWTON:5; ::_thesis: verum
end;
supposeA12: (p -' 1) div 2 > 1 ; ::_thesis: (b |^ ((p -' 1) div 2)) mod p = p - 1
set l = (p -' 1) div 2;
0 is Element of INT by INT_1:def_2;
then A13: (((p -' 1) div 2) -' 1) |-> 0 is FinSequence of INT by FINSEQ_2:63;
set K1 = <*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0);
A14: len ((((p -' 1) div 2) -' 1) |-> 0) = ((p -' 1) div 2) -' 1 by CARD_1:def_7;
A15: len (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) = 1 + (((p -' 1) div 2) -' 1) by CARD_1:def_7
.= (p -' 1) div 2 by A12, XREAL_1:235 ;
set fs = (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*1*>;
1 is Element of INT by INT_1:def_2;
then A16: <*1*> is FinSequence of INT by FINSEQ_1:74;
- 1 is Element of INT by INT_1:def_2;
then <*(- 1)*> is FinSequence of INT by FINSEQ_1:74;
then <*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0) is FinSequence of INT by A13, FINSEQ_1:75;
then reconsider fs = (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*1*> as FinSequence of INT by A16, FINSEQ_1:75;
A17: len fs = len (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>)) by FINSEQ_1:32
.= 1 + (len (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>)) by FINSEQ_5:8
.= 1 + ((((p -' 1) div 2) -' 1) + 1) by CARD_1:def_7
.= 1 + ((p -' 1) div 2) by A12, XREAL_1:235 ;
A18: fs . 1 = (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>)) . 1 by FINSEQ_1:32
.= - 1 by FINSEQ_1:41 ;
A19: for x being Element of INT holds (Poly-INT fs) . x = (x |^ ((p -' 1) div 2)) - 1
proof
let x be Element of INT ; ::_thesis: (Poly-INT fs) . x = (x |^ ((p -' 1) div 2)) - 1
consider fr being FinSequence of INT such that
A20: len fr = len fs and
A21: for d being Nat st d in dom fr holds
fr . d = (fs . d) * (x |^ (d -' 1)) and
A22: (Poly-INT fs) . x = Sum fr by Def1;
fr = (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>
proof
set K = (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>;
A23: for d being Nat st d in dom fr holds
fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d
proof
let d be Nat; ::_thesis: ( d in dom fr implies fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d )
assume A24: d in dom fr ; ::_thesis: fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d
then A25: d in Seg (((p -' 1) div 2) + 1) by A17, A20, FINSEQ_1:def_3;
then A26: d >= 1 by FINSEQ_1:1;
A27: d <= ((p -' 1) div 2) + 1 by A25, FINSEQ_1:1;
percases ( d = 1 or ( d > 1 & d < ((p -' 1) div 2) + 1 ) or d = ((p -' 1) div 2) + 1 ) by A26, A27, XXREAL_0:1;
supposeA28: d = 1 ; ::_thesis: fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d
then A29: fr . 1 = (fs . 1) * (x |^ (1 -' 1)) by A21, A24
.= (fs . 1) * (x |^ 0) by XREAL_1:232
.= (fs . 1) * 1 by NEWTON:4
.= - 1 by A18 ;
((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . 1 = (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) . 1 by FINSEQ_1:32
.= fr . 1 by A29, FINSEQ_1:41 ;
hence fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d by A28; ::_thesis: verum
end;
supposeA30: ( d > 1 & d < ((p -' 1) div 2) + 1 ) ; ::_thesis: fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d
then d - 1 > 0 by XREAL_1:50;
then reconsider w = d - 1 as Element of NAT by INT_1:3;
d - 1 < (((p -' 1) div 2) + 1) - 1 by A30, XREAL_1:9;
then A31: w <= ((p -' 1) div 2) -' 1 by NAT_D:49;
A32: w >= 0 + 1 by A30, INT_1:7, XREAL_1:50;
A33: ((((p -' 1) div 2) -' 1) |-> 0) . w = 0 ;
w in Seg (((p -' 1) div 2) -' 1) by A31, A32, FINSEQ_1:1;
then A34: w in dom ((((p -' 1) div 2) -' 1) |-> 0) by A14, FINSEQ_1:def_3;
then A35: w in dom (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>) by FINSEQ_2:15;
A36: w in dom (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>) by A34, FINSEQ_2:15;
A37: fs . d = (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>)) . (w + 1) by FINSEQ_1:32
.= (((((p -' 1) div 2) -' 1) |-> 0) ^ <*1*>) . w by A35, FINSEQ_3:103
.= 0 by A33, A34, FINSEQ_1:def_7 ;
thus ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d = (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) . (w + 1) by FINSEQ_1:32
.= (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>) . w by A36, FINSEQ_3:103
.= (fs . d) * (x |^ (d -' 1)) by A33, A34, A37, FINSEQ_1:def_7
.= fr . d by A21, A24 ; ::_thesis: verum
end;
supposeA38: d = ((p -' 1) div 2) + 1 ; ::_thesis: fr . d = ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d
then d in dom fs by A17, FINSEQ_5:6;
then A39: d in dom fr by A20, FINSEQ_3:29;
fs . d = 1 by A15, A38, FINSEQ_1:42;
hence fr . d = 1 * (x |^ ((((p -' 1) div 2) + 1) -' 1)) by A21, A38, A39
.= x |^ ((p -' 1) div 2) by NAT_D:34
.= ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) . d by A15, A38, FINSEQ_1:42 ;
::_thesis: verum
end;
end;
end;
len ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) = len (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) by FINSEQ_1:32
.= 1 + (len (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) by FINSEQ_5:8
.= 1 + ((((p -' 1) div 2) -' 1) + 1) by CARD_1:def_7
.= len fr by A12, A17, A20, XREAL_1:235 ;
then dom fr = dom ((<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*>) by FINSEQ_3:29;
hence fr = (<*(- 1)*> ^ ((((p -' 1) div 2) -' 1) |-> 0)) ^ <*(x |^ ((p -' 1) div 2))*> by A23, FINSEQ_1:13; ::_thesis: verum
end;
then Sum fr = Sum (<*(- 1)*> ^ (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) by FINSEQ_1:32
.= (- 1) + (Sum (((((p -' 1) div 2) -' 1) |-> 0) ^ <*(x |^ ((p -' 1) div 2))*>)) by RVSUM_1:76
.= (- 1) + ((Sum ((((p -' 1) div 2) -' 1) |-> 0)) + (x |^ ((p -' 1) div 2))) by RVSUM_1:74
.= (- 1) + (((((p -' 1) div 2) -' 1) * 0) + (x |^ ((p -' 1) div 2))) by RVSUM_1:80 ;
hence (Poly-INT fs) . x = (x |^ ((p -' 1) div 2)) - 1 by A22; ::_thesis: verum
end;
consider fp being FinSequence of NAT such that
A40: len fp = (p -' 1) div 2 and
A41: for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 and
A42: for d being Nat st d in dom fp holds
fp . d is_quadratic_residue_mod p and
A43: for d, e being Nat st d in dom fp & e in dom fp & d <> e holds
not fp . d,fp . e are_congruent_mod p by A1, Th16;
A44: fs . (((p -' 1) div 2) + 1) = 1 by A15, FINSEQ_1:42;
now__::_thesis:_not_p_divides_(b_|^_((p_-'_1)_div_2))_-_1
assume p divides (b |^ ((p -' 1) div 2)) - 1 ; ::_thesis: contradiction
then A45: ((b |^ ((p -' 1) div 2)) - 1) mod p = 0 by Lm1;
reconsider b = b as Element of INT by INT_1:def_2;
set f = fp ^ <*b*>;
<*b*> is FinSequence of NAT by FINSEQ_1:74;
then reconsider f = fp ^ <*b*> as FinSequence of NAT by FINSEQ_1:75;
A46: len f = ((p -' 1) div 2) + 1 by A40, FINSEQ_2:16;
A47: for d, e being Nat st d in dom f & e in dom f & d <> e holds
not f . d,f . e are_congruent_mod p
proof
let d, e be Nat; ::_thesis: ( d in dom f & e in dom f & d <> e implies not f . d,f . e are_congruent_mod p )
assume that
A48: d in dom f and
A49: e in dom f and
A50: d <> e ; ::_thesis: not f . d,f . e are_congruent_mod p
A51: e >= 1 by A49, FINSEQ_3:25;
A52: d <= ((p -' 1) div 2) + 1 by A46, A48, FINSEQ_3:25;
A53: e <= ((p -' 1) div 2) + 1 by A46, A49, FINSEQ_3:25;
percases ( ( d >= 1 & d < ((p -' 1) div 2) + 1 ) or d = ((p -' 1) div 2) + 1 ) by A48, A52, FINSEQ_3:25, XXREAL_0:1;
supposeA54: ( d >= 1 & d < ((p -' 1) div 2) + 1 ) ; ::_thesis: not f . d,f . e are_congruent_mod p
then d <= (p -' 1) div 2 by NAT_1:13;
then A55: d in dom fp by A40, A54, FINSEQ_3:25;
then A56: f . d = fp . d by FINSEQ_1:def_7;
percases ( ( e >= 1 & e < ((p -' 1) div 2) + 1 ) or e = ((p -' 1) div 2) + 1 ) by A49, A53, FINSEQ_3:25, XXREAL_0:1;
supposeA57: ( e >= 1 & e < ((p -' 1) div 2) + 1 ) ; ::_thesis: not f . d,f . e are_congruent_mod p
then e <= (p -' 1) div 2 by NAT_1:13;
then A58: e in dom fp by A40, A57, FINSEQ_3:25;
then not fp . d,fp . e are_congruent_mod p by A43, A50, A55;
hence not f . d,f . e are_congruent_mod p by A56, A58, FINSEQ_1:def_7; ::_thesis: verum
end;
supposeA59: e = ((p -' 1) div 2) + 1 ; ::_thesis: not f . d,f . e are_congruent_mod p
not f . d,b are_congruent_mod p
proof
f . d is_quadratic_residue_mod p by A42, A55, A56;
then consider j being Integer such that
A60: ((j ^2) - (f . d)) mod p = 0 by Def2;
assume f . d,b are_congruent_mod p ; ::_thesis: contradiction
then A61: p divides (f . d) - b by INT_2:15;
p divides (j ^2) - (f . d) by A60, INT_1:62;
then p divides ((j ^2) - (f . d)) + ((f . d) - b) by A61, WSIERP_1:4;
then ((j ^2) - b) mod p = 0 by INT_1:62;
hence contradiction by A3, Def2; ::_thesis: verum
end;
hence not f . d,f . e are_congruent_mod p by A40, A59, FINSEQ_1:42; ::_thesis: verum
end;
end;
end;
supposeA62: d = ((p -' 1) div 2) + 1 ; ::_thesis: not f . d,f . e are_congruent_mod p
then e <= (p -' 1) div 2 by A50, A53, NAT_1:8;
then A63: e in dom fp by A40, A51, FINSEQ_3:25;
then f . e = fp . e by FINSEQ_1:def_7;
then f . e is_quadratic_residue_mod p by A42, A63;
then consider j being Integer such that
A64: ((j ^2) - (f . e)) mod p = 0 by Def2;
A65: p divides (j ^2) - (f . e) by A64, INT_1:62;
not b,f . e are_congruent_mod p
proof
assume b,f . e are_congruent_mod p ; ::_thesis: contradiction
then p divides b - (f . e) by INT_2:15;
then p divides ((j ^2) - (f . e)) - (b - (f . e)) by A65, Th1;
then ((j ^2) - b) mod p = 0 by INT_1:62;
hence contradiction by A3, Def2; ::_thesis: verum
end;
hence not f . d,f . e are_congruent_mod p by A40, A62, FINSEQ_1:42; ::_thesis: verum
end;
end;
end;
A66: ((Poly-INT fs) . b) mod p = 0 by A19, A45;
A67: for d being Nat st d in dom f holds
((Poly-INT fs) . (f . d)) mod p = 0
proof
let d be Nat; ::_thesis: ( d in dom f implies ((Poly-INT fs) . (f . d)) mod p = 0 )
assume d in dom f ; ::_thesis: ((Poly-INT fs) . (f . d)) mod p = 0
then A68: d in Seg (((p -' 1) div 2) + 1) by A46, FINSEQ_1:def_3;
then A69: d <= ((p -' 1) div 2) + 1 by FINSEQ_1:1;
percases ( ( d >= 1 & d < ((p -' 1) div 2) + 1 ) or d = ((p -' 1) div 2) + 1 ) by A68, A69, FINSEQ_1:1, XXREAL_0:1;
supposeA70: ( d >= 1 & d < ((p -' 1) div 2) + 1 ) ; ::_thesis: ((Poly-INT fs) . (f . d)) mod p = 0
reconsider k = fp . d as Element of INT by INT_1:def_2;
d <= (p -' 1) div 2 by A70, NAT_1:13;
then A71: d in dom fp by A40, A70, FINSEQ_3:25;
then (fp . d) gcd p = 1 by A41;
then ((fp . d) |^ ((p -' 1) div 2)) mod p = 1 mod p by A1, A5, A42, A71, Th17;
then ((k |^ ((p -' 1) div 2)) - 1) mod p = 0 by INT_4:22;
then ((Poly-INT fs) . k) mod p = 0 by A19;
hence ((Poly-INT fs) . (f . d)) mod p = 0 by A71, FINSEQ_1:def_7; ::_thesis: verum
end;
suppose d = ((p -' 1) div 2) + 1 ; ::_thesis: ((Poly-INT fs) . (f . d)) mod p = 0
hence ((Poly-INT fs) . (f . d)) mod p = 0 by A40, A66, FINSEQ_1:42; ::_thesis: verum
end;
end;
end;
reconsider f = f as FinSequence of INT by FINSEQ_2:24, NUMBERS:17;
not p divides fs . (((p -' 1) div 2) + 1) by A4, A44, NAT_D:7;
then len f <= (p -' 1) div 2 by A1, A17, A67, A47, Th8;
hence contradiction by A46, XREAL_1:29; ::_thesis: verum
end;
then p divides (b |^ ((p -' 1) div 2)) + 1 by A7, Th7;
then consider k being Nat such that
A72: (b |^ ((p -' 1) div 2)) + 1 = p * k by NAT_D:def_3;
- p < - 1 by A4, XREAL_1:24;
then A73: (- 1) mod p = (- 1) + p by NAT_D:63;
(b |^ ((p -' 1) div 2)) mod p = ((p * k) + (- 1)) mod p by A72
.= p - 1 by A73, NAT_D:61 ;
hence (b |^ ((p -' 1) div 2)) mod p = p - 1 ; ::_thesis: verum
end;
end;
end;
theorem Th19: :: INT_5:19
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p holds
(a |^ ((p -' 1) div 2)) mod p = p - 1
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p holds
(a |^ ((p -' 1) div 2)) mod p = p - 1
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p implies (a |^ ((p -' 1) div 2)) mod p = p - 1 )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: not a is_quadratic_residue_mod p ; ::_thesis: (a |^ ((p -' 1) div 2)) mod p = p - 1
set l = a mod p;
reconsider l = a mod p as Element of NAT by INT_1:3, INT_1:57;
A4: l mod p = a mod p by NAT_D:65;
then A5: l,a are_congruent_mod p by NAT_D:64;
then l gcd p = 1 by A2, INT_4:14;
then (l |^ ((p -' 1) div 2)) mod p = p - 1 by A1, A3, A5, Th11, Th18;
hence (a |^ ((p -' 1) div 2)) mod p = p - 1 by A4, Th13; ::_thesis: verum
end;
theorem Th20: :: INT_5:20
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
((a |^ ((p -' 1) div 2)) - 1) mod p = 0
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p holds
((a |^ ((p -' 1) div 2)) - 1) mod p = 0
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 & a is_quadratic_residue_mod p implies ((a |^ ((p -' 1) div 2)) - 1) mod p = 0 )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a is_quadratic_residue_mod p ; ::_thesis: ((a |^ ((p -' 1) div 2)) - 1) mod p = 0
A4: p > 1 by INT_2:def_4;
(a |^ ((p -' 1) div 2)) mod p = 1 by A1, A2, A3, Th17;
then (a |^ ((p -' 1) div 2)) mod p = 1 mod p by A4, NAT_D:14;
then a |^ ((p -' 1) div 2),1 are_congruent_mod p by NAT_D:64;
then p divides (a |^ ((p -' 1) div 2)) - 1 by INT_2:15;
hence ((a |^ ((p -' 1) div 2)) - 1) mod p = 0 by INT_1:62; ::_thesis: verum
end;
theorem Th21: :: INT_5:21
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p holds
((a |^ ((p -' 1) div 2)) + 1) mod p = 0
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p holds
((a |^ ((p -' 1) div 2)) + 1) mod p = 0
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 & not a is_quadratic_residue_mod p implies ((a |^ ((p -' 1) div 2)) + 1) mod p = 0 )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: not a is_quadratic_residue_mod p ; ::_thesis: ((a |^ ((p -' 1) div 2)) + 1) mod p = 0
A4: p - 1 > 2 - 1 by A1, XREAL_1:9;
A5: p - 1 < p by XREAL_1:146;
(a |^ ((p -' 1) div 2)) mod p = p - 1 by A1, A2, A3, Th19;
then (a |^ ((p -' 1) div 2)) mod p = (p - 1) mod p by A4, A5, NAT_D:63;
then a |^ ((p -' 1) div 2),p - 1 are_congruent_mod p by NAT_D:64;
then p divides (a |^ ((p -' 1) div 2)) - (p - 1) by INT_2:15;
then p divides - (((a |^ ((p -' 1) div 2)) + 1) - p) by INT_2:10;
then p divides p - ((a |^ ((p -' 1) div 2)) + 1) ;
then p divides (a |^ ((p -' 1) div 2)) + 1 by Th2;
hence ((a |^ ((p -' 1) div 2)) + 1) mod p = 0 by INT_1:62; ::_thesis: verum
end;
theorem :: INT_5:22
for a being Integer
for p being Prime
for b being Integer st a is_quadratic_residue_mod p & b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
proof
let a be Integer; ::_thesis: for p being Prime
for b being Integer st a is_quadratic_residue_mod p & b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
let p be Prime; ::_thesis: for b being Integer st a is_quadratic_residue_mod p & b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
let b be Integer; ::_thesis: ( a is_quadratic_residue_mod p & b is_quadratic_residue_mod p implies a * b is_quadratic_residue_mod p )
assume that
A1: a is_quadratic_residue_mod p and
A2: b is_quadratic_residue_mod p ; ::_thesis: a * b is_quadratic_residue_mod p
consider i being Integer such that
A3: ((i ^2) - a) mod p = 0 by A1, Def2;
consider j being Integer such that
A4: ((j ^2) - b) mod p = 0 by A2, Def2;
p divides (j ^2) - b by A4, INT_1:62;
then A5: j ^2 ,b are_congruent_mod p by INT_2:15;
p divides (i ^2) - a by A3, INT_1:62;
then i ^2 ,a are_congruent_mod p by INT_2:15;
then (i ^2) * (j ^2),a * b are_congruent_mod p by A5, INT_1:18;
then p divides ((i * j) ^2) - (a * b) by INT_2:15;
then (((i * j) ^2) - (a * b)) mod p = 0 by INT_1:62;
hence a * b is_quadratic_residue_mod p by Def2; ::_thesis: verum
end;
theorem :: INT_5:23
for a being Integer
for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
not a * b is_quadratic_residue_mod p
proof
let a be Integer; ::_thesis: for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
not a * b is_quadratic_residue_mod p
let p be Prime; ::_thesis: for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
not a * b is_quadratic_residue_mod p
let b be Integer; ::_thesis: ( p > 2 & a gcd p = 1 & b gcd p = 1 & a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p implies not a * b is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: b gcd p = 1 and
A4: a is_quadratic_residue_mod p and
A5: not b is_quadratic_residue_mod p ; ::_thesis: not a * b is_quadratic_residue_mod p
A6: (a * b) gcd p = 1 by A2, A3, WSIERP_1:6;
set l = (p -' 1) div 2;
((b |^ ((p -' 1) div 2)) + 1) mod p = 0 by A1, A3, A5, Th21;
then A7: p divides (b |^ ((p -' 1) div 2)) + 1 by INT_1:62;
A8: ((a |^ ((p -' 1) div 2)) - 1) * ((b |^ ((p -' 1) div 2)) + 1) = ((((a |^ ((p -' 1) div 2)) * (b |^ ((p -' 1) div 2))) + ((a |^ ((p -' 1) div 2)) * 1)) - (1 * (b |^ ((p -' 1) div 2)))) - (1 * 1)
.= ((((a * b) |^ ((p -' 1) div 2)) + ((a |^ ((p -' 1) div 2)) * 1)) - (1 * (b |^ ((p -' 1) div 2)))) - (1 * 1) by NEWTON:7
.= ((((a * b) |^ ((p -' 1) div 2)) - 1) + ((a |^ ((p -' 1) div 2)) - 1)) - ((b |^ ((p -' 1) div 2)) - 1) ;
((a |^ ((p -' 1) div 2)) - 1) mod p = 0 by A1, A2, A4, Th20;
then A9: p divides (a |^ ((p -' 1) div 2)) - 1 by INT_1:62;
then A10: p divides ((a |^ ((p -' 1) div 2)) - 1) * ((b |^ ((p -' 1) div 2)) + 1) by INT_2:2;
assume a * b is_quadratic_residue_mod p ; ::_thesis: contradiction
then (((a * b) |^ ((p -' 1) div 2)) - 1) mod p = 0 by A1, A6, Th20;
then p divides ((a * b) |^ ((p -' 1) div 2)) - 1 by INT_1:62;
then p divides (((a * b) |^ ((p -' 1) div 2)) - 1) + ((a |^ ((p -' 1) div 2)) - 1) by A9, WSIERP_1:4;
then p divides (b |^ ((p -' 1) div 2)) - 1 by A10, A8, Th2;
then p divides ((b |^ ((p -' 1) div 2)) + 1) - ((b |^ ((p -' 1) div 2)) - 1) by A7, Th1;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
theorem :: INT_5:24
for a being Integer
for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & not a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
proof
let a be Integer; ::_thesis: for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & not a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
let p be Prime; ::_thesis: for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 & not a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p holds
a * b is_quadratic_residue_mod p
let b be Integer; ::_thesis: ( p > 2 & a gcd p = 1 & b gcd p = 1 & not a is_quadratic_residue_mod p & not b is_quadratic_residue_mod p implies a * b is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: b gcd p = 1 and
A4: not a is_quadratic_residue_mod p and
A5: not b is_quadratic_residue_mod p ; ::_thesis: a * b is_quadratic_residue_mod p
A6: (a * b) gcd p = 1 by A2, A3, WSIERP_1:6;
set l = (p -' 1) div 2;
((b |^ ((p -' 1) div 2)) + 1) mod p = 0 by A1, A3, A5, Th21;
then A7: p divides (b |^ ((p -' 1) div 2)) + 1 by INT_1:62;
A8: ((a |^ ((p -' 1) div 2)) + 1) * ((b |^ ((p -' 1) div 2)) + 1) = ((((a |^ ((p -' 1) div 2)) * (b |^ ((p -' 1) div 2))) + ((a |^ ((p -' 1) div 2)) * 1)) + (1 * (b |^ ((p -' 1) div 2)))) + (1 * 1)
.= ((((a * b) |^ ((p -' 1) div 2)) + (a |^ ((p -' 1) div 2))) + (b |^ ((p -' 1) div 2))) + 1 by NEWTON:7
.= ((((a * b) |^ ((p -' 1) div 2)) + 1) + ((a |^ ((p -' 1) div 2)) + 1)) - (1 - (b |^ ((p -' 1) div 2))) ;
((a |^ ((p -' 1) div 2)) + 1) mod p = 0 by A1, A2, A4, Th21;
then A9: p divides (a |^ ((p -' 1) div 2)) + 1 by INT_1:62;
then A10: p divides ((a |^ ((p -' 1) div 2)) + 1) * ((b |^ ((p -' 1) div 2)) + 1) by INT_2:2;
now__::_thesis:_a_*_b_is_quadratic_residue_mod_p
assume not a * b is_quadratic_residue_mod p ; ::_thesis: contradiction
then (((a * b) |^ ((p -' 1) div 2)) + 1) mod p = 0 by A1, A6, Th21;
then p divides ((a * b) |^ ((p -' 1) div 2)) + 1 by INT_1:62;
then p divides (((a * b) |^ ((p -' 1) div 2)) + 1) + ((a |^ ((p -' 1) div 2)) + 1) by A9, WSIERP_1:4;
then p divides 1 - (b |^ ((p -' 1) div 2)) by A10, A8, Th2;
then p divides ((b |^ ((p -' 1) div 2)) + 1) + (1 - (b |^ ((p -' 1) div 2))) by A7, WSIERP_1:4;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
hence a * b is_quadratic_residue_mod p ; ::_thesis: verum
end;
definition
let a be Integer;
let p be Prime;
func Lege (a,p) -> Integer equals :Def3: :: INT_5:def 3
1 if ( a is_quadratic_residue_mod p & a mod p <> 0 )
0 if ( a is_quadratic_residue_mod p & a mod p = 0 )
otherwise - 1;
coherence
( ( a is_quadratic_residue_mod p & a mod p <> 0 implies 1 is Integer ) & ( a is_quadratic_residue_mod p & a mod p = 0 implies 0 is Integer ) & ( ( not a is_quadratic_residue_mod p or not a mod p <> 0 ) & ( not a is_quadratic_residue_mod p or not a mod p = 0 ) implies - 1 is Integer ) ) ;
consistency
for b1 being Integer st a is_quadratic_residue_mod p & a mod p <> 0 & a is_quadratic_residue_mod p & a mod p = 0 holds
( b1 = 1 iff b1 = 0 ) ;
end;
:: deftheorem Def3 defines Lege INT_5:def_3_:_
for a being Integer
for p being Prime holds
( ( a is_quadratic_residue_mod p & a mod p <> 0 implies Lege (a,p) = 1 ) & ( a is_quadratic_residue_mod p & a mod p = 0 implies Lege (a,p) = 0 ) & ( ( not a is_quadratic_residue_mod p or not a mod p <> 0 ) & ( not a is_quadratic_residue_mod p or not a mod p = 0 ) implies Lege (a,p) = - 1 ) );
theorem Th25: :: INT_5:25
for a being Integer
for p being Prime holds
( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
proof
let a be Integer; ::_thesis: for p being Prime holds
( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
let p be Prime; ::_thesis: ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
percases ( ( a is_quadratic_residue_mod p & a mod p <> 0 ) or ( a is_quadratic_residue_mod p & a mod p = 0 ) or not a is_quadratic_residue_mod p ) ;
suppose ( a is_quadratic_residue_mod p & a mod p <> 0 ) ; ::_thesis: ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
hence ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 ) by Def3; ::_thesis: verum
end;
suppose ( a is_quadratic_residue_mod p & a mod p = 0 ) ; ::_thesis: ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
hence ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 ) by Def3; ::_thesis: verum
end;
suppose not a is_quadratic_residue_mod p ; ::_thesis: ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 )
hence ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 ) by Def3; ::_thesis: verum
end;
end;
end;
theorem Th26: :: INT_5:26
for a being Integer
for p being Prime st a mod p <> 0 holds
Lege ((a ^2),p) = 1
proof
let a be Integer; ::_thesis: for p being Prime st a mod p <> 0 holds
Lege ((a ^2),p) = 1
let p be Prime; ::_thesis: ( a mod p <> 0 implies Lege ((a ^2),p) = 1 )
assume a mod p <> 0 ; ::_thesis: Lege ((a ^2),p) = 1
then not p divides a by INT_1:62;
then not p divides a ^2 by Th7;
then A1: (a ^2) mod p <> 0 by INT_1:62;
a ^2 is_quadratic_residue_mod p by Th9;
hence Lege ((a ^2),p) = 1 by Def3, A1; ::_thesis: verum
end;
theorem :: INT_5:27
for p being Prime holds Lege (1,p) = 1
proof
let p be Prime; ::_thesis: Lege (1,p) = 1
1 < p by INT_2:def_4;
then 1 mod p <> 0 by NAT_D:14;
then Lege ((1 ^2),p) = 1 by Th26;
hence Lege (1,p) = 1 ; ::_thesis: verum
end;
Lm3: for a being Integer
for p being Prime st a gcd p = 1 holds
not p divides a
proof
let a be Integer; ::_thesis: for p being Prime st a gcd p = 1 holds
not p divides a
let p be Prime; ::_thesis: ( a gcd p = 1 implies not p divides a )
assume A1: a gcd p = 1 ; ::_thesis: not p divides a
assume p divides a ; ::_thesis: contradiction
then p divides p gcd a by INT_2:def_2;
then p = 1 by A1, WSIERP_1:15;
hence contradiction by INT_2:def_4; ::_thesis: verum
end;
theorem Th28: :: INT_5:28
for a being Integer
for p being Prime st p > 2 & a gcd p = 1 holds
Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p
proof
let a be Integer; ::_thesis: for p being Prime st p > 2 & a gcd p = 1 holds
Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p
let p be Prime; ::_thesis: ( p > 2 & a gcd p = 1 implies Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p )
assume that
A1: p > 2 and
A2: a gcd p = 1 ; ::_thesis: Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p
not p divides a by Lm3, A2;
then A3: a mod p <> 0 by INT_1:62;
A4: p > 1 by INT_2:def_4;
then - p < - 1 by XREAL_1:24;
then A5: (- 1) mod p = p + (- 1) by NAT_D:63;
percases ( a is_quadratic_residue_mod p or not a is_quadratic_residue_mod p ) ;
supposeA6: a is_quadratic_residue_mod p ; ::_thesis: Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p
then (a |^ ((p -' 1) div 2)) mod p = 1 by A1, A2, Th17;
then (a |^ ((p -' 1) div 2)) mod p = 1 mod p by A4, NAT_D:14;
then (a |^ ((p -' 1) div 2)) mod p = (Lege (a,p)) mod p by A6, Def3, A3;
hence Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p by NAT_D:64; ::_thesis: verum
end;
supposeA7: not a is_quadratic_residue_mod p ; ::_thesis: Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p
then (a |^ ((p -' 1) div 2)) mod p = p - 1 by A1, A2, Th19
.= (Lege (a,p)) mod p by A5, A7, Def3 ;
hence Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p by NAT_D:64; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:29
for a being Integer
for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & a,b are_congruent_mod p holds
Lege (a,p) = Lege (b,p)
proof
let a be Integer; ::_thesis: for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & a,b are_congruent_mod p holds
Lege (a,p) = Lege (b,p)
let p be Prime; ::_thesis: for b being Integer st p > 2 & a gcd p = 1 & a,b are_congruent_mod p holds
Lege (a,p) = Lege (b,p)
let b be Integer; ::_thesis: ( p > 2 & a gcd p = 1 & a,b are_congruent_mod p implies Lege (a,p) = Lege (b,p) )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: a,b are_congruent_mod p ; ::_thesis: Lege (a,p) = Lege (b,p)
Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p by A1, A2, Th28;
then A4: (Lege (a,p)) mod p = (a |^ ((p -' 1) div 2)) mod p by NAT_D:64;
b gcd p = 1 by A2, A3, INT_4:14;
then Lege (b,p),b |^ ((p -' 1) div 2) are_congruent_mod p by A1, Th28;
then A5: (Lege (b,p)) mod p = (b |^ ((p -' 1) div 2)) mod p by NAT_D:64;
a mod p = b mod p by A3, NAT_D:64;
then (Lege (a,p)) mod p = (Lege (b,p)) mod p by A4, A5, Th13;
then Lege (a,p), Lege (b,p) are_congruent_mod p by NAT_D:64;
then A6: p divides (Lege (a,p)) - (Lege (b,p)) by INT_2:15;
percases ( Lege (a,p) = 1 or Lege (a,p) = 0 or Lege (a,p) = - 1 ) by Th25;
supposeA7: Lege (a,p) = 1 ; ::_thesis: Lege (a,p) = Lege (b,p)
A8: now__::_thesis:_not_Lege_(b,p)_=_0
assume Lege (b,p) = 0 ; ::_thesis: contradiction
then p = 1 by A6, A7, WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
Lege (b,p) <> - 1 by A7, A1, A6, NAT_D:7;
hence Lege (a,p) = Lege (b,p) by A7, A8, Th25; ::_thesis: verum
end;
supposeA9: Lege (a,p) = 0 ; ::_thesis: Lege (a,p) = Lege (b,p)
A10: now__::_thesis:_not_Lege_(b,p)_=_1
assume Lege (b,p) = 1 ; ::_thesis: contradiction
then p divides 1 by A6, A9, INT_2:10;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
now__::_thesis:_not_Lege_(b,p)_=_-_1
assume Lege (b,p) = - 1 ; ::_thesis: contradiction
then p = 1 by A6, A9, WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege (a,p) = Lege (b,p) by A9, Th25, A10; ::_thesis: verum
end;
supposeA11: Lege (a,p) = - 1 ; ::_thesis: Lege (a,p) = Lege (b,p)
A12: now__::_thesis:_not_Lege_(b,p)_=_1
assume Lege (b,p) = 1 ; ::_thesis: contradiction
then p divides - 2 by A6, A11;
then p divides 2 by INT_2:10;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
now__::_thesis:_not_Lege_(b,p)_=_0
assume Lege (b,p) = 0 ; ::_thesis: contradiction
then p divides 1 by A6, A11, INT_2:10;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege (a,p) = Lege (b,p) by A11, Th25, A12; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:30
for a being Integer
for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 holds
Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
proof
let a be Integer; ::_thesis: for p being Prime
for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 holds
Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
let p be Prime; ::_thesis: for b being Integer st p > 2 & a gcd p = 1 & b gcd p = 1 holds
Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
let b be Integer; ::_thesis: ( p > 2 & a gcd p = 1 & b gcd p = 1 implies Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p)) )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: b gcd p = 1 ; ::_thesis: Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
A4: Lege (b,p),b |^ ((p -' 1) div 2) are_congruent_mod p by A1, A3, Th28;
Lege (a,p),a |^ ((p -' 1) div 2) are_congruent_mod p by A1, A2, Th28;
then (Lege (a,p)) * (Lege (b,p)),(a |^ ((p -' 1) div 2)) * (b |^ ((p -' 1) div 2)) are_congruent_mod p by A4, INT_1:18;
then (Lege (a,p)) * (Lege (b,p)),(a * b) |^ ((p -' 1) div 2) are_congruent_mod p by NEWTON:7;
then A5: (a * b) |^ ((p -' 1) div 2),(Lege (a,p)) * (Lege (b,p)) are_congruent_mod p by INT_1:14;
(a * b) gcd p = 1 by A2, A3, WSIERP_1:6;
then Lege ((a * b),p),(a * b) |^ ((p -' 1) div 2) are_congruent_mod p by A1, Th28;
then Lege ((a * b),p),(Lege (a,p)) * (Lege (b,p)) are_congruent_mod p by A5, INT_1:15;
then A6: p divides (Lege ((a * b),p)) - ((Lege (a,p)) * (Lege (b,p))) by INT_2:15;
A7: ( Lege (b,p) = 1 or Lege (b,p) = - 1 or Lege (b,p) = 0 ) by Th25;
A8: ( Lege (a,p) = 1 or Lege (a,p) = - 1 or Lege (a,p) = 0 ) by Th25;
percases ( Lege ((a * b),p) = 1 or Lege ((a * b),p) = 0 or Lege ((a * b),p) = - 1 ) by Th25;
supposeA9: Lege ((a * b),p) = 1 ; ::_thesis: Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
now__::_thesis:_(_not_Lege_(a,p)_=_0_&_not_Lege_(b,p)_=_0_)
assume ( Lege (a,p) = 0 or Lege (b,p) = 0 ) ; ::_thesis: contradiction
then p = 1 by A6, A9, WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p)) by A8, A7, A1, A6, A9, NAT_D:7; ::_thesis: verum
end;
supposeA10: Lege ((a * b),p) = 0 ; ::_thesis: Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
A11: now__::_thesis:_not_(Lege_(a,p))_*_(Lege_(b,p))_=_-_1
assume (Lege (a,p)) * (Lege (b,p)) = - 1 ; ::_thesis: contradiction
then p <= 1 by A6, A10, NAT_D:7;
then p < 1 + 1 by NAT_1:13;
hence contradiction by A1; ::_thesis: verum
end;
now__::_thesis:_not_(Lege_(a,p))_*_(Lege_(b,p))_=_1
assume (Lege (a,p)) * (Lege (b,p)) = 1 ; ::_thesis: contradiction
then p divides 1 by A6, A10, INT_2:10;
then p <= 1 by NAT_D:7;
then p < 1 + 1 by NAT_1:13;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p)) by A8, A7, A11, A10; ::_thesis: verum
end;
supposeA12: Lege ((a * b),p) = - 1 ; ::_thesis: Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p))
A13: now__::_thesis:_(_not_Lege_(a,p)_=_0_&_not_Lege_(b,p)_=_0_)
assume ( Lege (a,p) = 0 or Lege (b,p) = 0 ) ; ::_thesis: contradiction
then ( p = 1 or p = - 1 ) by A6, A12, INT_2:13;
hence contradiction by INT_2:def_4; ::_thesis: verum
end;
now__::_thesis:_not_(Lege_(a,p))_*_(Lege_(b,p))_=_1
assume (Lege (a,p)) * (Lege (b,p)) = 1 ; ::_thesis: contradiction
then p divides - 2 by A6, A12;
then p divides 2 by INT_2:10;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
hence Lege ((a * b),p) = (Lege (a,p)) * (Lege (b,p)) by A12, A13, A7, A8; ::_thesis: verum
end;
end;
end;
theorem Th31: :: INT_5:31
for fr being FinSequence of INT holds
( ex d being Nat st
( d in dom fr & not fr . d = 1 & not fr . d = 0 & not fr . d = - 1 ) or Product fr = 1 or Product fr = 0 or Product fr = - 1 )
proof
let fr be FinSequence of INT ; ::_thesis: ( ex d being Nat st
( d in dom fr & not fr . d = 1 & not fr . d = 0 & not fr . d = - 1 ) or Product fr = 1 or Product fr = 0 or Product fr = - 1 )
defpred S1[ FinSequence of INT ] means ( ex d being Nat st
( d in dom $1 & not $1 . d = 1 & not $1 . d = 0 & not $1 . d = - 1 ) or Product $1 = 1 or Product $1 = 0 or Product $1 = - 1 );
A1: for p being FinSequence of INT
for n being Element of INT st S1[p] holds
S1[p ^ <*n*>]
proof
let p be FinSequence of INT ; ::_thesis: for n being Element of INT st S1[p] holds
S1[p ^ <*n*>]
let i be Element of INT ; ::_thesis: ( S1[p] implies S1[p ^ <*i*>] )
set p1 = p ^ <*i*>;
assume A2: S1[p] ; ::_thesis: S1[p ^ <*i*>]
S1[p ^ <*i*>]
proof
assume A3: for d being Nat holds
( not d in dom (p ^ <*i*>) or (p ^ <*i*>) . d = 1 or (p ^ <*i*>) . d = 0 or (p ^ <*i*>) . d = - 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
A4: for d being Nat holds
( not d in dom p or p . d = 1 or p . d = 0 or p . d = - 1 )
proof
let d be Nat; ::_thesis: ( not d in dom p or p . d = 1 or p . d = 0 or p . d = - 1 )
assume A5: d in dom p ; ::_thesis: ( p . d = 1 or p . d = 0 or p . d = - 1 )
then ( (p ^ <*i*>) . d = 1 or (p ^ <*i*>) . d = 0 or (p ^ <*i*>) . d = - 1 ) by A3, FINSEQ_2:15;
hence ( p . d = 1 or p . d = 0 or p . d = - 1 ) by A5, FINSEQ_1:def_7; ::_thesis: verum
end;
A6: len (p ^ <*i*>) in dom (p ^ <*i*>) by FINSEQ_5:6;
A7: Product (p ^ <*i*>) = (Product p) * i by RVSUM_1:96;
len (p ^ <*i*>) = (len p) + 1 by FINSEQ_2:16;
then A8: ( (p ^ <*i*>) . ((len p) + 1) = 1 or (p ^ <*i*>) . ((len p) + 1) = 0 or (p ^ <*i*>) . ((len p) + 1) = - 1 ) by A3, A6;
percases ( ( Product p = 1 & i = 1 ) or ( Product p = 1 & i = 0 ) or ( Product p = 1 & i = - 1 ) or ( Product p = - 1 & i = 1 ) or ( Product p = - 1 & i = 0 ) or ( Product p = - 1 & i = - 1 ) or ( Product p = 0 & i = 1 ) or ( Product p = 0 & i = 0 ) or ( Product p = 0 & i = - 1 ) ) by A2, A4, A8, FINSEQ_1:42;
suppose ( Product p = 1 & i = 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = 1 & i = 0 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = 1 & i = - 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = - 1 & i = 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = - 1 & i = 0 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = - 1 & i = - 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = 0 & i = 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = 0 & i = 0 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
suppose ( Product p = 0 & i = - 1 ) ; ::_thesis: ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 )
hence ( Product (p ^ <*i*>) = 1 or Product (p ^ <*i*>) = 0 or Product (p ^ <*i*>) = - 1 ) by A7; ::_thesis: verum
end;
end;
end;
hence S1[p ^ <*i*>] ; ::_thesis: verum
end;
A9: S1[ <*> INT] by RVSUM_1:94;
for p being FinSequence of INT holds S1[p] from FINSEQ_2:sch_2(A9, A1);
hence ( ex d being Nat st
( d in dom fr & not fr . d = 1 & not fr . d = 0 & not fr . d = - 1 ) or Product fr = 1 or Product fr = 0 or Product fr = - 1 ) ; ::_thesis: verum
end;
theorem Th32: :: INT_5:32
for m being Integer
for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) holds
Product f, Product fr are_congruent_mod m
proof
let m be Integer; ::_thesis: for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) holds
Product f, Product fr are_congruent_mod m
defpred S1[ Nat] means for f, fr being FinSequence of INT st len f = $1 & len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) holds
Product f, Product fr are_congruent_mod m;
A1: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
S1[n + 1]
proof
let f, fr be FinSequence of INT ; ::_thesis: ( len f = n + 1 & len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) implies Product f, Product fr are_congruent_mod m )
assume that
A3: len f = n + 1 and
A4: len f = len fr and
A5: for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ; ::_thesis: Product f, Product fr are_congruent_mod m
consider fr1 being FinSequence of INT , b being Element of INT such that
A6: fr = fr1 ^ <*b*> by A3, A4, FINSEQ_2:19;
f <> {} by A3;
then A7: n + 1 in dom f by A3, FINSEQ_5:6;
consider f1 being FinSequence of INT , a being Element of INT such that
A8: f = f1 ^ <*a*> by A3, FINSEQ_2:19;
A9: n + 1 = (len fr1) + 1 by A3, A4, A6, FINSEQ_2:16;
then A10: fr . (n + 1) = b by A6, FINSEQ_1:42;
A11: n + 1 = (len f1) + 1 by A3, A8, FINSEQ_2:16;
then A12: dom f1 = dom fr1 by A9, FINSEQ_3:29;
for d being Nat st d in dom f1 holds
f1 . d,fr1 . d are_congruent_mod m
proof
let d be Nat; ::_thesis: ( d in dom f1 implies f1 . d,fr1 . d are_congruent_mod m )
assume A13: d in dom f1 ; ::_thesis: f1 . d,fr1 . d are_congruent_mod m
then A14: f . d = f1 . d by A8, FINSEQ_1:def_7;
fr . d = fr1 . d by A6, A12, A13, FINSEQ_1:def_7;
hence f1 . d,fr1 . d are_congruent_mod m by A5, A8, A13, A14, FINSEQ_2:15; ::_thesis: verum
end;
then A15: Product f1, Product fr1 are_congruent_mod m by A2, A11, A9;
f . (n + 1) = a by A8, A11, FINSEQ_1:42;
then a,b are_congruent_mod m by A5, A7, A10;
then (Product f1) * a,(Product fr1) * b are_congruent_mod m by A15, INT_1:18;
then Product f,(Product fr1) * b are_congruent_mod m by A8, RVSUM_1:96;
hence Product f, Product fr are_congruent_mod m by A6, RVSUM_1:96; ::_thesis: verum
end;
hence S1[n + 1] ; ::_thesis: verum
end;
A16: S1[ 0 ]
proof
let f, fr be FinSequence of INT ; ::_thesis: ( len f = 0 & len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) implies Product f, Product fr are_congruent_mod m )
assume that
A17: len f = 0 and
A18: len f = len fr ; ::_thesis: ( ex d being Nat st
( d in dom f & not f . d,fr . d are_congruent_mod m ) or Product f, Product fr are_congruent_mod m )
A19: f = <*> INT by A17;
fr = <*> INT by A17, A18;
hence ( ex d being Nat st
( d in dom f & not f . d,fr . d are_congruent_mod m ) or Product f, Product fr are_congruent_mod m ) by A19, INT_1:11; ::_thesis: verum
end;
for n being Element of NAT holds S1[n] from NAT_1:sch_1(A16, A1);
hence for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d,fr . d are_congruent_mod m ) holds
Product f, Product fr are_congruent_mod m ; ::_thesis: verum
end;
theorem Th33: :: INT_5:33
for m being Integer
for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) holds
Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m
proof
let m be Integer; ::_thesis: for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) holds
Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m
defpred S1[ Nat] means for f, fr being FinSequence of INT st len f = $1 & len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) holds
Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m;
A1: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
S1[n + 1]
proof
let f, fr be FinSequence of INT ; ::_thesis: ( len f = n + 1 & len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) implies Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m )
assume that
A3: len f = n + 1 and
A4: len f = len fr and
A5: for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ; ::_thesis: Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m
consider fr1 being FinSequence of INT , b being Element of INT such that
A6: fr = fr1 ^ <*b*> by A3, A4, FINSEQ_2:19;
f <> {} by A3;
then A7: n + 1 in dom f by A3, FINSEQ_5:6;
consider f1 being FinSequence of INT , a being Element of INT such that
A8: f = f1 ^ <*a*> by A3, FINSEQ_2:19;
A9: n + 1 = (len fr1) + 1 by A3, A4, A6, FINSEQ_2:16;
then A10: fr . (n + 1) = b by A6, FINSEQ_1:42;
A11: n + 1 = (len f1) + 1 by A3, A8, FINSEQ_2:16;
then A12: dom f1 = dom fr1 by A9, FINSEQ_3:29;
for d being Nat st d in dom f1 holds
f1 . d, - (fr1 . d) are_congruent_mod m
proof
let d be Nat; ::_thesis: ( d in dom f1 implies f1 . d, - (fr1 . d) are_congruent_mod m )
assume A13: d in dom f1 ; ::_thesis: f1 . d, - (fr1 . d) are_congruent_mod m
then A14: f . d = f1 . d by A8, FINSEQ_1:def_7;
fr . d = fr1 . d by A6, A12, A13, FINSEQ_1:def_7;
hence f1 . d, - (fr1 . d) are_congruent_mod m by A5, A8, A13, A14, FINSEQ_2:15; ::_thesis: verum
end;
then A15: Product f1,((- 1) |^ (len f1)) * (Product fr1) are_congruent_mod m by A2, A11, A9;
f . (n + 1) = a by A8, A11, FINSEQ_1:42;
then a, - b are_congruent_mod m by A5, A7, A10;
then (Product f1) * a,(((- 1) |^ (len f1)) * (Product fr1)) * (- b) are_congruent_mod m by A15, INT_1:18;
then Product f,(((- 1) |^ (len f1)) * (- 1)) * ((Product fr1) * b) are_congruent_mod m by A8, RVSUM_1:96;
then Product f,((- 1) |^ ((len f1) + 1)) * ((Product fr1) * b) are_congruent_mod m by NEWTON:6;
hence Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m by A3, A6, A11, RVSUM_1:96; ::_thesis: verum
end;
hence S1[n + 1] ; ::_thesis: verum
end;
A16: S1[ 0 ]
proof
let f, fr be FinSequence of INT ; ::_thesis: ( len f = 0 & len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) implies Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m )
assume that
A17: len f = 0 and
A18: len f = len fr ; ::_thesis: ( ex d being Nat st
( d in dom f & not f . d, - (fr . d) are_congruent_mod m ) or Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m )
A19: f = <*> INT by A17;
A20: (- 1) |^ (len f) = 1 by A17, NEWTON:4;
fr = <*> INT by A17, A18;
hence ( ex d being Nat st
( d in dom f & not f . d, - (fr . d) are_congruent_mod m ) or Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m ) by A19, A20, INT_1:11; ::_thesis: verum
end;
for n being Element of NAT holds S1[n] from NAT_1:sch_1(A16, A1);
hence for f, fr being FinSequence of INT st len f = len fr & ( for d being Nat st d in dom f holds
f . d, - (fr . d) are_congruent_mod m ) holds
Product f,((- 1) |^ (len f)) * (Product fr) are_congruent_mod m ; ::_thesis: verum
end;
theorem Th34: :: INT_5:34
for p being Prime
for fp being FinSequence of NAT st p > 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) holds
ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
proof
let p be Prime; ::_thesis: for fp being FinSequence of NAT st p > 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) holds
ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
let fp be FinSequence of NAT ; ::_thesis: ( p > 2 & ( for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ) implies ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr ) )
assume A1: p > 2 ; ::_thesis: ( ex d being Nat st
( d in dom fp & not (fp . d) gcd p = 1 ) or ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr ) )
deffunc H1( Nat) -> Integer = Lege ((fp . $1),p);
set k = (p -' 1) div 2;
assume A2: for d being Nat st d in dom fp holds
(fp . d) gcd p = 1 ; ::_thesis: ex fr being FinSequence of INT st
( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
set f = fp |^ ((p -' 1) div 2);
reconsider f = fp |^ ((p -' 1) div 2) as FinSequence of INT by FINSEQ_2:24, NUMBERS:17;
consider fr being FinSequence such that
A3: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = H1(d) ) ) from FINSEQ_1:sch_2();
for d being Nat st d in dom fr holds
fr . d in INT
proof
let d be Nat; ::_thesis: ( d in dom fr implies fr . d in INT )
assume d in dom fr ; ::_thesis: fr . d in INT
then fr . d = Lege ((fp . d),p) by A3;
hence fr . d in INT by INT_1:def_2; ::_thesis: verum
end;
then reconsider fr = fr as FinSequence of INT by FINSEQ_2:12;
A4: fp is FinSequence of REAL by FINSEQ_2:24;
A5: len f = len fp by NAT_3:def_1;
for d being Nat st d in dom fr holds
fr . d,f . d are_congruent_mod p
proof
let d be Nat; ::_thesis: ( d in dom fr implies fr . d,f . d are_congruent_mod p )
assume A6: d in dom fr ; ::_thesis: fr . d,f . d are_congruent_mod p
then d in dom fp by A3, FINSEQ_3:29;
then (fp . d) gcd p = 1 by A2;
then Lege ((fp . d),p),(fp . d) |^ ((p -' 1) div 2) are_congruent_mod p by A1, Th28;
then A7: fr . d,(fp . d) |^ ((p -' 1) div 2) are_congruent_mod p by A3, A6;
d in dom f by A3, A5, A6, FINSEQ_3:29;
hence fr . d,f . d are_congruent_mod p by A7, NAT_3:def_1; ::_thesis: verum
end;
then A8: Product f, Product fr are_congruent_mod p by A3, A5, Th32, INT_1:14;
(Product fp) gcd p = 1 by A2, WSIERP_1:36;
then Lege ((Product fp),p),(Product fp) |^ ((p -' 1) div 2) are_congruent_mod p by A1, Th28;
then Lege ((Product fp),p), Product f are_congruent_mod p by A4, NAT_3:15;
then Lege ((Product fp),p), Product fr are_congruent_mod p by A8, INT_1:15;
then A9: p divides (Lege ((Product fp),p)) - (Product fr) by INT_2:15;
take fr ; ::_thesis: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
A10: for d being Nat holds
( not d in dom fr or fr . d = 1 or fr . d = 0 or fr . d = - 1 )
proof
let d be Nat; ::_thesis: ( not d in dom fr or fr . d = 1 or fr . d = 0 or fr . d = - 1 )
assume d in dom fr ; ::_thesis: ( fr . d = 1 or fr . d = 0 or fr . d = - 1 )
then fr . d = Lege ((fp . d),p) by A3;
hence ( fr . d = 1 or fr . d = 0 or fr . d = - 1 ) by Th25; ::_thesis: verum
end;
percases ( Lege ((Product fp),p) = 1 or Lege ((Product fp),p) = 0 or Lege ((Product fp),p) = - 1 ) by Th25;
supposeA11: Lege ((Product fp),p) = 1 ; ::_thesis: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
then A12: Product fr <> - 1 by A1, A9, NAT_D:7;
now__::_thesis:_not_Product_fr_=_0
assume Product fr = 0 ; ::_thesis: contradiction
then p = 1 by A9, A11, WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr ) by A3, A10, A11, Th31, A12; ::_thesis: verum
end;
supposeA13: Lege ((Product fp),p) = 0 ; ::_thesis: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
A14: now__::_thesis:_not_Product_fr_=_-_1
assume Product fr = - 1 ; ::_thesis: contradiction
then p = 1 by A9, A13, WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
now__::_thesis:_not_Product_fr_=_1
assume Product fr = 1 ; ::_thesis: contradiction
then p divides 1 by A9, A13, INT_2:10;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr ) by A3, A10, A13, Th31, A14; ::_thesis: verum
end;
supposeA15: Lege ((Product fp),p) = - 1 ; ::_thesis: ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr )
A16: now__::_thesis:_not_Product_fr_=_1
assume Product fr = 1 ; ::_thesis: contradiction
then p divides - 2 by A9, A15;
then p divides 2 by INT_2:10;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
now__::_thesis:_not_Product_fr_=_0
assume Product fr = 0 ; ::_thesis: contradiction
then p divides 1 by A9, A15, INT_2:10;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence ( len fr = len fp & ( for d being Nat st d in dom fr holds
fr . d = Lege ((fp . d),p) ) & Lege ((Product fp),p) = Product fr ) by A3, A10, A15, Th31, A16; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:35
for d, e being Nat
for p being Prime st p > 2 & d gcd p = 1 & e gcd p = 1 holds
Lege (((d ^2) * e),p) = Lege (e,p)
proof
let d, e be Nat; ::_thesis: for p being Prime st p > 2 & d gcd p = 1 & e gcd p = 1 holds
Lege (((d ^2) * e),p) = Lege (e,p)
let p be Prime; ::_thesis: ( p > 2 & d gcd p = 1 & e gcd p = 1 implies Lege (((d ^2) * e),p) = Lege (e,p) )
assume that
A1: p > 2 and
A2: d gcd p = 1 and
A3: e gcd p = 1 ; ::_thesis: Lege (((d ^2) * e),p) = Lege (e,p)
reconsider d2 = d ^2 , e = e as Element of NAT by ORDINAL1:def_12;
set fp = <*d2,e*>;
reconsider fp = <*d2,e*> as FinSequence of NAT by FINSEQ_2:13;
not p divides d by A2, Lm3;
then d mod p <> 0 by INT_1:62;
then A4: Lege ((d ^2),p) = 1 by Th26;
reconsider p = p as prime Element of NAT by ORDINAL1:def_12;
for k being Nat st k in dom fp holds
(fp . k) gcd p = 1
proof
let k be Nat; ::_thesis: ( k in dom fp implies (fp . k) gcd p = 1 )
assume k in dom fp ; ::_thesis: (fp . k) gcd p = 1
then k in Seg (len fp) by FINSEQ_1:def_3;
then A5: k in Seg 2 by FINSEQ_1:44;
percases ( k = 1 or k = 2 ) by A5, FINSEQ_1:2, TARSKI:def_2;
suppose k = 1 ; ::_thesis: (fp . k) gcd p = 1
then fp . k = d ^2 by FINSEQ_1:44;
hence (fp . k) gcd p = 1 by A2, WSIERP_1:7; ::_thesis: verum
end;
suppose k = 2 ; ::_thesis: (fp . k) gcd p = 1
hence (fp . k) gcd p = 1 by A3, FINSEQ_1:44; ::_thesis: verum
end;
end;
end;
then consider fr being FinSequence of INT such that
A6: len fr = len fp and
A7: for k being Nat st k in dom fr holds
fr . k = Lege ((fp . k),p) and
A8: Lege ((Product fp),p) = Product fr by A1, Th34;
A9: len fr = 2 by A6, FINSEQ_1:44;
then 2 in dom fr by FINSEQ_3:25;
then fr . 2 = Lege ((fp . 2),p) by A7;
then A10: fr . 2 = Lege (e,p) by FINSEQ_1:44;
1 in dom fr by A9, FINSEQ_3:25;
then fr . 1 = Lege ((fp . 1),p) by A7;
then fr . 1 = Lege ((d ^2),p) by FINSEQ_1:44;
then fr = <*1,(Lege (e,p))*> by A4, A9, A10, FINSEQ_1:44;
then Product fr = 1 * (Lege (e,p)) by RVSUM_1:99;
hence Lege (((d ^2) * e),p) = Lege (e,p) by A8, RVSUM_1:99; ::_thesis: verum
end;
theorem Th36: :: INT_5:36
for p being Prime st p > 2 holds
Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2)
proof
let p be Prime; ::_thesis: ( p > 2 implies Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2) )
assume A1: p > 2 ; ::_thesis: Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2)
abs ((- 1) |^ ((p -' 1) div 2)) = 1 by SERIES_2:1;
then A2: ( (- 1) |^ ((p -' 1) div 2) = 1 or - ((- 1) |^ ((p -' 1) div 2)) = 1 ) by ABSVALUE:1;
(- 1) gcd p = ((- 1) |^ 1) gcd p by NEWTON:5
.= (abs ((- 1) |^ 1)) gcd (abs p) by INT_2:34
.= 1 gcd (abs p) by SERIES_2:1
.= 1 by NEWTON:51 ;
then A3: Lege ((- 1),p),(- 1) |^ ((p -' 1) div 2) are_congruent_mod p by A1, Th28;
percases ( (- 1) |^ ((p -' 1) div 2) = 1 or (- 1) |^ ((p -' 1) div 2) = - 1 ) by A2;
supposeA4: (- 1) |^ ((p -' 1) div 2) = 1 ; ::_thesis: Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2)
then A5: p divides (Lege ((- 1),p)) - 1 by A3, INT_2:15;
A6: now__::_thesis:_not_Lege_((-_1),p)_=_-_1
assume Lege ((- 1),p) = - 1 ; ::_thesis: contradiction
then p divides - 2 by A5;
then p divides 2 by INT_2:10;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
now__::_thesis:_not_Lege_((-_1),p)_=_0
assume Lege ((- 1),p) = 0 ; ::_thesis: contradiction
then p divides 1 by A5, INT_2:10;
then p <= 1 by NAT_D:7;
then p < 1 + 1 by NAT_1:13;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2) by A4, Th25, A6; ::_thesis: verum
end;
supposeA7: (- 1) |^ ((p -' 1) div 2) = - 1 ; ::_thesis: Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2)
then A8: p divides (Lege ((- 1),p)) - (- 1) by A3, INT_2:15;
then A9: Lege ((- 1),p) <> 1 by A1, NAT_D:7;
now__::_thesis:_not_Lege_((-_1),p)_=_0
assume Lege ((- 1),p) = 0 ; ::_thesis: contradiction
then p <= 1 by A8, NAT_D:7;
then p < 1 + 1 by NAT_1:13;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege ((- 1),p) = (- 1) |^ ((p -' 1) div 2) by A7, Th25, A9; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:37
for p being Prime st p > 2 & p mod 4 = 1 holds
- 1 is_quadratic_residue_mod p
proof
let p be Prime; ::_thesis: ( p > 2 & p mod 4 = 1 implies - 1 is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: p mod 4 = 1 ; ::_thesis: - 1 is_quadratic_residue_mod p
p > 1 by INT_2:def_4;
then A3: p -' 1 = p - 1 by XREAL_1:233;
p = ((p div 4) * 4) + 1 by A2, NAT_D:2;
then p -' 1 = 2 * (2 * (p div 4)) by A3;
then (- 1) |^ ((p -' 1) div 2) = (- 1) |^ (2 * (p div 4)) by NAT_D:18
.= ((- 1) |^ 2) |^ (p div 4) by NEWTON:9
.= (1 |^ 2) |^ (p div 4) by WSIERP_1:1
.= (1 ^2) |^ (p div 4) by NEWTON:81
.= 1 by NEWTON:10 ;
then Lege ((- 1),p) = 1 by A1, Th36;
hence - 1 is_quadratic_residue_mod p by Def3; ::_thesis: verum
end;
theorem :: INT_5:38
for p being Prime st p > 2 & p mod 4 = 3 holds
not - 1 is_quadratic_residue_mod p
proof
let p be Prime; ::_thesis: ( p > 2 & p mod 4 = 3 implies not - 1 is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: p mod 4 = 3 ; ::_thesis: not - 1 is_quadratic_residue_mod p
p > 1 by INT_2:def_4;
then A3: p -' 1 = p - 1 by XREAL_1:233;
p = ((p div 4) * 4) + 3 by A2, NAT_D:2;
then p -' 1 = 2 * ((2 * (p div 4)) + 1) by A3;
then (- 1) |^ ((p -' 1) div 2) = (- 1) |^ ((2 * (p div 4)) + 1) by NAT_D:18
.= ((- 1) |^ (2 * (p div 4))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ (p div 4)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (p div 4)) * (- 1) by WSIERP_1:1
.= ((1 ^2) |^ (p div 4)) * (- 1) by NEWTON:81
.= 1 * (- 1) by NEWTON:10 ;
then Lege ((- 1),p) = - 1 by A1, Th36;
then ( ( not - 1 is_quadratic_residue_mod p or not (- 1) mod p <> 0 ) & ( not - 1 is_quadratic_residue_mod p or not (- 1) mod p = 0 ) ) by Def3;
hence not - 1 is_quadratic_residue_mod p ; ::_thesis: verum
end;
begin
theorem Th39: :: INT_5:39
for D being non empty set
for f being FinSequence of D
for i, j being Nat holds
( f is one-to-one iff Swap (f,i,j) is one-to-one )
proof
let D be non empty set ; ::_thesis: for f being FinSequence of D
for i, j being Nat holds
( f is one-to-one iff Swap (f,i,j) is one-to-one )
let f be FinSequence of D; ::_thesis: for i, j being Nat holds
( f is one-to-one iff Swap (f,i,j) is one-to-one )
let i, j be Nat; ::_thesis: ( f is one-to-one iff Swap (f,i,j) is one-to-one )
thus ( f is one-to-one implies Swap (f,i,j) is one-to-one ) ::_thesis: ( Swap (f,i,j) is one-to-one implies f is one-to-one )
proof
set ff = Swap (f,i,j);
A1: rng (Swap (f,i,j)) = rng f by FINSEQ_7:22;
assume f is one-to-one ; ::_thesis: Swap (f,i,j) is one-to-one
then A2: card (rng f) = len f by FINSEQ_4:62;
len (Swap (f,i,j)) = len f by FINSEQ_7:18;
hence Swap (f,i,j) is one-to-one by A2, A1, FINSEQ_4:62; ::_thesis: verum
end;
assume Swap (f,i,j) is one-to-one ; ::_thesis: f is one-to-one
then card (rng (Swap (f,i,j))) = len (Swap (f,i,j)) by FINSEQ_4:62;
then card (rng f) = len (Swap (f,i,j)) by FINSEQ_7:22;
then card (rng f) = len f by FINSEQ_7:18;
hence f is one-to-one by FINSEQ_4:62; ::_thesis: verum
end;
theorem Th40: :: INT_5:40
for n being Nat
for f being FinSequence of NAT st len f = n & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= n ) ) & f is one-to-one holds
rng f = Seg n
proof
let n be Nat; ::_thesis: for f being FinSequence of NAT st len f = n & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= n ) ) & f is one-to-one holds
rng f = Seg n
defpred S1[ Nat] means for f being FinSequence of NAT st len f = $1 & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= $1 ) ) & f is one-to-one holds
rng f = Seg $1;
A1: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
S1[n + 1]
proof
let f be FinSequence of NAT ; ::_thesis: ( len f = n + 1 & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= n + 1 ) ) & f is one-to-one implies rng f = Seg (n + 1) )
assume that
A3: len f = n + 1 and
A4: for d being Nat st d in dom f holds
( f . d > 0 & f . d <= n + 1 ) and
A5: f is one-to-one ; ::_thesis: rng f = Seg (n + 1)
A6: f <> {} by A3;
then A7: n + 1 in dom f by A3, FINSEQ_5:6;
then A8: f . (n + 1) > 0 by A4;
consider f1 being FinSequence of NAT , a being Element of NAT such that
A9: f = f1 ^ <*a*> by A6, HILBERT2:4;
A10: f1 is one-to-one by A5, A9, FINSEQ_3:91;
A11: len f = (len f1) + 1 by A9, FINSEQ_2:16;
f . (n + 1) <= n + 1 by A4, A7;
then A12: a <= n + 1 by A3, A9, A11, FINSEQ_1:42;
percases ( a = n + 1 or ( a > 0 & a < n + 1 ) ) by A3, A9, A11, A8, A12, FINSEQ_1:42, XXREAL_0:1;
supposeA13: a = n + 1 ; ::_thesis: rng f = Seg (n + 1)
for d being Nat st d in dom f1 holds
( f1 . d > 0 & f1 . d <= n )
proof
let d be Nat; ::_thesis: ( d in dom f1 implies ( f1 . d > 0 & f1 . d <= n ) )
assume A14: d in dom f1 ; ::_thesis: ( f1 . d > 0 & f1 . d <= n )
then A15: d in dom f by A9, FINSEQ_2:15;
A16: now__::_thesis:_not_f1_._d_=_n_+_1
d <= n by A3, A11, A14, FINSEQ_3:25;
then d < n + 1 by XREAL_1:145;
then f . d <> f . (n + 1) by A5, A7, A15, FUNCT_1:def_4;
then A17: f1 . d <> f . (n + 1) by A9, A14, FINSEQ_1:def_7;
assume f1 . d = n + 1 ; ::_thesis: contradiction
hence contradiction by A3, A9, A11, A13, A17, FINSEQ_1:42; ::_thesis: verum
end;
f . d <= n + 1 by A4, A15;
then f1 . d <= n + 1 by A9, A14, FINSEQ_1:def_7;
then A18: f1 . d < n + 1 by A16, XXREAL_0:1;
f . d > 0 by A4, A15;
hence ( f1 . d > 0 & f1 . d <= n ) by A9, A14, A18, FINSEQ_1:def_7, NAT_1:13; ::_thesis: verum
end;
then rng f1 = Seg n by A2, A3, A11, A10;
then (rng f1) \/ {a} = Seg (n + 1) by A13, FINSEQ_1:9;
then (rng f1) \/ (rng <*a*>) = Seg (n + 1) by FINSEQ_1:38;
hence rng f = Seg (n + 1) by A9, FINSEQ_1:31; ::_thesis: verum
end;
supposeA19: ( a > 0 & a < n + 1 ) ; ::_thesis: rng f = Seg (n + 1)
ex d being Nat st
( d in dom f1 & f1 . d = n + 1 )
proof
assume A20: for d being Nat st d in dom f1 holds
f1 . d <> n + 1 ; ::_thesis: contradiction
for d being Nat st d in dom f holds
f . d in Seg n
proof
let d be Nat; ::_thesis: ( d in dom f implies f . d in Seg n )
assume A21: d in dom f ; ::_thesis: f . d in Seg n
then A22: d in Seg (n + 1) by A3, FINSEQ_1:def_3;
then A23: d <= n + 1 by FINSEQ_1:1;
percases ( d = n + 1 or ( d >= 1 & d < n + 1 ) ) by A22, A23, FINSEQ_1:1, XXREAL_0:1;
suppose d = n + 1 ; ::_thesis: f . d in Seg n
then A24: f . d = a by A3, A9, A11, FINSEQ_1:42;
then A25: f . d <= n by A19, NAT_1:13;
f . d >= 0 + 1 by A19, A24, NAT_1:13;
hence f . d in Seg n by A25, FINSEQ_1:1; ::_thesis: verum
end;
supposeA26: ( d >= 1 & d < n + 1 ) ; ::_thesis: f . d in Seg n
then d <= n by NAT_1:13;
then d in Seg n by A26, FINSEQ_1:1;
then A27: d in dom f1 by A3, A11, FINSEQ_1:def_3;
then f1 . d <> n + 1 by A20;
then A28: f . d <> n + 1 by A9, A27, FINSEQ_1:def_7;
f . d <= n + 1 by A4, A21;
then f . d < n + 1 by A28, XXREAL_0:1;
then A29: f . d <= n by NAT_1:13;
f . d > 0 by A4, A21;
then f . d >= 0 + 1 by NAT_1:13;
hence f . d in Seg n by A29, FINSEQ_1:1; ::_thesis: verum
end;
end;
end;
then f is FinSequence of Seg n by FINSEQ_2:12;
then rng f c= Seg n by FINSEQ_1:def_4;
then card (rng f) <= card (Seg n) by NAT_1:43;
then n + 1 <= card (Seg n) by A3, A5, FINSEQ_4:62;
then n + 1 <= n + 0 by FINSEQ_1:57;
hence contradiction by XREAL_1:6; ::_thesis: verum
end;
then consider d1 being Element of NAT such that
A30: d1 in dom f1 and
A31: f1 . d1 = n + 1 ;
d1 <= n by A3, A11, A30, FINSEQ_3:25;
then A32: d1 <= len f by A3, NAT_1:13;
A33: 0 + 1 <= n + 1 by XREAL_1:6;
set f2 = Swap (f,d1,(n + 1));
A34: len (Swap (f,d1,(n + 1))) = n + 1 by A3, FINSEQ_7:18;
then A35: Swap (f,d1,(n + 1)) <> {} ;
then consider f3 being FinSequence of NAT , b being Element of NAT such that
A36: Swap (f,d1,(n + 1)) = f3 ^ <*b*> by HILBERT2:4;
A37: n + 1 = (len f3) + 1 by A34, A36, FINSEQ_2:16;
A38: 1 <= d1 by A30, FINSEQ_3:25;
then (Swap (f,d1,(n + 1))) /. (n + 1) = f /. d1 by A3, A32, A33, FINSEQ_7:31;
then (Swap (f,d1,(n + 1))) /. (n + 1) = f . d1 by A38, A32, FINSEQ_4:15;
then (Swap (f,d1,(n + 1))) . (n + 1) = f . d1 by A34, A33, FINSEQ_4:15;
then A39: (Swap (f,d1,(n + 1))) . (n + 1) = n + 1 by A9, A30, A31, FINSEQ_1:def_7;
then A40: b = n + 1 by A36, A37, FINSEQ_1:42;
A41: Swap (f,d1,(n + 1)) is one-to-one by A5, Th39;
A42: for d being Nat st d in dom f3 holds
( f3 . d > 0 & f3 . d <= n )
proof
let d be Nat; ::_thesis: ( d in dom f3 implies ( f3 . d > 0 & f3 . d <= n ) )
assume A43: d in dom f3 ; ::_thesis: ( f3 . d > 0 & f3 . d <= n )
then A44: d in dom (Swap (f,d1,(n + 1))) by A36, FINSEQ_2:15;
A45: now__::_thesis:_not_f3_._d_=_n_+_1
d <= n by A37, A43, FINSEQ_3:25;
then A46: d < n + 1 by XREAL_1:145;
assume f3 . d = n + 1 ; ::_thesis: contradiction
then A47: (Swap (f,d1,(n + 1))) . d = n + 1 by A36, A43, FINSEQ_1:def_7;
n + 1 in dom (Swap (f,d1,(n + 1))) by A34, A35, FINSEQ_5:6;
hence contradiction by A39, A41, A44, A47, A46, FUNCT_1:def_4; ::_thesis: verum
end;
(Swap (f,d1,(n + 1))) . d in rng (Swap (f,d1,(n + 1))) by A44, FUNCT_1:3;
then (Swap (f,d1,(n + 1))) . d in rng f by FINSEQ_7:22;
then A48: ex e being Nat st
( e in dom f & (Swap (f,d1,(n + 1))) . d = f . e ) by FINSEQ_2:10;
then (Swap (f,d1,(n + 1))) . d <= n + 1 by A4;
then f3 . d <= n + 1 by A36, A43, FINSEQ_1:def_7;
then A49: f3 . d < n + 1 by A45, XXREAL_0:1;
(Swap (f,d1,(n + 1))) . d > 0 by A4, A48;
hence ( f3 . d > 0 & f3 . d <= n ) by A36, A43, A49, FINSEQ_1:def_7, NAT_1:13; ::_thesis: verum
end;
f3 is one-to-one by A36, A41, FINSEQ_3:91;
then A50: rng f3 = Seg n by A2, A37, A42;
rng (Swap (f,d1,(n + 1))) = (rng f3) \/ (rng <*b*>) by A36, FINSEQ_1:31
.= (Seg n) \/ {(n + 1)} by A40, A50, FINSEQ_1:38
.= Seg (n + 1) by FINSEQ_1:9 ;
hence rng f = Seg (n + 1) by FINSEQ_7:22; ::_thesis: verum
end;
end;
end;
hence S1[n + 1] ; ::_thesis: verum
end;
A51: S1[ 0 ]
proof
let f be FinSequence of NAT ; ::_thesis: ( len f = 0 & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= 0 ) ) & f is one-to-one implies rng f = Seg 0 )
assume len f = 0 ; ::_thesis: ( ex d being Nat st
( d in dom f & not ( f . d > 0 & f . d <= 0 ) ) or not f is one-to-one or rng f = Seg 0 )
then f = {} ;
hence ( ex d being Nat st
( d in dom f & not ( f . d > 0 & f . d <= 0 ) ) or not f is one-to-one or rng f = Seg 0 ) ; ::_thesis: verum
end;
for n being Element of NAT holds S1[n] from NAT_1:sch_1(A51, A1);
hence for f being FinSequence of NAT st len f = n & ( for d being Nat st d in dom f holds
( f . d > 0 & f . d <= n ) ) & f is one-to-one holds
rng f = Seg n ; ::_thesis: verum
end;
theorem Th41: :: INT_5:41
for p being Prime
for a, m being Nat
for f being FinSequence of NAT st p > 2 & a gcd p = 1 & f = a * (idseq ((p -' 1) div 2)) & m = card { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } holds
Lege (a,p) = (- 1) |^ m
proof
let p be Prime; ::_thesis: for a, m being Nat
for f being FinSequence of NAT st p > 2 & a gcd p = 1 & f = a * (idseq ((p -' 1) div 2)) & m = card { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } holds
Lege (a,p) = (- 1) |^ m
let a, m be Nat; ::_thesis: for f being FinSequence of NAT st p > 2 & a gcd p = 1 & f = a * (idseq ((p -' 1) div 2)) & m = card { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } holds
Lege (a,p) = (- 1) |^ m
let f be FinSequence of NAT ; ::_thesis: ( p > 2 & a gcd p = 1 & f = a * (idseq ((p -' 1) div 2)) & m = card { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } implies Lege (a,p) = (- 1) |^ m )
assume that
A1: p > 2 and
A2: a gcd p = 1 and
A3: f = a * (idseq ((p -' 1) div 2)) and
A4: m = card { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } ; ::_thesis: Lege (a,p) = (- 1) |^ m
set f1 = f mod p;
A5: len (f mod p) = len f by EULER_2:def_1;
set X = { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } ;
for x being set st x in { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } holds
x in rng (f mod p)
proof
let x be set ; ::_thesis: ( x in { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } implies x in rng (f mod p) )
assume x in { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } ; ::_thesis: x in rng (f mod p)
then ex k being Element of NAT st
( x = k & k in rng (f mod p) & k > p / 2 ) ;
hence x in rng (f mod p) ; ::_thesis: verum
end;
then A6: { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } c= rng (f mod p) by TARSKI:def_3;
then reconsider X = { k where k is Element of NAT : ( k in rng (f mod p) & k > p / 2 ) } as finite set ;
A7: rng (f mod p) c= NAT by FINSEQ_1:def_4;
then reconsider X = X as finite Subset of NAT by A6, XBOOLE_1:1;
card X is Element of NAT ;
then reconsider m = m as Element of NAT by A4;
A8: (rng (f mod p)) \ X c= rng (f mod p) by XBOOLE_1:36;
then reconsider Y = (rng (f mod p)) \ X as finite Subset of NAT by A7, XBOOLE_1:1;
A9: a |^ ((p -' 1) div 2), Lege (a,p) are_congruent_mod p by A1, A2, Th28, INT_1:14;
set f2 = Sgm (rng (f mod p));
(Product (f mod p)) mod p = (Product f) mod p by EULER_2:11;
then A10: Product (f mod p), Product f are_congruent_mod p by NAT_D:64;
A11: p > 1 by INT_2:def_4;
then A12: p -' 1 = p - 1 by XREAL_1:233;
then A13: p -' 1 > 0 by A11, XREAL_1:50;
set p9 = (p -' 1) div 2;
A14: rng (idseq ((p -' 1) div 2)) = Seg ((p -' 1) div 2) by RELAT_1:45;
then reconsider I = idseq ((p -' 1) div 2) as FinSequence of NAT by FINSEQ_1:def_4;
dom f = dom I by A3, VALUED_1:def_5;
then A15: len f = len I by FINSEQ_3:29
.= (p -' 1) div 2 by CARD_1:def_7 ;
p >= 2 + 1 by A1, NAT_1:13;
then p - 1 >= 3 - 1 by XREAL_1:9;
then f mod p <> {} by A15, A12, A5, NAT_2:13;
then rng (f mod p) is non empty Subset of NAT by FINSEQ_1:def_4;
then consider n1 being Element of NAT such that
A16: rng (f mod p) c= (Seg n1) \/ {0} by HEYTING3:1;
I is Element of ((p -' 1) div 2) -tuples_on REAL by FINSEQ_2:109;
then A17: Product f = (Product (((p -' 1) div 2) |-> a)) * (Product I) by A3, RVSUM_1:108
.= (a |^ ((p -' 1) div 2)) * (Product I) by NEWTON:def_1 ;
p is odd by A1, PEPIN:17;
then A18: p -' 1 is even by A12, HILBERT3:2;
then A19: (p -' 1) div 2 = ((p -' 1) + 1) div 2 by NAT_2:26
.= p div 2 by A11, XREAL_1:235 ;
2 divides p -' 1 by A18, PEPIN:22;
then A20: p -' 1 = 2 * ((p -' 1) div 2) by NAT_D:3;
then (p -' 1) div 2 divides p -' 1 by NAT_D:def_3;
then (p -' 1) div 2 <= p -' 1 by A13, NAT_D:7;
then A21: (p -' 1) div 2 < p by A12, XREAL_1:146, XXREAL_0:2;
for d being Nat st d in dom I holds
(I . d) gcd p = 1
proof
let d be Nat; ::_thesis: ( d in dom I implies (I . d) gcd p = 1 )
assume d in dom I ; ::_thesis: (I . d) gcd p = 1
then A22: d in Seg (len I) by FINSEQ_1:def_3;
then A23: d in Seg ((p -' 1) div 2) by CARD_1:def_7;
then A24: I . d = d by FINSEQ_2:49;
d <= (p -' 1) div 2 by A23, FINSEQ_1:1;
then A25: d < p by A21, XXREAL_0:2;
d >= 1 by A22, FINSEQ_1:1;
then d,p are_relative_prime by A25, EULER_1:2;
hence (I . d) gcd p = 1 by A24, INT_2:def_3; ::_thesis: verum
end;
then A26: (Product I) gcd p = 1 by WSIERP_1:36;
A27: for d being Nat st d in dom f holds
f . d = a * d
proof
let d be Nat; ::_thesis: ( d in dom f implies f . d = a * d )
assume A28: d in dom f ; ::_thesis: f . d = a * d
then d in dom I by A3, VALUED_1:def_5;
then d in Seg (len I) by FINSEQ_1:def_3;
then A29: d is Element of Seg ((p -' 1) div 2) by CARD_1:def_7;
thus f . d = a * (I . d) by A3, A28, VALUED_1:def_5
.= a * d by A29, FINSEQ_2:49 ; ::_thesis: verum
end;
A30: for d, e being Element of NAT st 1 <= d & d < e & e <= len (f mod p) holds
(f mod p) . d <> (f mod p) . e
proof
let d, e be Element of NAT ; ::_thesis: ( 1 <= d & d < e & e <= len (f mod p) implies (f mod p) . d <> (f mod p) . e )
assume that
A31: 1 <= d and
A32: d < e and
A33: e <= len (f mod p) ; ::_thesis: (f mod p) . d <> (f mod p) . e
A34: e <= len f by A33, EULER_2:def_1;
1 <= e by A31, A32, XXREAL_0:2;
then A35: e in dom f by A34, FINSEQ_3:25;
then A36: (f mod p) . e = (f . e) mod p by EULER_2:def_1;
d < len f by A32, A34, XXREAL_0:2;
then A37: d in dom f by A31, FINSEQ_3:25;
then A38: (f mod p) . d = (f . d) mod p by EULER_2:def_1;
now__::_thesis:_not_(f_mod_p)_._d_=_(f_mod_p)_._e
assume (f mod p) . d = (f mod p) . e ; ::_thesis: contradiction
then f . e,f . d are_congruent_mod p by A38, A36, NAT_D:64;
then p divides (f . e) - (f . d) by INT_2:15;
then p divides (a * e) - (f . d) by A27, A35;
then p divides (a * e) - (a * d) by A27, A37;
then A39: p divides a * (e - d) ;
A40: ((p -' 1) div 2) - 1 < p by A21, XREAL_1:147;
reconsider dd = e - d as Element of NAT by A32, NAT_1:21;
A41: abs p = p by ABSVALUE:def_1;
A42: abs dd = dd by ABSVALUE:def_1;
A43: dd <= ((p -' 1) div 2) - 1 by A15, A5, A31, A33, XREAL_1:13;
dd <> 0 by A32;
then p <= dd by A2, A39, A41, A42, INT_4:6, WSIERP_1:29;
hence contradiction by A43, A40, XXREAL_0:2; ::_thesis: verum
end;
hence (f mod p) . d <> (f mod p) . e ; ::_thesis: verum
end;
then A44: len (f mod p) = card (rng (f mod p)) by GRAPH_5:7;
then A45: f mod p is one-to-one by FINSEQ_4:62;
A46: dom (f mod p) = dom f by A5, FINSEQ_3:29;
not 0 in rng (f mod p)
proof
reconsider a = a as Element of NAT by ORDINAL1:def_12;
assume 0 in rng (f mod p) ; ::_thesis: contradiction
then consider n being Nat such that
A47: n in dom (f mod p) and
A48: (f mod p) . n = 0 by FINSEQ_2:10;
0 = (f . n) mod p by A46, A47, A48, EULER_2:def_1
.= (a * n) mod p by A27, A46, A47 ;
then A49: p divides a * n by PEPIN:6;
n >= 1 by A47, FINSEQ_3:25;
then A50: p <= n by A2, A49, NAT_D:7, WSIERP_1:30;
n <= (p -' 1) div 2 by A15, A5, A47, FINSEQ_3:25;
hence contradiction by A21, A50, XXREAL_0:2; ::_thesis: verum
end;
then A51: {0} misses rng (f mod p) by ZFMISC_1:50;
then A52: Sgm (rng (f mod p)) is one-to-one by A16, FINSEQ_3:92, XBOOLE_1:73;
A53: rng (f mod p) c= Seg n1 by A16, A51, XBOOLE_1:73;
then A54: X c= Seg n1 by A6, XBOOLE_1:1;
len f = card (rng (f mod p)) by A5, A30, GRAPH_5:7;
then reconsider n = ((p -' 1) div 2) - m as Element of NAT by A4, A15, A6, NAT_1:21, NAT_1:43;
A55: Y c= Seg n1 by A53, A8, XBOOLE_1:1;
A56: rng (f mod p) = rng (Sgm (rng (f mod p))) by A53, FINSEQ_1:def_13;
then A57: Product (f mod p) = Product (Sgm (rng (f mod p))) by A45, A52, EULER_2:10, RFINSEQ:26;
set f3 = ((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n);
set f4 = ((Sgm (rng (f mod p))) | n) ^ (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n));
A58: (Sgm (rng (f mod p))) /^ n is FinSequence of INT by FINSEQ_2:24, NUMBERS:17;
A59: dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) = (dom ((len ((Sgm (rng (f mod p))) /^ n)) |-> p)) /\ (dom ((Sgm (rng (f mod p))) /^ n)) by VALUED_1:12
.= (Seg (len ((len ((Sgm (rng (f mod p))) /^ n)) |-> p))) /\ (dom ((Sgm (rng (f mod p))) /^ n)) by FINSEQ_1:def_3
.= (Seg (len ((Sgm (rng (f mod p))) /^ n))) /\ (dom ((Sgm (rng (f mod p))) /^ n)) by CARD_1:def_7
.= (dom ((Sgm (rng (f mod p))) /^ n)) /\ (dom ((Sgm (rng (f mod p))) /^ n)) by FINSEQ_1:def_3
.= dom ((Sgm (rng (f mod p))) /^ n) ;
then A60: len (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) = len ((Sgm (rng (f mod p))) /^ n) by FINSEQ_3:29;
for k, l being Element of NAT st k in Y & l in X holds
k < l
proof
let k, l be Element of NAT ; ::_thesis: ( k in Y & l in X implies k < l )
assume that
A61: k in Y and
A62: l in X ; ::_thesis: k < l
A63: not k in X by A61, XBOOLE_0:def_5;
A64: ex l1 being Element of NAT st
( l1 = l & l1 in rng (f mod p) & l1 > p / 2 ) by A62;
k in rng (f mod p) by A61, XBOOLE_0:def_5;
then k <= p / 2 by A63;
hence k < l by A64, XXREAL_0:2; ::_thesis: verum
end;
then Sgm (Y \/ X) = (Sgm Y) ^ (Sgm X) by A54, A55, FINSEQ_3:42;
then Sgm ((rng (f mod p)) \/ X) = (Sgm Y) ^ (Sgm X) by XBOOLE_1:39;
then A65: Sgm (rng (f mod p)) = (Sgm Y) ^ (Sgm X) by A6, XBOOLE_1:12;
A66: for d being Nat st d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) holds
(((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d = p - (((Sgm (rng (f mod p))) /^ n) . d)
proof
let d be Nat; ::_thesis: ( d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) implies (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d = p - (((Sgm (rng (f mod p))) /^ n) . d) )
assume A67: d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) ; ::_thesis: (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d = p - (((Sgm (rng (f mod p))) /^ n) . d)
then d in Seg (len ((Sgm (rng (f mod p))) /^ n)) by A59, FINSEQ_1:def_3;
then ((len ((Sgm (rng (f mod p))) /^ n)) |-> p) . d = p by FINSEQ_2:57;
hence (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d = p - (((Sgm (rng (f mod p))) /^ n) . d) by A67, VALUED_1:13; ::_thesis: verum
end;
A68: len (Sgm Y) = card Y by A53, A8, FINSEQ_3:39, XBOOLE_1:1
.= ((p -' 1) div 2) - m by A4, A15, A5, A6, A44, CARD_2:44 ;
then A69: (Sgm (rng (f mod p))) /^ n = Sgm X by A65, FINSEQ_5:37;
A70: for d being Nat st d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) holds
( (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d > 0 & (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d <= (p -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) implies ( (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d > 0 & (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d <= (p -' 1) div 2 ) )
reconsider w = (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d as Element of INT by INT_1:def_2;
assume A71: d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) ; ::_thesis: ( (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d > 0 & (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d <= (p -' 1) div 2 )
then (Sgm X) . d in rng (Sgm X) by A69, A59, FUNCT_1:3;
then (Sgm X) . d in X by A54, FINSEQ_1:def_13;
then A72: ex ll being Element of NAT st
( ll = (Sgm X) . d & ll in rng (f mod p) & ll > p / 2 ) ;
then consider e being Nat such that
A73: e in dom (f mod p) and
A74: (f mod p) . e = ((Sgm (rng (f mod p))) /^ n) . d by A69, FINSEQ_2:10;
((Sgm (rng (f mod p))) /^ n) . d = (f . e) mod p by A46, A73, A74, EULER_2:def_1;
then A75: ((Sgm (rng (f mod p))) /^ n) . d < p by NAT_D:1;
A76: (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d = p - (((Sgm (rng (f mod p))) /^ n) . d) by A66, A71;
then w < p - (p / 2) by A69, A72, XREAL_1:10;
hence ( (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d > 0 & (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d <= (p -' 1) div 2 ) by A19, A76, A75, INT_1:54, XREAL_1:50; ::_thesis: verum
end;
A77: rng (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) c= INT by RELAT_1:def_19;
for d being Nat st d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) holds
(((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) implies (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d in NAT )
assume A78: d in dom (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) ; ::_thesis: (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d in NAT
(((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d > 0 by A70, A78;
hence (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) . d in NAT by A77, INT_1:3; ::_thesis: verum
end;
then reconsider f3 = ((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n) as FinSequence of NAT by FINSEQ_2:12;
abs ((- 1) |^ m) = 1 by SERIES_2:1;
then A79: ( (- 1) |^ m = 1 or - ((- 1) |^ m) = 1 ) by ABSVALUE:1;
f3 is FinSequence of NAT ;
then reconsider f4 = ((Sgm (rng (f mod p))) | n) ^ (((len ((Sgm (rng (f mod p))) /^ n)) |-> p) - ((Sgm (rng (f mod p))) /^ n)) as FinSequence of NAT by FINSEQ_1:75;
A80: (Sgm (rng (f mod p))) | n = Sgm Y by A65, A68, FINSEQ_3:113, FINSEQ_6:10;
A81: for d being Nat st d in dom f4 holds
( f4 . d > 0 & f4 . d <= (p -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom f4 implies ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 ) )
assume A82: d in dom f4 ; ::_thesis: ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 )
percases ( d in dom ((Sgm (rng (f mod p))) | n) or ex l being Nat st
( l in dom f3 & d = (len ((Sgm (rng (f mod p))) | n)) + l ) ) by A82, FINSEQ_1:25;
supposeA83: d in dom ((Sgm (rng (f mod p))) | n) ; ::_thesis: ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 )
reconsider d = d as Element of NAT by ORDINAL1:def_12;
((Sgm (rng (f mod p))) | n) . d in rng (Sgm Y) by A80, A83, FUNCT_1:3;
then A84: ((Sgm (rng (f mod p))) | n) . d in Y by A55, FINSEQ_1:def_13;
then A85: ((Sgm (rng (f mod p))) | n) . d in rng (f mod p) by XBOOLE_0:def_5;
not ((Sgm (rng (f mod p))) | n) . d in X by A84, XBOOLE_0:def_5;
then ((Sgm (rng (f mod p))) | n) . d <= p / 2 by A85;
then A86: ((Sgm (rng (f mod p))) | n) . d <= (p -' 1) div 2 by A19, INT_1:54;
not ((Sgm (rng (f mod p))) | n) . d in {0} by A51, A85, XBOOLE_0:3;
then ((Sgm (rng (f mod p))) | n) . d <> 0 by TARSKI:def_1;
hence ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 ) by A83, A86, FINSEQ_1:def_7; ::_thesis: verum
end;
suppose ex l being Nat st
( l in dom f3 & d = (len ((Sgm (rng (f mod p))) | n)) + l ) ; ::_thesis: ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 )
then consider l being Element of NAT such that
A87: l in dom f3 and
A88: d = (len ((Sgm (rng (f mod p))) | n)) + l ;
f4 . d = f3 . l by A87, A88, FINSEQ_1:def_7;
hence ( f4 . d > 0 & f4 . d <= (p -' 1) div 2 ) by A70, A87; ::_thesis: verum
end;
end;
end;
A89: Sgm (rng (f mod p)) = ((Sgm (rng (f mod p))) | n) ^ ((Sgm (rng (f mod p))) /^ n) by RFINSEQ:8;
then A90: (Sgm (rng (f mod p))) /^ n is one-to-one by A52, FINSEQ_3:91;
for d, e being Element of NAT st 1 <= d & d < e & e <= len f3 holds
f3 . d <> f3 . e
proof
let d, e be Element of NAT ; ::_thesis: ( 1 <= d & d < e & e <= len f3 implies f3 . d <> f3 . e )
assume that
A91: 1 <= d and
A92: d < e and
A93: e <= len f3 ; ::_thesis: f3 . d <> f3 . e
1 <= e by A91, A92, XXREAL_0:2;
then A94: e in dom f3 by A93, FINSEQ_3:25;
then A95: f3 . e = p - (((Sgm (rng (f mod p))) /^ n) . e) by A66;
d < len f3 by A92, A93, XXREAL_0:2;
then A96: d in dom f3 by A91, FINSEQ_3:25;
then f3 . d = p - (((Sgm (rng (f mod p))) /^ n) . d) by A66;
hence f3 . d <> f3 . e by A90, A59, A92, A96, A94, A95, FUNCT_1:def_4; ::_thesis: verum
end;
then len f3 = card (rng f3) by GRAPH_5:7;
then A97: f3 is one-to-one by FINSEQ_4:62;
A98: len (Sgm (rng (f mod p))) = (p -' 1) div 2 by A15, A5, A16, A51, A44, FINSEQ_3:39, XBOOLE_1:73;
then A99: n <= len (Sgm (rng (f mod p))) by XREAL_1:43;
A100: rng ((Sgm (rng (f mod p))) | n) misses rng f3
proof
assume rng ((Sgm (rng (f mod p))) | n) meets rng f3 ; ::_thesis: contradiction
then consider x being set such that
A101: x in rng ((Sgm (rng (f mod p))) | n) and
A102: x in rng f3 by XBOOLE_0:3;
consider e being Nat such that
A103: e in dom f3 and
A104: f3 . e = x by A102, FINSEQ_2:10;
x = p - (((Sgm (rng (f mod p))) /^ n) . e) by A66, A103, A104;
then A105: x = p - ((Sgm (rng (f mod p))) . (e + n)) by A99, A59, A103, RFINSEQ:def_1;
e + n in dom (Sgm (rng (f mod p))) by A59, A103, FINSEQ_5:26;
then consider e1 being Nat such that
A106: e1 in dom (f mod p) and
A107: (f mod p) . e1 = (Sgm (rng (f mod p))) . (e + n) by A56, FINSEQ_2:10, FUNCT_1:3;
A108: e1 in dom f by A5, A106, FINSEQ_3:29;
A109: e1 <= (p -' 1) div 2 by A15, A5, A106, FINSEQ_3:25;
rng ((Sgm (rng (f mod p))) | n) c= rng (Sgm (rng (f mod p))) by FINSEQ_5:19;
then consider d1 being Nat such that
A110: d1 in dom (f mod p) and
A111: (f mod p) . d1 = x by A56, A101, FINSEQ_2:10;
d1 <= (p -' 1) div 2 by A15, A5, A110, FINSEQ_3:25;
then d1 + e1 <= ((p -' 1) div 2) + ((p -' 1) div 2) by A109, XREAL_1:7;
then A112: d1 + e1 < p by A12, A20, XREAL_1:146, XXREAL_0:2;
x = (f . d1) mod p by A46, A110, A111, EULER_2:def_1;
then ((f . d1) mod p) + ((Sgm (rng (f mod p))) . (e + n)) = p by A105;
then ((f . d1) mod p) + ((f . e1) mod p) = p by A107, A108, EULER_2:def_1;
then (((f . d1) mod p) + ((f . e1) mod p)) mod p = 0 by NAT_D:25;
then ((f . d1) + (f . e1)) mod p = 0 by EULER_2:6;
then p divides (f . d1) + (f . e1) by PEPIN:6;
then p divides (d1 * a) + (f . e1) by A27, A46, A110;
then p divides (d1 * a) + (e1 * a) by A27, A108;
then A113: p divides (d1 + e1) * a ;
d1 >= 1 by A110, FINSEQ_3:25;
hence contradiction by A2, A113, A112, NAT_D:7, WSIERP_1:30; ::_thesis: verum
end;
(Sgm (rng (f mod p))) | n is one-to-one by A52, A89, FINSEQ_3:91;
then A114: f4 is one-to-one by A97, A100, FINSEQ_3:91;
A115: for d being Nat st d in dom f3 holds
f3 . d, - (((Sgm (rng (f mod p))) /^ n) . d) are_congruent_mod p
proof
let d be Nat; ::_thesis: ( d in dom f3 implies f3 . d, - (((Sgm (rng (f mod p))) /^ n) . d) are_congruent_mod p )
assume d in dom f3 ; ::_thesis: f3 . d, - (((Sgm (rng (f mod p))) /^ n) . d) are_congruent_mod p
then (f3 . d) mod p = (p - (((Sgm (rng (f mod p))) /^ n) . d)) mod p by A66
.= ((1 * p) + (- (((Sgm (rng (f mod p))) /^ n) . d))) mod p
.= (- (((Sgm (rng (f mod p))) /^ n) . d)) mod p by EULER_1:12 ;
hence f3 . d, - (((Sgm (rng (f mod p))) /^ n) . d) are_congruent_mod p by NAT_D:64; ::_thesis: verum
end;
A116: len ((Sgm (rng (f mod p))) /^ n) = (len (Sgm (rng (f mod p)))) -' n by RFINSEQ:29
.= (len (Sgm (rng (f mod p)))) - n by A98, XREAL_1:43, XREAL_1:233
.= m by A98 ;
len ((Sgm (rng (f mod p))) | n) = n by A98, FINSEQ_1:59, XREAL_1:43;
then len f4 = n + m by A60, A116, FINSEQ_1:22
.= len f by A15 ;
then rng f4 = rng I by A14, A15, A114, A81, Th40;
then Product f4 = Product I by A114, EULER_2:10, RFINSEQ:26;
then A117: (Product ((Sgm (rng (f mod p))) | n)) * (Product f3) = Product I by RVSUM_1:97;
f3 is FinSequence of INT by FINSEQ_2:24, NUMBERS:17;
then (Product f3) * (Product ((Sgm (rng (f mod p))) | n)),(((- 1) |^ m) * (Product ((Sgm (rng (f mod p))) /^ n))) * (Product ((Sgm (rng (f mod p))) | n)) are_congruent_mod p by A60, A116, A58, A115, Th33, INT_4:11;
then (Product f3) * (Product ((Sgm (rng (f mod p))) | n)),((- 1) |^ m) * ((Product ((Sgm (rng (f mod p))) | n)) * (Product ((Sgm (rng (f mod p))) /^ n))) are_congruent_mod p ;
then Product I,((- 1) |^ m) * (Product (((Sgm (rng (f mod p))) | n) ^ ((Sgm (rng (f mod p))) /^ n))) are_congruent_mod p by A117, RVSUM_1:97;
then A118: Product I,((- 1) |^ m) * (Product (f mod p)) are_congruent_mod p by A57, RFINSEQ:8;
((- 1) |^ m) * (Product (f mod p)),((- 1) |^ m) * (Product f) are_congruent_mod p by A10, INT_4:11;
then Product I,(((- 1) |^ m) * (a |^ ((p -' 1) div 2))) * (Product I) are_congruent_mod p by A17, A118, INT_1:15;
then p divides (1 * (Product I)) - ((((- 1) |^ m) * (a |^ ((p -' 1) div 2))) * (Product I)) by INT_2:15;
then p divides (1 - (((- 1) |^ m) * (a |^ ((p -' 1) div 2)))) * (Product I) ;
then p divides 1 - (((- 1) |^ m) * (a |^ ((p -' 1) div 2))) by A26, WSIERP_1:29;
then p divides ((- 1) |^ m) * (1 - (((- 1) |^ m) * (a |^ ((p -' 1) div 2)))) by INT_2:2;
then A119: p divides ((- 1) |^ m) - ((((- 1) |^ m) * ((- 1) |^ m)) * (a |^ ((p -' 1) div 2))) ;
((- 1) |^ m) * ((- 1) |^ m) = (- 1) |^ (m + m) by NEWTON:8
.= (- 1) |^ (2 * m)
.= ((- 1) |^ 2) |^ m by NEWTON:9
.= (1 |^ 2) |^ m by WSIERP_1:1
.= (1 ^2) |^ m by NEWTON:81
.= 1 by NEWTON:10 ;
then (- 1) |^ m,a |^ ((p -' 1) div 2) are_congruent_mod p by A119, INT_2:15;
then A120: (- 1) |^ m, Lege (a,p) are_congruent_mod p by A9, INT_1:15;
percases ( (- 1) |^ m = 1 or (- 1) |^ m = - 1 ) by A79;
supposeA121: (- 1) |^ m = 1 ; ::_thesis: Lege (a,p) = (- 1) |^ m
A122: now__::_thesis:_not_Lege_(a,p)_=_-_1
assume Lege (a,p) = - 1 ; ::_thesis: contradiction
then p divides 1 - (- 1) by A120, A121, INT_2:15;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
now__::_thesis:_not_Lege_(a,p)_=_0
assume Lege (a,p) = 0 ; ::_thesis: contradiction
then p divides 1 - 0 by A120, A121, INT_2:15;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege (a,p) = (- 1) |^ m by A121, Th25, A122; ::_thesis: verum
end;
supposeA123: (- 1) |^ m = - 1 ; ::_thesis: Lege (a,p) = (- 1) |^ m
A124: now__::_thesis:_not_Lege_(a,p)_=_1
assume Lege (a,p) = 1 ; ::_thesis: contradiction
then p divides (- 1) - 1 by A120, A123, INT_2:15;
then p divides - 2 ;
then p divides 2 by INT_2:10;
hence contradiction by A1, NAT_D:7; ::_thesis: verum
end;
now__::_thesis:_not_Lege_(a,p)_=_0
assume Lege (a,p) = 0 ; ::_thesis: contradiction
then p divides (- 1) - 0 by A120, A123, INT_2:15;
then p divides 1 by INT_2:10;
then p = 1 by WSIERP_1:15;
hence contradiction by A1; ::_thesis: verum
end;
hence Lege (a,p) = (- 1) |^ m by A123, Th25, A124; ::_thesis: verum
end;
end;
end;
theorem Th42: :: INT_5:42
for p being Prime st p > 2 holds
Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
proof
let p be Prime; ::_thesis: ( p > 2 implies Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8) )
set p9 = (p -' 1) div 2;
set I = idseq ((p -' 1) div 2);
set fp = 2 * (idseq ((p -' 1) div 2));
set nn = p div 8;
A1: p > 1 by INT_2:def_4;
then A2: p - 1 = p -' 1 by XREAL_1:233;
A3: for d being Nat st d in dom (2 * (idseq ((p -' 1) div 2))) holds
(2 * (idseq ((p -' 1) div 2))) . d = 2 * d
proof
let d be Nat; ::_thesis: ( d in dom (2 * (idseq ((p -' 1) div 2))) implies (2 * (idseq ((p -' 1) div 2))) . d = 2 * d )
assume A4: d in dom (2 * (idseq ((p -' 1) div 2))) ; ::_thesis: (2 * (idseq ((p -' 1) div 2))) . d = 2 * d
then d in dom (idseq ((p -' 1) div 2)) by VALUED_1:def_5;
then d in Seg (len (idseq ((p -' 1) div 2))) by FINSEQ_1:def_3;
then A5: d is Element of Seg ((p -' 1) div 2) by CARD_1:def_7;
thus (2 * (idseq ((p -' 1) div 2))) . d = 2 * ((idseq ((p -' 1) div 2)) . d) by A4, VALUED_1:def_5
.= 2 * d by A5, FINSEQ_2:49 ; ::_thesis: verum
end;
for d being Nat st d in dom (2 * (idseq ((p -' 1) div 2))) holds
(2 * (idseq ((p -' 1) div 2))) . d in NAT ;
then reconsider fp = 2 * (idseq ((p -' 1) div 2)) as FinSequence of NAT by FINSEQ_2:12;
set f = fp mod p;
set X = { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } ;
set m = card { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } ;
dom fp = dom (idseq ((p -' 1) div 2)) by VALUED_1:def_5;
then A6: len fp = len (idseq ((p -' 1) div 2)) by FINSEQ_3:29
.= (p -' 1) div 2 by CARD_1:def_7 ;
set Y = { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } ;
for x being set st x in { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } holds
x in dom (fp mod p)
proof
let x be set ; ::_thesis: ( x in { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } implies x in dom (fp mod p) )
assume x in { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } ; ::_thesis: x in dom (fp mod p)
then ex k being Element of NAT st
( x = k & k in dom (fp mod p) & (fp mod p) . k > p / 2 ) ;
hence x in dom (fp mod p) ; ::_thesis: verum
end;
then { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } c= dom (fp mod p) by TARSKI:def_3;
then reconsider Y = { d where d is Element of NAT : ( d in dom (fp mod p) & (fp mod p) . d > p / 2 ) } as finite Subset of NAT by XBOOLE_1:1;
set Z = seq ((p div 4),(((p -' 1) div 2) -' (p div 4)));
A7: p mod 8 <= 8 - 1 by INT_1:52, NAT_D:1;
8 = 2 * 4 ;
then A8: 2 divides 8 by NAT_D:def_3;
A9: now__::_thesis:_not_p_mod_8_=_0
assume p mod 8 = 0 ; ::_thesis: contradiction
then 8 divides p by PEPIN:6;
then p = 8 by INT_2:def_4;
hence contradiction by A8, NAT_4:12; ::_thesis: verum
end;
for x being set st x in { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } holds
x in rng (fp mod p)
proof
let x be set ; ::_thesis: ( x in { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } implies x in rng (fp mod p) )
assume x in { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } ; ::_thesis: x in rng (fp mod p)
then ex k being Element of NAT st
( x = k & k in rng (fp mod p) & k > p / 2 ) ;
hence x in rng (fp mod p) ; ::_thesis: verum
end;
then A10: { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } c= rng (fp mod p) by TARSKI:def_3;
then reconsider X = { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } as finite set ;
card X is Element of NAT ;
then reconsider m = card { k where k is Element of NAT : ( k in rng (fp mod p) & k > p / 2 ) } as Element of NAT ;
A11: len (fp mod p) = len fp by EULER_2:def_1;
then A12: dom (fp mod p) = dom fp by FINSEQ_3:29;
assume A13: p > 2 ; ::_thesis: Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
then 2,p are_relative_prime by EULER_1:2;
then A14: 2 gcd p = 1 by INT_2:def_3;
then A15: Lege (2,p) = (- 1) |^ m by A13, Th41;
p is odd by A13, PEPIN:17;
then A16: p - 1 is even by HILBERT3:2;
then A17: (p -' 1) div 2 = ((p -' 1) + 1) div 2 by A2, NAT_2:26
.= p div 2 by A1, XREAL_1:235 ;
then A18: fp mod p <> {} by A13, A6, A11, NAT_2:13;
then reconsider U = dom (fp mod p) as non empty finite Subset of NAT ;
2 divides p -' 1 by A16, A2, PEPIN:22;
then A19: p -' 1 = 2 * ((p -' 1) div 2) by NAT_D:3;
A20: for d being Nat st d in dom (fp mod p) holds
(fp mod p) . d = 2 * d
proof
let d be Nat; ::_thesis: ( d in dom (fp mod p) implies (fp mod p) . d = 2 * d )
assume A21: d in dom (fp mod p) ; ::_thesis: (fp mod p) . d = 2 * d
then d <= (p -' 1) div 2 by A6, A11, FINSEQ_3:25;
then 2 * d <= p -' 1 by A19, XREAL_1:64;
then 2 * d < p by NAT_2:9, XXREAL_0:2;
hence 2 * d = (2 * d) mod p by NAT_D:24
.= (fp . d) mod p by A3, A12, A21
.= (fp mod p) . d by A12, A21, EULER_2:def_1 ;
::_thesis: verum
end;
A22: for d1, d2, k1, k2 being Nat st 1 <= d1 & d1 < d2 & d2 <= len (fp mod p) & k1 = (fp mod p) . d1 & k2 = (fp mod p) . d2 holds
k1 < k2
proof
let d1, d2, k1, k2 be Nat; ::_thesis: ( 1 <= d1 & d1 < d2 & d2 <= len (fp mod p) & k1 = (fp mod p) . d1 & k2 = (fp mod p) . d2 implies k1 < k2 )
assume that
A23: 1 <= d1 and
A24: d1 < d2 and
A25: d2 <= len (fp mod p) and
A26: k1 = (fp mod p) . d1 and
A27: k2 = (fp mod p) . d2 ; ::_thesis: k1 < k2
1 <= d2 by A23, A24, XXREAL_0:2;
then d2 in dom (fp mod p) by A25, FINSEQ_3:25;
then A28: k2 = 2 * d2 by A20, A27;
d1 <= len (fp mod p) by A24, A25, XXREAL_0:2;
then d1 in dom (fp mod p) by A23, FINSEQ_3:25;
then k1 = 2 * d1 by A20, A26;
hence k1 < k2 by A24, A28, XREAL_1:68; ::_thesis: verum
end;
rng (fp mod p) is non empty Subset of NAT by A18, FINSEQ_1:def_4;
then consider n1 being Element of NAT such that
A29: rng (fp mod p) c= (Seg n1) \/ {0} by HEYTING3:1;
rng (fp mod p) c= NAT by FINSEQ_1:def_4;
then reconsider X = X as finite Subset of NAT by A10, XBOOLE_1:1;
seq ((p div 4),(((p -' 1) div 2) -' (p div 4))),((p -' 1) div 2) -' (p div 4) are_equipotent by CALCUL_2:6;
then A30: card (seq ((p div 4),(((p -' 1) div 2) -' (p div 4)))) = ((p -' 1) div 2) -' (p div 4) by CARD_1:def_2;
not 0 in rng (fp mod p)
proof
assume 0 in rng (fp mod p) ; ::_thesis: contradiction
then consider n being Nat such that
A31: n in dom (fp mod p) and
A32: (fp mod p) . n = 0 by FINSEQ_2:10;
2 * n = 0 by A20, A31, A32;
hence contradiction by A31, FINSEQ_3:25; ::_thesis: verum
end;
then A33: {0} misses rng (fp mod p) by ZFMISC_1:50;
then rng (fp mod p) c= Seg n1 by A29, XBOOLE_1:73;
then A34: Sgm (rng (fp mod p)) = fp mod p by A22, FINSEQ_1:def_13;
A35: X,Y are_equipotent
proof
deffunc H1( Element of U) -> set = (fp mod p) . $1;
set YY = { d where d is Element of U : H1(d) in X } ;
A36: now__::_thesis:_for_x_being_set_st_x_in_X_holds_
ex_d_being_Element_of_U_st_x_=_H1(d)
let x be set ; ::_thesis: ( x in X implies ex d being Element of U st x = H1(d) )
assume x in X ; ::_thesis: ex d being Element of U st x = H1(d)
then consider y being Element of NAT such that
A37: y = x and
A38: y in rng (fp mod p) and
y > p / 2 ;
consider d being Nat such that
A39: d in U and
A40: (fp mod p) . d = y by A38, FINSEQ_2:10;
reconsider d = d as Element of U by A39;
take d = d; ::_thesis: x = H1(d)
thus x = H1(d) by A37, A40; ::_thesis: verum
end;
A41: Y c= { d where d is Element of U : H1(d) in X }
proof
let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in Y or x in { d where d is Element of U : H1(d) in X } )
assume x in Y ; ::_thesis: x in { d where d is Element of U : H1(d) in X }
then A42: ex d being Element of NAT st
( d = x & d in dom (fp mod p) & (fp mod p) . d > p / 2 ) ;
then reconsider x = x as Element of U ;
reconsider f = fp mod p as FinSequence of NAT ;
f . x in rng f by FUNCT_1:3;
then H1(x) in X by A42;
hence x in { d where d is Element of U : H1(d) in X } ; ::_thesis: verum
end;
now__::_thesis:_for_x_being_set_st_x_in__{__d_where_d_is_Element_of_U_:_H1(d)_in_X__}__holds_
x_in_Y
let x be set ; ::_thesis: ( x in { d where d is Element of U : H1(d) in X } implies x in Y )
assume x in { d where d is Element of U : H1(d) in X } ; ::_thesis: x in Y
then consider d being Element of U such that
A43: d = x and
A44: (fp mod p) . d in X ;
ex k being Element of NAT st
( k = (fp mod p) . d & k in rng (fp mod p) & k > p / 2 ) by A44;
hence x in Y by A43; ::_thesis: verum
end;
then A45: { d where d is Element of U : H1(d) in X } c= Y by TARSKI:def_3;
A46: for d1, d2 being Element of U st H1(d1) = H1(d2) holds
d1 = d2
proof
let d1, d2 be Element of U; ::_thesis: ( H1(d1) = H1(d2) implies d1 = d2 )
assume A47: H1(d1) = H1(d2) ; ::_thesis: d1 = d2
fp mod p is one-to-one by A29, A33, A34, FINSEQ_3:92, XBOOLE_1:73;
hence d1 = d2 by A47, FUNCT_1:def_4; ::_thesis: verum
end;
X, { d where d is Element of U : H1(d) in X } are_equipotent from FUNCT_7:sch_3(A36, A46);
hence X,Y are_equipotent by A41, A45, XBOOLE_0:def_10; ::_thesis: verum
end;
p div 2 < p by INT_1:56;
then (p div 2) div 2 <= p div 2 by NAT_2:24;
then A48: p div (2 * 2) <= p div 2 by NAT_2:27;
A49: seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) c= Y
proof
let x be set ; :: according to TARSKI:def_3 ::_thesis: ( not x in seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) or x in Y )
assume A50: x in seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) ; ::_thesis: x in Y
then reconsider x = x as Element of NAT ;
A51: x >= (p div 4) + 1 by A50, CALCUL_2:1;
then (p div 4) + x >= (p div 4) + 1 by NAT_1:12;
then A52: x >= 1 by XREAL_1:6;
x <= (((p -' 1) div 2) -' (p div 4)) + (p div 4) by A50, CALCUL_2:1;
then x <= (p -' 1) div 2 by A17, A48, XREAL_1:235;
then A53: x in dom (fp mod p) by A6, A11, A52, FINSEQ_3:25;
x > p / 4 by A51, INT_1:29, XXREAL_0:2;
then 2 * x > 2 * (p / 4) by XREAL_1:68;
then (fp mod p) . x > p / 2 by A20, A53;
hence x in Y by A53; ::_thesis: verum
end;
now__::_thesis:_for_x_being_set_st_x_in_Y_holds_
x_in_seq_((p_div_4),(((p_-'_1)_div_2)_-'_(p_div_4)))
let x be set ; ::_thesis: ( x in Y implies x in seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) )
A54: p / 4 >= [\(p / 4)/] by INT_1:def_6;
assume x in Y ; ::_thesis: x in seq ((p div 4),(((p -' 1) div 2) -' (p div 4)))
then consider x1 being Element of NAT such that
A55: x1 = x and
A56: x1 in dom (fp mod p) and
A57: (fp mod p) . x1 > p / 2 ;
2 * x1 > p / 2 by A20, A56, A57;
then x1 > (p / 2) / 2 by XREAL_1:83;
then x1 > [\(p / 4)/] by A54, XXREAL_0:2;
then A58: x1 >= (p div 4) + 1 by NAT_1:13;
x1 <= (p -' 1) div 2 by A6, A11, A56, FINSEQ_3:25;
then x1 <= (((p -' 1) div 2) -' (p div 4)) + (p div 4) by A17, A48, XREAL_1:235;
hence x in seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) by A55, A58; ::_thesis: verum
end;
then Y c= seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) by TARSKI:def_3;
then Y = seq ((p div 4),(((p -' 1) div 2) -' (p div 4))) by A49, XBOOLE_0:def_10;
then A59: m = ((p -' 1) div 2) -' (p div 4) by A30, A35, CARD_1:5;
A60: now__::_thesis:_not_p_mod_8_=_2
assume p mod 8 = 2 ; ::_thesis: contradiction
then 8 divides p - 2 by PEPIN:8;
then 2 divides p - 2 by A8, INT_2:9;
then 2 divides - (p - 2) by INT_2:10;
then 2 divides 2 - p ;
then 2 divides p by Th2;
hence contradiction by A13, NAT_4:12; ::_thesis: verum
end;
A61: now__::_thesis:_not_p_mod_8_=_4
assume p mod 8 = 4 ; ::_thesis: contradiction
then 8 divides p - 4 by PEPIN:8;
then 2 divides p - 4 by A8, INT_2:9;
then 2 divides - (p - 4) by INT_2:10;
then A62: 2 divides 4 - p ;
4 = 2 * 2 ;
then 2 divides 4 by NAT_D:def_3;
then 2 divides p by A62, Th2;
hence contradiction by A13, NAT_4:12; ::_thesis: verum
end;
A63: now__::_thesis:_not_p_mod_8_=_6
assume p mod 8 = 6 ; ::_thesis: contradiction
then 8 divides p - 6 by PEPIN:8;
then 2 divides p - 6 by A8, INT_2:9;
then 2 divides - (p - 6) by INT_2:10;
then A64: 2 divides 6 - p ;
6 = 2 * 3 ;
then 2 divides 6 by NAT_D:def_3;
then 2 divides p by A64, Th2;
hence contradiction by A13, NAT_4:12; ::_thesis: verum
end;
percases ( p mod 8 = 1 or p mod 8 = 3 or p mod 8 = 5 or p mod 8 = 7 ) by A9, A60, A61, A63, A7, NAT_1:31;
suppose p mod 8 = 1 ; ::_thesis: Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
then A65: p = (8 * (p div 8)) + 1 by NAT_D:2;
then p -' 1 = 2 * (4 * (p div 8)) by A2;
then A66: (p -' 1) div 2 = 4 * (p div 8) by NAT_D:18;
p div 4 = ((4 * (2 * (p div 8))) + 1) div 4 by A65
.= (2 * (p div 8)) + (1 div 4) by NAT_D:61
.= (2 * (p div 8)) + 0 by NAT_D:27 ;
then m = (4 * (p div 8)) - (2 * (p div 8)) by A59, A66, XREAL_1:64, XREAL_1:233
.= 2 * (p div 8) ;
then A67: Lege (2,p) = ((- 1) |^ 2) |^ (p div 8) by A15, NEWTON:9
.= (1 |^ 2) |^ (p div 8) by WSIERP_1:1
.= (1 ^2) |^ (p div 8) by NEWTON:81
.= 1 by NEWTON:10 ;
((p ^2) -' 1) div 8 = (((((8 * (p div 8)) ^2) + (2 * (8 * (p div 8)))) + 1) -' 1) div 8 by A65
.= (8 * ((8 * ((p div 8) ^2)) + (2 * (p div 8)))) div 8 by NAT_D:34
.= (8 * ((p div 8) ^2)) + (2 * (p div 8)) by NAT_D:18 ;
hence (- 1) |^ (((p ^2) -' 1) div 8) = (- 1) |^ (2 * ((4 * ((p div 8) ^2)) + (p div 8)))
.= ((- 1) |^ 2) |^ ((4 * ((p div 8) ^2)) + (p div 8)) by NEWTON:9
.= (1 |^ 2) |^ ((4 * ((p div 8) ^2)) + (p div 8)) by WSIERP_1:1
.= 1 |^ ((4 * ((p div 8) ^2)) + (p div 8)) by NEWTON:10
.= Lege (2,p) by A67, NEWTON:10 ;
::_thesis: verum
end;
suppose p mod 8 = 3 ; ::_thesis: Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
then A68: p = (8 * (p div 8)) + 3 by NAT_D:2;
then p -' 1 = 2 * ((4 * (p div 8)) + 1) by A2;
then A69: (p -' 1) div 2 = (4 * (p div 8)) + 1 by NAT_D:18;
A70: 4 * (p div 8) >= 2 * (p div 8) by XREAL_1:64;
p div 4 = ((4 * (2 * (p div 8))) + 3) div 4 by A68
.= (2 * (p div 8)) + (3 div 4) by NAT_D:61
.= (2 * (p div 8)) + 0 by NAT_D:27 ;
then m = ((4 * (p div 8)) + 1) - (2 * (p div 8)) by A59, A69, A70, NAT_1:12, XREAL_1:233
.= (2 * (p div 8)) + 1 ;
then A71: Lege (2,p) = ((- 1) |^ (2 * (p div 8))) * (- 1) by A15, NEWTON:6
.= (((- 1) |^ 2) |^ (p div 8)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (p div 8)) * (- 1) by WSIERP_1:1
.= (1 |^ (p div 8)) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= - 1 ;
((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (6 * (p div 8)))) + (3 * 3)) - 1) div 8 by A68, NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (6 * (p div 8))) + 1)) div 8
.= ((8 * ((p div 8) ^2)) + (6 * (p div 8))) + 1 by NAT_D:18 ;
hence (- 1) |^ (((p ^2) -' 1) div 8) = ((- 1) |^ (2 * ((4 * ((p div 8) ^2)) + (3 * (p div 8))))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by WSIERP_1:1
.= (1 |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= Lege (2,p) by A71 ;
::_thesis: verum
end;
suppose p mod 8 = 5 ; ::_thesis: Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
then A72: p = (8 * (p div 8)) + 5 by NAT_D:2;
then p -' 1 = 2 * ((4 * (p div 8)) + 2) by A2;
then A73: (p -' 1) div 2 = (4 * (p div 8)) + 2 by NAT_D:18;
A74: 4 * (p div 8) >= 2 * (p div 8) by XREAL_1:64;
p div 4 = ((4 * ((2 * (p div 8)) + 1)) + 1) div 4 by A72
.= ((2 * (p div 8)) + 1) + (1 div 4) by NAT_D:61
.= ((2 * (p div 8)) + 1) + 0 by NAT_D:27 ;
then m = ((4 * (p div 8)) + 2) - ((2 * (p div 8)) + 1) by A59, A73, A74, XREAL_1:7, XREAL_1:233
.= (2 * (p div 8)) + 1 ;
then A75: Lege (2,p) = ((- 1) |^ (2 * (p div 8))) * (- 1) by A15, NEWTON:6
.= (((- 1) |^ 2) |^ (p div 8)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (p div 8)) * (- 1) by WSIERP_1:1
.= (1 |^ (p div 8)) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= - 1 ;
((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (10 * (p div 8)))) + 25) - 1) div 8 by A72, NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (10 * (p div 8))) + 3)) div 8
.= ((8 * ((p div 8) ^2)) + (10 * (p div 8))) + 3 by NAT_D:18 ;
hence (- 1) |^ (((p ^2) -' 1) div 8) = (- 1) |^ ((((2 * (4 * ((p div 8) ^2))) + (2 * (5 * (p div 8)))) + (2 * 1)) + 1)
.= ((- 1) |^ (2 * (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by WSIERP_1:1
.= (1 |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= Lege (2,p) by A75 ;
::_thesis: verum
end;
suppose p mod 8 = 7 ; ::_thesis: Lege (2,p) = (- 1) |^ (((p ^2) -' 1) div 8)
then A76: p = (8 * (p div 8)) + 7 by NAT_D:2;
then p -' 1 = 2 * ((4 * (p div 8)) + 3) by A2;
then A77: (p -' 1) div 2 = (4 * (p div 8)) + 3 by NAT_D:18;
A78: 4 * (p div 8) >= 2 * (p div 8) by XREAL_1:64;
p div 4 = ((4 * ((2 * (p div 8)) + 1)) + 3) div 4 by A76
.= ((2 * (p div 8)) + 1) + (3 div 4) by NAT_D:61
.= ((2 * (p div 8)) + 1) + 0 by NAT_D:27 ;
then m = ((4 * (p div 8)) + 3) - ((2 * (p div 8)) + 1) by A59, A77, A78, XREAL_1:7, XREAL_1:233
.= (2 * (p div 8)) + 2 ;
then A79: Lege (2,p) = (- 1) |^ (2 * ((p div 8) + 1)) by A13, A14, Th41
.= ((- 1) |^ 2) |^ ((p div 8) + 1) by NEWTON:9
.= (1 |^ 2) |^ ((p div 8) + 1) by WSIERP_1:1
.= 1 |^ ((p div 8) + 1) by NEWTON:10
.= 1 by NEWTON:10 ;
((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (14 * (p div 8)))) + 49) - 1) div 8 by A76, NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (14 * (p div 8))) + 6)) div 8
.= ((8 * ((p div 8) ^2)) + (14 * (p div 8))) + 6 by NAT_D:18 ;
hence (- 1) |^ (((p ^2) -' 1) div 8) = (- 1) |^ (2 * (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3))
.= ((- 1) |^ 2) |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by NEWTON:9
.= (1 |^ 2) |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by WSIERP_1:1
.= 1 |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by NEWTON:10
.= Lege (2,p) by A79, NEWTON:10 ;
::_thesis: verum
end;
end;
end;
theorem :: INT_5:43
for p being Prime st p > 2 & ( p mod 8 = 1 or p mod 8 = 7 ) holds
2 is_quadratic_residue_mod p
proof
let p be Prime; ::_thesis: ( p > 2 & ( p mod 8 = 1 or p mod 8 = 7 ) implies 2 is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: ( p mod 8 = 1 or p mod 8 = 7 ) ; ::_thesis: 2 is_quadratic_residue_mod p
set nn = p div 8;
percases ( p mod 8 = 1 or p mod 8 = 7 ) by A2;
suppose p mod 8 = 1 ; ::_thesis: 2 is_quadratic_residue_mod p
then p = (8 * (p div 8)) + 1 by NAT_D:2;
then ((p ^2) -' 1) div 8 = (((((8 * (p div 8)) ^2) + (2 * (8 * (p div 8)))) + 1) -' 1) div 8
.= (8 * ((8 * ((p div 8) ^2)) + (2 * (p div 8)))) div 8 by NAT_D:34
.= 2 * ((4 * ((p div 8) ^2)) + (p div 8)) by NAT_D:18 ;
then Lege (2,p) = (- 1) |^ (2 * ((4 * ((p div 8) ^2)) + (p div 8))) by A1, Th42
.= ((- 1) |^ 2) |^ ((4 * ((p div 8) ^2)) + (p div 8)) by NEWTON:9
.= (1 |^ 2) |^ ((4 * ((p div 8) ^2)) + (p div 8)) by WSIERP_1:1
.= 1 |^ ((4 * ((p div 8) ^2)) + (p div 8)) by NEWTON:10
.= 1 by NEWTON:10 ;
hence 2 is_quadratic_residue_mod p by Def3; ::_thesis: verum
end;
suppose p mod 8 = 7 ; ::_thesis: 2 is_quadratic_residue_mod p
then p = (8 * (p div 8)) + 7 by NAT_D:2;
then ((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (14 * (p div 8)))) + 49) - 1) div 8 by NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (14 * (p div 8))) + 6)) div 8
.= 2 * (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by NAT_D:18 ;
then Lege (2,p) = (- 1) |^ (2 * (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3)) by A1, Th42
.= ((- 1) |^ 2) |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by NEWTON:9
.= (1 |^ 2) |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by WSIERP_1:1
.= 1 |^ (((4 * ((p div 8) ^2)) + (7 * (p div 8))) + 3) by NEWTON:10
.= 1 by NEWTON:10 ;
hence 2 is_quadratic_residue_mod p by Def3; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:44
for p being Prime st p > 2 & ( p mod 8 = 3 or p mod 8 = 5 ) holds
not 2 is_quadratic_residue_mod p
proof
let p be Prime; ::_thesis: ( p > 2 & ( p mod 8 = 3 or p mod 8 = 5 ) implies not 2 is_quadratic_residue_mod p )
assume that
A1: p > 2 and
A2: ( p mod 8 = 3 or p mod 8 = 5 ) ; ::_thesis: not 2 is_quadratic_residue_mod p
set nn = p div 8;
percases ( p mod 8 = 3 or p mod 8 = 5 ) by A2;
suppose p mod 8 = 3 ; ::_thesis: not 2 is_quadratic_residue_mod p
then p = (8 * (p div 8)) + 3 by NAT_D:2;
then ((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (6 * (p div 8)))) + (3 * 3)) - 1) div 8 by NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (6 * (p div 8))) + 1)) div 8
.= ((8 * ((p div 8) ^2)) + (6 * (p div 8))) + 1 by NAT_D:18 ;
then Lege (2,p) = (- 1) |^ (((8 * ((p div 8) ^2)) + (6 * (p div 8))) + 1) by A1, Th42
.= ((- 1) |^ (2 * ((4 * ((p div 8) ^2)) + (3 * (p div 8))))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by WSIERP_1:1
.= (1 |^ ((4 * ((p div 8) ^2)) + (3 * (p div 8)))) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= - 1 ;
then ( ( not 2 is_quadratic_residue_mod p or not 2 mod p <> 0 ) & ( not 2 is_quadratic_residue_mod p or not 2 mod p = 0 ) ) by Def3;
hence not 2 is_quadratic_residue_mod p ; ::_thesis: verum
end;
suppose p mod 8 = 5 ; ::_thesis: not 2 is_quadratic_residue_mod p
then p = (8 * (p div 8)) + 5 by NAT_D:2;
then ((p ^2) -' 1) div 8 = ((((8 * (8 * ((p div 8) ^2))) + (8 * (10 * (p div 8)))) + 25) - 1) div 8 by NAT_1:12, XREAL_1:233
.= (8 * (((8 * ((p div 8) ^2)) + (10 * (p div 8))) + 3)) div 8
.= ((8 * ((p div 8) ^2)) + (10 * (p div 8))) + 3 by NAT_D:18 ;
then Lege (2,p) = (- 1) |^ ((((2 * (4 * ((p div 8) ^2))) + (2 * (5 * (p div 8)))) + (2 * 1)) + 1) by A1, Th42
.= ((- 1) |^ (2 * (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by WSIERP_1:1
.= (1 |^ (((4 * ((p div 8) ^2)) + (5 * (p div 8))) + 1)) * (- 1) by NEWTON:10
.= 1 * (- 1) by NEWTON:10
.= - 1 ;
then ( ( not 2 is_quadratic_residue_mod p or not 2 mod p <> 0 ) & ( not 2 is_quadratic_residue_mod p or not 2 mod p = 0 ) ) by Def3;
hence not 2 is_quadratic_residue_mod p ; ::_thesis: verum
end;
end;
end;
theorem Th45: :: INT_5:45
for a, b being Nat st a mod 2 = b mod 2 holds
(- 1) |^ a = (- 1) |^ b
proof
let a, b be Nat; ::_thesis: ( a mod 2 = b mod 2 implies (- 1) |^ a = (- 1) |^ b )
assume a mod 2 = b mod 2 ; ::_thesis: (- 1) |^ a = (- 1) |^ b
then a,b are_congruent_mod 2 by NAT_D:64;
then A1: 2 divides a - b by INT_2:15;
percases ( a >= b or a < b ) ;
suppose a >= b ; ::_thesis: (- 1) |^ a = (- 1) |^ b
then reconsider l = a - b as Element of NAT by NAT_1:21;
consider n being Nat such that
A2: l = 2 * n by A1, NAT_D:def_3;
(- 1) |^ a = (- 1) |^ (b + (2 * n)) by A2
.= ((- 1) |^ b) * ((- 1) |^ (2 * n)) by NEWTON:8
.= ((- 1) |^ b) * (((- 1) |^ 2) |^ n) by NEWTON:9
.= ((- 1) |^ b) * ((1 |^ 2) |^ n) by WSIERP_1:1
.= ((- 1) |^ b) * (1 |^ n) by NEWTON:10
.= ((- 1) |^ b) * 1 by NEWTON:10 ;
hence (- 1) |^ a = (- 1) |^ b ; ::_thesis: verum
end;
suppose a < b ; ::_thesis: (- 1) |^ a = (- 1) |^ b
then reconsider l = b - a as Element of NAT by NAT_1:21;
2 divides - (a - b) by A1, INT_2:10;
then consider n being Nat such that
A3: l = 2 * n by NAT_D:def_3;
(- 1) |^ b = (- 1) |^ (a + (2 * n)) by A3
.= ((- 1) |^ a) * ((- 1) |^ (2 * n)) by NEWTON:8
.= ((- 1) |^ a) * (((- 1) |^ 2) |^ n) by NEWTON:9
.= ((- 1) |^ a) * ((1 |^ 2) |^ n) by WSIERP_1:1
.= ((- 1) |^ a) * (1 |^ n) by NEWTON:10
.= ((- 1) |^ a) * 1 by NEWTON:10 ;
hence (- 1) |^ a = (- 1) |^ b ; ::_thesis: verum
end;
end;
end;
theorem Th46: :: INT_5:46
for f, h, g, k being FinSequence of REAL st len f = len h & len g = len k holds
(f ^ g) - (h ^ k) = (f - h) ^ (g - k)
proof
let f, h, g, k be FinSequence of REAL ; ::_thesis: ( len f = len h & len g = len k implies (f ^ g) - (h ^ k) = (f - h) ^ (g - k) )
assume that
A1: len f = len h and
A2: len g = len k ; ::_thesis: (f ^ g) - (h ^ k) = (f - h) ^ (g - k)
A3: len (f - h) = len f by A1, TOPREAL7:7;
len (f ^ g) = (len h) + (len k) by A1, A2, FINSEQ_1:22;
then len (f ^ g) = len (h ^ k) by FINSEQ_1:22;
then A4: len ((f ^ g) - (h ^ k)) = len (f ^ g) by TOPREAL7:7;
A5: len (g - k) = len g by A2, TOPREAL7:7;
then len ((f - h) ^ (g - k)) = (len f) + (len g) by A3, FINSEQ_1:22;
then len ((f ^ g) - (h ^ k)) = len ((f - h) ^ (g - k)) by A4, FINSEQ_1:22;
then A6: dom ((f ^ g) - (h ^ k)) = dom ((f - h) ^ (g - k)) by FINSEQ_3:29;
for d being Nat st d in dom ((f - h) ^ (g - k)) holds
((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d
proof
let d be Nat; ::_thesis: ( d in dom ((f - h) ^ (g - k)) implies ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d )
assume A7: d in dom ((f - h) ^ (g - k)) ; ::_thesis: ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d
percases ( d in dom (f - h) or ex e being Nat st
( e in dom (g - k) & d = (len (f - h)) + e ) ) by A7, FINSEQ_1:25;
supposeA8: d in dom (f - h) ; ::_thesis: ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d
then A9: ((f - h) ^ (g - k)) . d = (f - h) . d by FINSEQ_1:def_7
.= (f . d) - (h . d) by A8, VALUED_1:13 ;
A10: dom f = dom (f - h) by A1, TOPREAL7:7;
A11: dom h = dom (f - h) by A1, A3, FINSEQ_3:29;
((f ^ g) - (h ^ k)) . d = ((f ^ g) . d) - ((h ^ k) . d) by A6, A8, FINSEQ_2:15, VALUED_1:13
.= (f . d) - ((h ^ k) . d) by A8, A10, FINSEQ_1:def_7
.= (f . d) - (h . d) by A8, A11, FINSEQ_1:def_7 ;
hence ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d by A9; ::_thesis: verum
end;
suppose ex e being Nat st
( e in dom (g - k) & d = (len (f - h)) + e ) ; ::_thesis: ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d
then consider e being Nat such that
A12: e in dom (g - k) and
A13: d = (len (f - h)) + e ;
e in dom g by A2, A12, TOPREAL7:7;
then A14: (f ^ g) . d = g . e by A3, A13, FINSEQ_1:def_7;
e in dom k by A2, A5, A12, FINSEQ_3:29;
then A15: (h ^ k) . d = k . e by A1, A3, A13, FINSEQ_1:def_7;
((f - h) ^ (g - k)) . d = (g - k) . e by A12, A13, FINSEQ_1:def_7
.= (g . e) - (k . e) by A12, VALUED_1:13 ;
hence ((f - h) ^ (g - k)) . d = ((f ^ g) - (h ^ k)) . d by A6, A12, A13, A14, A15, FINSEQ_1:28, VALUED_1:13; ::_thesis: verum
end;
end;
end;
hence (f ^ g) - (h ^ k) = (f - h) ^ (g - k) by A6, FINSEQ_1:13; ::_thesis: verum
end;
theorem Th47: :: INT_5:47
for f being FinSequence of REAL
for m being Real holds Sum (((len f) |-> m) - f) = ((len f) * m) - (Sum f)
proof
defpred S1[ Nat] means for f being FinSequence of REAL
for m being Real st len f = $1 holds
Sum (($1 |-> m) - f) = ($1 * m) - (Sum f);
A1: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
S1[n + 1]
proof
let f be FinSequence of REAL ; ::_thesis: for m being Real st len f = n + 1 holds
Sum (((n + 1) |-> m) - f) = ((n + 1) * m) - (Sum f)
let m be Real; ::_thesis: ( len f = n + 1 implies Sum (((n + 1) |-> m) - f) = ((n + 1) * m) - (Sum f) )
A3: len <*m*> = 1 by FINSEQ_1:39;
assume A4: len f = n + 1 ; ::_thesis: Sum (((n + 1) |-> m) - f) = ((n + 1) * m) - (Sum f)
then f <> {} ;
then consider f1 being FinSequence of REAL , x being Element of REAL such that
A5: f = f1 ^ <*x*> by HILBERT2:4;
A6: n + 1 = (len f1) + 1 by A4, A5, FINSEQ_2:16;
then A7: len (n |-> m) = len f1 by CARD_1:def_7;
A8: len <*x*> = 1 by FINSEQ_1:39;
((n + 1) |-> m) - f = ((n |-> m) ^ <*m*>) - (f1 ^ <*x*>) by A5, FINSEQ_2:60
.= ((n |-> m) - f1) ^ (<*m*> - <*x*>) by A7, A8, A3, Th46
.= ((n |-> m) - f1) ^ <*(m - x)*> by RVSUM_1:29 ;
hence Sum (((n + 1) |-> m) - f) = (Sum ((n |-> m) - f1)) + (m - x) by RVSUM_1:74
.= ((n * m) - (Sum f1)) + (m - x) by A2, A6
.= ((n + 1) * m) - ((Sum f1) + x)
.= ((n + 1) * m) - (Sum f) by A5, RVSUM_1:74 ;
::_thesis: verum
end;
hence S1[n + 1] ; ::_thesis: verum
end;
A9: S1[ 0 ]
proof
let f be FinSequence of REAL ; ::_thesis: for m being Real st len f = 0 holds
Sum ((0 |-> m) - f) = (0 * m) - (Sum f)
let m be Real; ::_thesis: ( len f = 0 implies Sum ((0 |-> m) - f) = (0 * m) - (Sum f) )
assume len f = 0 ; ::_thesis: Sum ((0 |-> m) - f) = (0 * m) - (Sum f)
then Sum f = 0 by PROB_3:62;
hence Sum ((0 |-> m) - f) = (0 * m) - (Sum f) by RVSUM_1:28, RVSUM_1:72; ::_thesis: verum
end;
for n being Element of NAT holds S1[n] from NAT_1:sch_1(A9, A1);
hence for f being FinSequence of REAL
for m being Real holds Sum (((len f) |-> m) - f) = ((len f) * m) - (Sum f) ; ::_thesis: verum
end;
definition
let X be finite set ;
let F be FinSequence of bool X;
:: original: Card
redefine func Card F -> Cardinal-yielding FinSequence of NAT ;
coherence
Card F is Cardinal-yielding FinSequence of NAT
proof
rng (Card F) c= NAT
proof
let y be set ; :: according to TARSKI:def_3 ::_thesis: ( not y in rng (Card F) or y in NAT )
assume y in rng (Card F) ; ::_thesis: y in NAT
then consider x being set such that
A1: x in dom (Card F) and
A2: y = (Card F) . x by FUNCT_1:def_3;
A3: x in dom F by A1, CARD_3:def_2;
then F . x in rng F by FUNCT_1:3;
then reconsider Fx = F . x as finite set ;
y = card Fx by A2, A3, CARD_3:def_2;
hence y in NAT ; ::_thesis: verum
end;
hence Card F is Cardinal-yielding FinSequence of NAT by FINSEQ_1:def_4; ::_thesis: verum
end;
end;
theorem Th48: :: INT_5:48
for n being Nat
for X being finite set
for f being FinSequence of bool X st len f = n & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) holds
card (union (rng f)) = Sum (Card f)
proof
let n be Nat; ::_thesis: for X being finite set
for f being FinSequence of bool X st len f = n & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) holds
card (union (rng f)) = Sum (Card f)
let X be finite set ; ::_thesis: for f being FinSequence of bool X st len f = n & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) holds
card (union (rng f)) = Sum (Card f)
defpred S1[ Nat] means for f being FinSequence of bool X st len f = $1 & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) holds
card (union (rng f)) = Sum (Card f);
A1: for n being Element of NAT st S1[n] holds
S1[n + 1]
proof
let n be Element of NAT ; ::_thesis: ( S1[n] implies S1[n + 1] )
assume A2: S1[n] ; ::_thesis: S1[n + 1]
S1[n + 1]
proof
let f be FinSequence of bool X; ::_thesis: ( len f = n + 1 & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) implies card (union (rng f)) = Sum (Card f) )
assume that
A3: len f = n + 1 and
A4: for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ; ::_thesis: card (union (rng f)) = Sum (Card f)
A5: f <> {} by A3;
then consider f1 being FinSequence of bool X, Y being Element of bool X such that
A6: f = f1 ^ <*Y*> by HILBERT2:4;
reconsider F1 = union (rng f1) as finite set ;
A7: union (rng f) = union ((rng f1) \/ (rng <*Y*>)) by A6, FINSEQ_1:31
.= union ((rng f1) \/ {Y}) by FINSEQ_1:38
.= F1 \/ (union {Y}) by ZFMISC_1:78
.= F1 \/ Y by ZFMISC_1:25 ;
A8: n + 1 = (len f1) + 1 by A3, A6, FINSEQ_2:16;
F1 misses Y
proof
A9: n + 1 in dom f by A3, A5, FINSEQ_5:6;
assume F1 meets Y ; ::_thesis: contradiction
then consider x being set such that
A10: x in F1 /\ Y by XBOOLE_0:4;
x in F1 by A10, XBOOLE_0:def_4;
then consider Z being set such that
A11: x in Z and
A12: Z in rng f1 by TARSKI:def_4;
consider k being Nat such that
A13: k in dom f1 and
A14: f1 . k = Z by A12, FINSEQ_2:10;
k <= n by A8, A13, FINSEQ_3:25;
then A15: k < n + 1 by NAT_1:13;
k in dom f by A6, A13, FINSEQ_2:15;
then f . (n + 1) misses f . k by A4, A15, A9;
then Y misses f . k by A6, A8, FINSEQ_1:42;
then A16: Y misses Z by A6, A13, A14, FINSEQ_1:def_7;
x in Y \/ Z by A11, XBOOLE_0:def_3;
then not x in Y by A11, A16, XBOOLE_0:5;
hence contradiction by A10, XBOOLE_0:def_4; ::_thesis: verum
end;
then A17: (card F1) + (card Y) = card (F1 \/ Y) by CARD_2:40;
reconsider gg = <*(card Y)*> as FinSequence of NAT ;
A18: Card f = (Card f1) ^ (Card <*Y*>) by A6, PRE_POLY:25
.= (Card f1) ^ gg by PRE_POLY:24 ;
for d, e being Nat st d in dom f1 & e in dom f1 & d <> e holds
f1 . d misses f1 . e
proof
let d, e be Nat; ::_thesis: ( d in dom f1 & e in dom f1 & d <> e implies f1 . d misses f1 . e )
assume that
A19: d in dom f1 and
A20: e in dom f1 and
A21: d <> e ; ::_thesis: f1 . d misses f1 . e
A22: f . e = f1 . e by A6, A20, FINSEQ_1:def_7;
A23: e in dom f by A6, A20, FINSEQ_2:15;
A24: d in dom f by A6, A19, FINSEQ_2:15;
f . d = f1 . d by A6, A19, FINSEQ_1:def_7;
hence f1 . d misses f1 . e by A4, A21, A22, A24, A23; ::_thesis: verum
end;
then card (union (rng f1)) = Sum (Card f1) by A2, A8;
hence card (union (rng f)) = Sum (Card f) by A17, A18, A7, RVSUM_1:74; ::_thesis: verum
end;
hence S1[n + 1] ; ::_thesis: verum
end;
A25: S1[ 0 ]
proof
let f be FinSequence of bool X; ::_thesis: ( len f = 0 & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) implies card (union (rng f)) = Sum (Card f) )
assume that
A26: len f = 0 and
for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ; ::_thesis: card (union (rng f)) = Sum (Card f)
A27: Card {} = {} ;
f = {} by A26;
hence card (union (rng f)) = Sum (Card f) by A27, CARD_1:27, RVSUM_1:72, ZFMISC_1:2; ::_thesis: verum
end;
for n being Element of NAT holds S1[n] from NAT_1:sch_1(A25, A1);
hence for f being FinSequence of bool X st len f = n & ( for d, e being Nat st d in dom f & e in dom f & d <> e holds
f . d misses f . e ) holds
card (union (rng f)) = Sum (Card f) ; ::_thesis: verum
end;
Lm4: for fp being FinSequence of NAT holds Sum fp is Element of NAT
;
theorem Th49: :: INT_5:49
for p, q being Prime st p > 2 & q > 2 & p <> q holds
(Lege (p,q)) * (Lege (q,p)) = (- 1) |^ (((p -' 1) div 2) * ((q -' 1) div 2))
proof
let p, q be Prime; ::_thesis: ( p > 2 & q > 2 & p <> q implies (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ (((p -' 1) div 2) * ((q -' 1) div 2)) )
assume that
A1: p > 2 and
A2: q > 2 and
A3: p <> q ; ::_thesis: (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ (((p -' 1) div 2) * ((q -' 1) div 2))
A4: q,p are_relative_prime by A3, INT_2:30;
then A5: q gcd p = 1 by INT_2:def_3;
reconsider p = p, q = q as prime Element of NAT by ORDINAL1:def_12;
set p9 = (p -' 1) div 2;
A6: p > 1 by INT_2:def_4;
then A7: p -' 1 = p - 1 by XREAL_1:233;
then A8: p -' 1 > 0 by A6, XREAL_1:50;
p is odd by A1, PEPIN:17;
then A9: p -' 1 is even by A7, HILBERT3:2;
then A10: 2 divides p -' 1 by PEPIN:22;
then A11: p -' 1 = 2 * ((p -' 1) div 2) by NAT_D:3;
then (p -' 1) div 2 divides p -' 1 by NAT_D:def_3;
then (p -' 1) div 2 <= p -' 1 by A8, NAT_D:7;
then A12: (p -' 1) div 2 < p by A7, XREAL_1:146, XXREAL_0:2;
set f1 = q * (idseq ((p -' 1) div 2));
A13: for d being Nat st d in dom (q * (idseq ((p -' 1) div 2))) holds
(q * (idseq ((p -' 1) div 2))) . d = q * d
proof
let d be Nat; ::_thesis: ( d in dom (q * (idseq ((p -' 1) div 2))) implies (q * (idseq ((p -' 1) div 2))) . d = q * d )
assume A14: d in dom (q * (idseq ((p -' 1) div 2))) ; ::_thesis: (q * (idseq ((p -' 1) div 2))) . d = q * d
then d in dom (idseq ((p -' 1) div 2)) by VALUED_1:def_5;
then d in Seg (len (idseq ((p -' 1) div 2))) by FINSEQ_1:def_3;
then A15: d is Element of Seg ((p -' 1) div 2) by CARD_1:def_7;
(q * (idseq ((p -' 1) div 2))) . d = q * ((idseq ((p -' 1) div 2)) . d) by A14, VALUED_1:def_5;
hence (q * (idseq ((p -' 1) div 2))) . d = q * d by A15, FINSEQ_2:49; ::_thesis: verum
end;
A16: for d being Nat st d in dom (q * (idseq ((p -' 1) div 2))) holds
(q * (idseq ((p -' 1) div 2))) . d in NAT ;
dom (q * (idseq ((p -' 1) div 2))) = dom (idseq ((p -' 1) div 2)) by VALUED_1:def_5;
then A17: len (q * (idseq ((p -' 1) div 2))) = len (idseq ((p -' 1) div 2)) by FINSEQ_3:29;
then A18: len (q * (idseq ((p -' 1) div 2))) = (p -' 1) div 2 by CARD_1:def_7;
set q9 = (q -' 1) div 2;
set g1 = p * (idseq ((q -' 1) div 2));
A19: for d being Nat st d in dom (p * (idseq ((q -' 1) div 2))) holds
(p * (idseq ((q -' 1) div 2))) . d = p * d
proof
let d be Nat; ::_thesis: ( d in dom (p * (idseq ((q -' 1) div 2))) implies (p * (idseq ((q -' 1) div 2))) . d = p * d )
assume A20: d in dom (p * (idseq ((q -' 1) div 2))) ; ::_thesis: (p * (idseq ((q -' 1) div 2))) . d = p * d
then d in dom (idseq ((q -' 1) div 2)) by VALUED_1:def_5;
then d in Seg (len (idseq ((q -' 1) div 2))) by FINSEQ_1:def_3;
then A21: d is Element of Seg ((q -' 1) div 2) by CARD_1:def_7;
(p * (idseq ((q -' 1) div 2))) . d = p * ((idseq ((q -' 1) div 2)) . d) by A20, VALUED_1:def_5;
hence (p * (idseq ((q -' 1) div 2))) . d = p * d by A21, FINSEQ_2:49; ::_thesis: verum
end;
A22: for d being Nat st d in dom (p * (idseq ((q -' 1) div 2))) holds
(p * (idseq ((q -' 1) div 2))) . d in NAT ;
dom (p * (idseq ((q -' 1) div 2))) = dom (idseq ((q -' 1) div 2)) by VALUED_1:def_5;
then len (p * (idseq ((q -' 1) div 2))) = len (idseq ((q -' 1) div 2)) by FINSEQ_3:29;
then A23: len (p * (idseq ((q -' 1) div 2))) = (q -' 1) div 2 by CARD_1:def_7;
reconsider g1 = p * (idseq ((q -' 1) div 2)) as FinSequence of NAT by A22, FINSEQ_2:12;
set g3 = g1 mod q;
set g4 = Sgm (rng (g1 mod q));
A24: len (g1 mod q) = len g1 by EULER_2:def_1;
then A25: dom g1 = dom (g1 mod q) by FINSEQ_3:29;
set XX = { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } ;
for x being set st x in { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } holds
x in rng (Sgm (rng (g1 mod q)))
proof
let x be set ; ::_thesis: ( x in { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } implies x in rng (Sgm (rng (g1 mod q))) )
assume x in { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } ; ::_thesis: x in rng (Sgm (rng (g1 mod q)))
then ex k being Element of NAT st
( x = k & k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) ;
hence x in rng (Sgm (rng (g1 mod q))) ; ::_thesis: verum
end;
then A26: { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } c= rng (Sgm (rng (g1 mod q))) by TARSKI:def_3;
reconsider f1 = q * (idseq ((p -' 1) div 2)) as FinSequence of NAT by A16, FINSEQ_2:12;
deffunc H1( Nat) -> Element of NAT = (f1 . $1) div p;
consider f2 being FinSequence such that
A27: ( len f2 = (p -' 1) div 2 & ( for d being Nat st d in dom f2 holds
f2 . d = H1(d) ) ) from FINSEQ_1:sch_2();
A28: q > 1 by INT_2:def_4;
then A29: q -' 1 = q - 1 by XREAL_1:233;
then A30: q -' 1 > 0 by A28, XREAL_1:50;
q >= 2 + 1 by A2, NAT_1:13;
then q - 1 >= 3 - 1 by XREAL_1:9;
then A31: (q -' 1) div 2 >= 1 by A29, NAT_2:13;
then len (g1 mod q) >= 1 by A23, EULER_2:def_1;
then g1 mod q <> {} ;
then rng (g1 mod q) is non empty finite Subset of NAT by FINSEQ_1:def_4;
then consider n2 being Element of NAT such that
A32: rng (g1 mod q) c= (Seg n2) \/ {0} by HEYTING3:1;
deffunc H2( Nat) -> Element of NAT = (g1 . $1) div q;
consider g2 being FinSequence such that
A33: ( len g2 = (q -' 1) div 2 & ( for d being Nat st d in dom g2 holds
g2 . d = H2(d) ) ) from FINSEQ_1:sch_2();
for d being Nat st d in dom g2 holds
g2 . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom g2 implies g2 . d in NAT )
assume d in dom g2 ; ::_thesis: g2 . d in NAT
then g2 . d = (g1 . d) div q by A33;
hence g2 . d in NAT ; ::_thesis: verum
end;
then reconsider g2 = g2 as FinSequence of NAT by FINSEQ_2:12;
A34: dom g1 = dom g2 by A23, A33, FINSEQ_3:29;
A35: for d being Nat st d in dom g1 holds
g1 . d = ((g2 . d) * q) + ((g1 mod q) . d)
proof
let d be Nat; ::_thesis: ( d in dom g1 implies g1 . d = ((g2 . d) * q) + ((g1 mod q) . d) )
assume A36: d in dom g1 ; ::_thesis: g1 . d = ((g2 . d) * q) + ((g1 mod q) . d)
then A37: (g1 mod q) . d = (g1 . d) mod q by EULER_2:def_1;
g2 . d = (g1 . d) div q by A33, A34, A36;
hence g1 . d = ((g2 . d) * q) + ((g1 mod q) . d) by A37, NAT_D:2; ::_thesis: verum
end;
q is odd by A2, PEPIN:17;
then A38: q -' 1 is even by A29, HILBERT3:2;
then A39: 2 divides q -' 1 by PEPIN:22;
then A40: q -' 1 = 2 * ((q -' 1) div 2) by NAT_D:3;
then (q -' 1) div 2 divides q -' 1 by NAT_D:def_3;
then (q -' 1) div 2 <= q -' 1 by A30, NAT_D:7;
then A41: (q -' 1) div 2 < q by A29, XREAL_1:146, XXREAL_0:2;
not 0 in rng (g1 mod q)
proof
assume 0 in rng (g1 mod q) ; ::_thesis: contradiction
then consider a being Nat such that
A42: a in dom (g1 mod q) and
A43: (g1 mod q) . a = 0 by FINSEQ_2:10;
a in dom g1 by A24, A42, FINSEQ_3:29;
then A44: g1 . a = ((g2 . a) * q) + 0 by A35, A43;
a in dom g1 by A24, A42, FINSEQ_3:29;
then p * a = (g2 . a) * q by A19, A44;
then A45: q divides p * a by NAT_D:def_3;
a >= 1 by A42, FINSEQ_3:25;
then A46: q <= a by A4, A45, NAT_D:7, PEPIN:3;
a <= (q -' 1) div 2 by A23, A24, A42, FINSEQ_3:25;
hence contradiction by A41, A46, XXREAL_0:2; ::_thesis: verum
end;
then A47: {0} misses rng (g1 mod q) by ZFMISC_1:50;
then A48: Sgm (rng (g1 mod q)) is one-to-one by A32, FINSEQ_3:92, XBOOLE_1:73;
A49: for d, e being Nat st d in dom g1 & e in dom g1 & q divides (g1 . d) - (g1 . e) holds
d = e
proof
A50: q,p are_relative_prime by A3, INT_2:30;
let d, e be Nat; ::_thesis: ( d in dom g1 & e in dom g1 & q divides (g1 . d) - (g1 . e) implies d = e )
assume that
A51: d in dom g1 and
A52: e in dom g1 and
A53: q divides (g1 . d) - (g1 . e) ; ::_thesis: d = e
A54: g1 . e = p * e by A19, A52;
g1 . d = p * d by A19, A51;
then A55: q divides (d - e) * p by A53, A54;
now__::_thesis:_not_d_<>_e
assume d <> e ; ::_thesis: contradiction
then d - e <> 0 ;
then abs q <= abs (d - e) by A55, A50, INT_2:25, INT_4:6;
then A56: q <= abs (d - e) by ABSVALUE:def_1;
A57: e >= 1 by A52, FINSEQ_3:25;
A58: d >= 1 by A51, FINSEQ_3:25;
e <= (q -' 1) div 2 by A23, A52, FINSEQ_3:25;
then A59: d - e >= 1 - ((q -' 1) div 2) by A58, XREAL_1:13;
A60: ((q -' 1) div 2) - 1 < q by A41, XREAL_1:147;
d <= (q -' 1) div 2 by A23, A51, FINSEQ_3:25;
then d - e <= ((q -' 1) div 2) - 1 by A57, XREAL_1:13;
then A61: d - e < q by A60, XXREAL_0:2;
- (((q -' 1) div 2) - 1) > - q by A60, XREAL_1:24;
then d - e > - q by A59, XXREAL_0:2;
hence contradiction by A56, A61, SEQ_2:1; ::_thesis: verum
end;
hence d = e ; ::_thesis: verum
end;
for x, y being set st x in dom (g1 mod q) & y in dom (g1 mod q) & (g1 mod q) . x = (g1 mod q) . y holds
x = y
proof
let x, y be set ; ::_thesis: ( x in dom (g1 mod q) & y in dom (g1 mod q) & (g1 mod q) . x = (g1 mod q) . y implies x = y )
assume that
A62: x in dom (g1 mod q) and
A63: y in dom (g1 mod q) and
A64: (g1 mod q) . x = (g1 mod q) . y ; ::_thesis: x = y
reconsider x = x, y = y as Element of NAT by A62, A63;
A65: g1 . y = ((g2 . y) * q) + ((g1 mod q) . y) by A25, A35, A63;
g1 . x = ((g2 . x) * q) + ((g1 mod q) . x) by A25, A35, A62;
then (g1 . x) - (g1 . y) = ((g2 . x) - (g2 . y)) * q by A64, A65;
then q divides (g1 . x) - (g1 . y) by INT_1:def_3;
hence x = y by A49, A25, A62, A63; ::_thesis: verum
end;
then A66: g1 mod q is one-to-one by FUNCT_1:def_4;
then len (g1 mod q) = card (rng (g1 mod q)) by FINSEQ_4:62;
then A67: len (Sgm (rng (g1 mod q))) = (q -' 1) div 2 by A23, A24, A32, A47, FINSEQ_3:39, XBOOLE_1:73;
reconsider XX = { k where k is Element of NAT : ( k in rng (Sgm (rng (g1 mod q))) & k > q / 2 ) } as finite Subset of NAT by A26, XBOOLE_1:1;
set mm = card XX;
reconsider YY = (rng (Sgm (rng (g1 mod q)))) \ XX as finite Subset of NAT ;
A68: g1 mod q is Element of NAT * by FINSEQ_1:def_11;
len (g1 mod q) = (q -' 1) div 2 by A23, EULER_2:def_1;
then g1 mod q in ((q -' 1) div 2) -tuples_on NAT by A68;
then A69: g1 mod q is Element of ((q -' 1) div 2) -tuples_on REAL by FINSEQ_2:109;
for d being Nat st d in dom (idseq ((q -' 1) div 2)) holds
(idseq ((q -' 1) div 2)) . d in NAT ;
then idseq ((q -' 1) div 2) is FinSequence of NAT by FINSEQ_2:12;
then reconsider N = Sum (idseq ((q -' 1) div 2)) as Element of NAT by Lm4;
A70: 2,q are_relative_prime by A2, EULER_1:2;
dom (q * g2) = dom g2 by VALUED_1:def_5;
then A71: len (q * g2) = (q -' 1) div 2 by A33, FINSEQ_3:29;
q * g2 is Element of NAT * by FINSEQ_1:def_11;
then q * g2 in ((q -' 1) div 2) -tuples_on NAT by A71;
then A72: q * g2 is Element of ((q -' 1) div 2) -tuples_on REAL by FINSEQ_2:109;
A73: dom ((q * g2) + (g1 mod q)) = (dom (q * g2)) /\ (dom (g1 mod q)) by VALUED_1:def_1
.= (dom g2) /\ (dom (g1 mod q)) by VALUED_1:def_5
.= dom g1 by A25, A34 ;
for d being Nat st d in dom g1 holds
g1 . d = ((q * g2) + (g1 mod q)) . d
proof
let d be Nat; ::_thesis: ( d in dom g1 implies g1 . d = ((q * g2) + (g1 mod q)) . d )
assume A74: d in dom g1 ; ::_thesis: g1 . d = ((q * g2) + (g1 mod q)) . d
then A75: d in dom (q * g2) by A34, VALUED_1:def_5;
((q * g2) + (g1 mod q)) . d = ((q * g2) . d) + ((g1 mod q) . d) by A73, A74, VALUED_1:def_1;
hence ((q * g2) + (g1 mod q)) . d = (q * (g2 . d)) + ((g1 mod q) . d) by A75, VALUED_1:def_5
.= g1 . d by A35, A74 ;
::_thesis: verum
end;
then g1 = (q * g2) + (g1 mod q) by A73, FINSEQ_1:13;
then A76: Sum g1 = (Sum (q * g2)) + (Sum (g1 mod q)) by A72, A69, RVSUM_1:89
.= (q * (Sum g2)) + (Sum (g1 mod q)) by RVSUM_1:87 ;
A77: rng (g1 mod q) c= Seg n2 by A32, A47, XBOOLE_1:73;
then A78: rng (Sgm (rng (g1 mod q))) = rng (g1 mod q) by FINSEQ_1:def_13;
then A79: XX c= Seg n2 by A77, A26, XBOOLE_1:1;
A80: len (g1 mod q) = card (rng (Sgm (rng (g1 mod q)))) by A66, A78, FINSEQ_4:62;
card XX <= card (rng (Sgm (rng (g1 mod q)))) by A26, NAT_1:43;
then card XX <= (q -' 1) div 2 by A23, A80, EULER_2:def_1;
then reconsider nn = ((q -' 1) div 2) - (card XX) as Element of NAT by NAT_1:21;
A81: Sgm (rng (g1 mod q)) = ((Sgm (rng (g1 mod q))) | nn) ^ ((Sgm (rng (g1 mod q))) /^ nn) by RFINSEQ:8;
then A82: (Sgm (rng (g1 mod q))) /^ nn is one-to-one by A48, FINSEQ_3:91;
A83: (q -' 1) div 2 = ((q -' 1) + 1) div 2 by A38, NAT_2:26
.= q div 2 by A28, XREAL_1:235 ;
Sgm (rng (g1 mod q)) is FinSequence of REAL by FINSEQ_2:24;
then A84: Sum (Sgm (rng (g1 mod q))) = Sum (g1 mod q) by A66, A78, A48, RFINSEQ:9, RFINSEQ:26;
A85: (rng (Sgm (rng (g1 mod q)))) \ XX c= rng (Sgm (rng (g1 mod q))) by XBOOLE_1:36;
then A86: YY c= Seg n2 by A77, A78, XBOOLE_1:1;
for k, l being Element of NAT st k in YY & l in XX holds
k < l
proof
let k, l be Element of NAT ; ::_thesis: ( k in YY & l in XX implies k < l )
assume that
A87: k in YY and
A88: l in XX ; ::_thesis: k < l
A89: not k in XX by A87, XBOOLE_0:def_5;
A90: ex l1 being Element of NAT st
( l1 = l & l1 in rng (Sgm (rng (g1 mod q))) & l1 > q / 2 ) by A88;
k in rng (Sgm (rng (g1 mod q))) by A87, XBOOLE_0:def_5;
then k <= q / 2 by A89;
hence k < l by A90, XXREAL_0:2; ::_thesis: verum
end;
then Sgm (YY \/ XX) = (Sgm YY) ^ (Sgm XX) by A86, A79, FINSEQ_3:42;
then Sgm ((rng (Sgm (rng (g1 mod q)))) \/ XX) = (Sgm YY) ^ (Sgm XX) by XBOOLE_1:39;
then A91: Sgm (rng (g1 mod q)) = (Sgm YY) ^ (Sgm XX) by A78, A26, XBOOLE_1:12;
then Sum (Sgm (rng (g1 mod q))) = (Sum (Sgm YY)) + (Sum (Sgm XX)) by RVSUM_1:75;
then A92: p * (Sum (idseq ((q -' 1) div 2))) = ((q * (Sum g2)) + (Sum (Sgm YY))) + (Sum (Sgm XX)) by A76, A84, RVSUM_1:87;
A93: len (Sgm YY) = card YY by A77, A78, A85, FINSEQ_3:39, XBOOLE_1:1
.= ((q -' 1) div 2) - (card XX) by A23, A24, A26, A80, CARD_2:44 ;
then A94: (Sgm (rng (g1 mod q))) /^ nn = Sgm XX by A91, FINSEQ_5:37;
for d being Nat st d in dom f2 holds
f2 . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom f2 implies f2 . d in NAT )
assume d in dom f2 ; ::_thesis: f2 . d in NAT
then f2 . d = (f1 . d) div p by A27;
hence f2 . d in NAT ; ::_thesis: verum
end;
then reconsider f2 = f2 as FinSequence of NAT by FINSEQ_2:12;
set f3 = f1 mod p;
A95: len (f1 mod p) = len f1 by EULER_2:def_1;
then A96: dom f1 = dom (f1 mod p) by FINSEQ_3:29;
set f4 = Sgm (rng (f1 mod p));
p >= 2 + 1 by A1, NAT_1:13;
then A97: p - 1 >= 3 - 1 by XREAL_1:9;
then f1 mod p <> {} by A18, A7, A95, NAT_2:13;
then rng (f1 mod p) is non empty finite Subset of NAT by FINSEQ_1:def_4;
then consider n1 being Element of NAT such that
A98: rng (f1 mod p) c= (Seg n1) \/ {0} by HEYTING3:1;
A99: dom f1 = dom f2 by A18, A27, FINSEQ_3:29;
A100: for d being Nat st d in dom f1 holds
f1 . d = ((f2 . d) * p) + ((f1 mod p) . d)
proof
let d be Nat; ::_thesis: ( d in dom f1 implies f1 . d = ((f2 . d) * p) + ((f1 mod p) . d) )
assume A101: d in dom f1 ; ::_thesis: f1 . d = ((f2 . d) * p) + ((f1 mod p) . d)
then A102: (f1 mod p) . d = (f1 . d) mod p by EULER_2:def_1;
f2 . d = (f1 . d) div p by A27, A99, A101;
hence f1 . d = ((f2 . d) * p) + ((f1 mod p) . d) by A102, NAT_D:2; ::_thesis: verum
end;
not 0 in rng (f1 mod p)
proof
assume 0 in rng (f1 mod p) ; ::_thesis: contradiction
then consider a being Nat such that
A103: a in dom (f1 mod p) and
A104: (f1 mod p) . a = 0 by FINSEQ_2:10;
f1 . a = ((f2 . a) * p) + 0 by A96, A100, A103, A104;
then q * a = (f2 . a) * p by A13, A96, A103;
then A105: p divides q * a by NAT_D:def_3;
a >= 1 by A103, FINSEQ_3:25;
then A106: p <= a by A4, A105, NAT_D:7, PEPIN:3;
a <= (p -' 1) div 2 by A18, A95, A103, FINSEQ_3:25;
hence contradiction by A12, A106, XXREAL_0:2; ::_thesis: verum
end;
then A107: {0} misses rng (f1 mod p) by ZFMISC_1:50;
then A108: Sgm (rng (f1 mod p)) is one-to-one by A98, FINSEQ_3:92, XBOOLE_1:73;
A109: for d, e being Nat st d in dom f1 & e in dom f1 & p divides (f1 . d) - (f1 . e) holds
d = e
proof
A110: q,p are_relative_prime by A3, INT_2:30;
let d, e be Nat; ::_thesis: ( d in dom f1 & e in dom f1 & p divides (f1 . d) - (f1 . e) implies d = e )
assume that
A111: d in dom f1 and
A112: e in dom f1 and
A113: p divides (f1 . d) - (f1 . e) ; ::_thesis: d = e
A114: f1 . e = q * e by A13, A112;
f1 . d = q * d by A13, A111;
then A115: p divides (d - e) * q by A113, A114;
now__::_thesis:_not_d_<>_e
assume d <> e ; ::_thesis: contradiction
then d - e <> 0 ;
then abs p <= abs (d - e) by A115, A110, INT_2:25, INT_4:6;
then A116: p <= abs (d - e) by ABSVALUE:def_1;
A117: e >= 1 by A112, FINSEQ_3:25;
A118: d >= 1 by A111, FINSEQ_3:25;
e <= (p -' 1) div 2 by A18, A112, FINSEQ_3:25;
then A119: d - e >= 1 - ((p -' 1) div 2) by A118, XREAL_1:13;
A120: ((p -' 1) div 2) - 1 < p by A12, XREAL_1:147;
d <= (p -' 1) div 2 by A18, A111, FINSEQ_3:25;
then d - e <= ((p -' 1) div 2) - 1 by A117, XREAL_1:13;
then A121: d - e < p by A120, XXREAL_0:2;
- (((p -' 1) div 2) - 1) > - p by A120, XREAL_1:24;
then d - e > - p by A119, XXREAL_0:2;
hence contradiction by A116, A121, SEQ_2:1; ::_thesis: verum
end;
hence d = e ; ::_thesis: verum
end;
for x, y being set st x in dom (f1 mod p) & y in dom (f1 mod p) & (f1 mod p) . x = (f1 mod p) . y holds
x = y
proof
let x, y be set ; ::_thesis: ( x in dom (f1 mod p) & y in dom (f1 mod p) & (f1 mod p) . x = (f1 mod p) . y implies x = y )
assume that
A122: x in dom (f1 mod p) and
A123: y in dom (f1 mod p) and
A124: (f1 mod p) . x = (f1 mod p) . y ; ::_thesis: x = y
reconsider x = x, y = y as Element of NAT by A122, A123;
A125: f1 . y = ((f2 . y) * p) + ((f1 mod p) . y) by A96, A100, A123;
f1 . x = ((f2 . x) * p) + ((f1 mod p) . x) by A96, A100, A122;
then (f1 . x) - (f1 . y) = ((f2 . x) - (f2 . y)) * p by A124, A125;
then p divides (f1 . x) - (f1 . y) by INT_1:def_3;
hence x = y by A109, A96, A122, A123; ::_thesis: verum
end;
then A126: f1 mod p is one-to-one by FUNCT_1:def_4;
then len (f1 mod p) = card (rng (f1 mod p)) by FINSEQ_4:62;
then A127: len (Sgm (rng (f1 mod p))) = (p -' 1) div 2 by A18, A95, A98, A107, FINSEQ_3:39, XBOOLE_1:73;
A128: (Sgm (rng (g1 mod q))) | nn = Sgm YY by A91, A93, FINSEQ_3:113, FINSEQ_6:10;
A129: (Sgm (rng (g1 mod q))) | nn is one-to-one by A48, A81, FINSEQ_3:91;
A130: Lege (p,q) = (- 1) |^ (Sum g2)
proof
set g5 = ((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn);
set g6 = ((Sgm (rng (g1 mod q))) | nn) ^ (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn));
A131: rng (idseq ((q -' 1) div 2)) = Seg ((q -' 1) div 2) by RELAT_1:45;
A132: (Sgm (rng (g1 mod q))) /^ nn is FinSequence of REAL by FINSEQ_2:24;
A133: len ((Sgm (rng (g1 mod q))) | nn) = nn by A67, FINSEQ_1:59, XREAL_1:43;
A134: len ((Sgm (rng (g1 mod q))) /^ nn) = (len (Sgm (rng (g1 mod q)))) -' nn by RFINSEQ:29
.= (len (Sgm (rng (g1 mod q)))) - nn by A67, XREAL_1:43, XREAL_1:233
.= card XX by A67 ;
A135: dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) = (dom ((card XX) |-> q)) /\ (dom ((Sgm (rng (g1 mod q))) /^ nn)) by VALUED_1:12
.= (Seg (len ((card XX) |-> q))) /\ (dom ((Sgm (rng (g1 mod q))) /^ nn)) by FINSEQ_1:def_3
.= (Seg (len ((Sgm (rng (g1 mod q))) /^ nn))) /\ (dom ((Sgm (rng (g1 mod q))) /^ nn)) by A134, CARD_1:def_7
.= (dom ((Sgm (rng (g1 mod q))) /^ nn)) /\ (dom ((Sgm (rng (g1 mod q))) /^ nn)) by FINSEQ_1:def_3
.= dom ((Sgm (rng (g1 mod q))) /^ nn) ;
then A136: len (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) = len ((Sgm (rng (g1 mod q))) /^ nn) by FINSEQ_3:29;
A137: for d being Nat st d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) holds
(((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d)
proof
let d be Nat; ::_thesis: ( d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) implies (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d) )
assume A138: d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) ; ::_thesis: (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d)
then d in Seg (card XX) by A134, A135, FINSEQ_1:def_3;
then ((card XX) |-> q) . d = q by FINSEQ_2:57;
hence (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d) by A138, VALUED_1:13; ::_thesis: verum
end;
A139: for d being Nat st d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) holds
( (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d > 0 & (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d <= (q -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) implies ( (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d > 0 & (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d <= (q -' 1) div 2 ) )
reconsider w = (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d as Element of INT by INT_1:def_2;
assume A140: d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) ; ::_thesis: ( (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d > 0 & (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d <= (q -' 1) div 2 )
then (Sgm XX) . d in rng (Sgm XX) by A94, A135, FUNCT_1:3;
then (Sgm XX) . d in XX by A79, FINSEQ_1:def_13;
then A141: ex ll being Element of NAT st
( ll = (Sgm XX) . d & ll in rng (g1 mod q) & ll > q / 2 ) by A78;
then consider e being Nat such that
A142: e in dom (g1 mod q) and
A143: (g1 mod q) . e = ((Sgm (rng (g1 mod q))) /^ nn) . d by A94, FINSEQ_2:10;
((Sgm (rng (g1 mod q))) /^ nn) . d = (g1 . e) mod q by A25, A142, A143, EULER_2:def_1;
then A144: ((Sgm (rng (g1 mod q))) /^ nn) . d < q by NAT_D:1;
A145: (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d) by A137, A140;
then w < q - (q / 2) by A94, A141, XREAL_1:10;
hence ( (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d > 0 & (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d <= (q -' 1) div 2 ) by A83, A145, A144, INT_1:54, XREAL_1:50; ::_thesis: verum
end;
A146: rng (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) c= INT by RELAT_1:def_19;
for d being Nat st d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) holds
(((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) implies (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d in NAT )
assume A147: d in dom (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) ; ::_thesis: (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d in NAT
(((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d > 0 by A139, A147;
hence (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) . d in NAT by A146, INT_1:3; ::_thesis: verum
end;
then reconsider g5 = ((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn) as FinSequence of NAT by FINSEQ_2:12;
g5 is FinSequence of NAT ;
then reconsider g6 = ((Sgm (rng (g1 mod q))) | nn) ^ (((card XX) |-> q) - ((Sgm (rng (g1 mod q))) /^ nn)) as FinSequence of NAT by FINSEQ_1:75;
A148: g6 is FinSequence of REAL by FINSEQ_2:24;
A149: nn <= len (Sgm (rng (g1 mod q))) by A67, XREAL_1:43;
A150: rng ((Sgm (rng (g1 mod q))) | nn) misses rng g5
proof
assume not rng ((Sgm (rng (g1 mod q))) | nn) misses rng g5 ; ::_thesis: contradiction
then consider x being set such that
A151: x in rng ((Sgm (rng (g1 mod q))) | nn) and
A152: x in rng g5 by XBOOLE_0:3;
consider e being Nat such that
A153: e in dom g5 and
A154: g5 . e = x by A152, FINSEQ_2:10;
x = q - (((Sgm (rng (g1 mod q))) /^ nn) . e) by A137, A153, A154;
then A155: x = q - ((Sgm (rng (g1 mod q))) . (e + nn)) by A149, A135, A153, RFINSEQ:def_1;
e + nn in dom (Sgm (rng (g1 mod q))) by A135, A153, FINSEQ_5:26;
then consider e1 being Nat such that
A156: e1 in dom (g1 mod q) and
A157: (g1 mod q) . e1 = (Sgm (rng (g1 mod q))) . (e + nn) by A78, FINSEQ_2:10, FUNCT_1:3;
A158: e1 <= (q -' 1) div 2 by A23, A24, A156, FINSEQ_3:25;
rng ((Sgm (rng (g1 mod q))) | nn) c= rng (Sgm (rng (g1 mod q))) by FINSEQ_5:19;
then consider d1 being Nat such that
A159: d1 in dom (g1 mod q) and
A160: (g1 mod q) . d1 = x by A78, A151, FINSEQ_2:10;
d1 <= (q -' 1) div 2 by A23, A24, A159, FINSEQ_3:25;
then d1 + e1 <= ((q -' 1) div 2) + ((q -' 1) div 2) by A158, XREAL_1:7;
then A161: d1 + e1 < q by A29, A40, XREAL_1:146, XXREAL_0:2;
A162: e1 in dom g1 by A24, A156, FINSEQ_3:29;
then A163: (Sgm (rng (g1 mod q))) . (e + nn) = (g1 . e1) mod q by A157, EULER_2:def_1;
A164: d1 in dom g1 by A24, A159, FINSEQ_3:29;
then x = (g1 . d1) mod q by A160, EULER_2:def_1;
then (((g1 . d1) mod q) + ((g1 . e1) mod q)) mod q = 0 by A155, A163, NAT_D:25;
then ((g1 . d1) + (g1 . e1)) mod q = 0 by EULER_2:6;
then q divides (g1 . d1) + (g1 . e1) by PEPIN:6;
then q divides (d1 * p) + (g1 . e1) by A19, A164;
then q divides (d1 * p) + (e1 * p) by A19, A162;
then A165: q divides (d1 + e1) * p ;
d1 >= 1 by A159, FINSEQ_3:25;
hence contradiction by A4, A165, A161, NAT_D:7, PEPIN:3; ::_thesis: verum
end;
for d, e being Element of NAT st 1 <= d & d < e & e <= len g5 holds
g5 . d <> g5 . e
proof
let d, e be Element of NAT ; ::_thesis: ( 1 <= d & d < e & e <= len g5 implies g5 . d <> g5 . e )
assume that
A166: 1 <= d and
A167: d < e and
A168: e <= len g5 ; ::_thesis: g5 . d <> g5 . e
1 <= e by A166, A167, XXREAL_0:2;
then A169: e in dom g5 by A168, FINSEQ_3:25;
then A170: g5 . e = q - (((Sgm (rng (g1 mod q))) /^ nn) . e) by A137;
d < len g5 by A167, A168, XXREAL_0:2;
then A171: d in dom g5 by A166, FINSEQ_3:25;
then g5 . d = q - (((Sgm (rng (g1 mod q))) /^ nn) . d) by A137;
hence g5 . d <> g5 . e by A82, A135, A167, A171, A169, A170, FUNCT_1:def_4; ::_thesis: verum
end;
then len g5 = card (rng g5) by GRAPH_5:7;
then g5 is one-to-one by FINSEQ_4:62;
then A172: g6 is one-to-one by A129, A150, FINSEQ_3:91;
A173: for d being Nat st d in dom g6 holds
( g6 . d > 0 & g6 . d <= (q -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom g6 implies ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 ) )
assume A174: d in dom g6 ; ::_thesis: ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 )
percases ( d in dom ((Sgm (rng (g1 mod q))) | nn) or ex l being Nat st
( l in dom g5 & d = (len ((Sgm (rng (g1 mod q))) | nn)) + l ) ) by A174, FINSEQ_1:25;
supposeA175: d in dom ((Sgm (rng (g1 mod q))) | nn) ; ::_thesis: ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 )
then ((Sgm (rng (g1 mod q))) | nn) . d in rng (Sgm YY) by A128, FUNCT_1:3;
then A176: ((Sgm (rng (g1 mod q))) | nn) . d in YY by A86, FINSEQ_1:def_13;
then A177: ((Sgm (rng (g1 mod q))) | nn) . d in rng (Sgm (rng (g1 mod q))) by XBOOLE_0:def_5;
not ((Sgm (rng (g1 mod q))) | nn) . d in XX by A176, XBOOLE_0:def_5;
then ((Sgm (rng (g1 mod q))) | nn) . d <= q / 2 by A177;
then A178: ((Sgm (rng (g1 mod q))) | nn) . d <= (q -' 1) div 2 by A83, INT_1:54;
not ((Sgm (rng (g1 mod q))) | nn) . d in {0} by A47, A78, A177, XBOOLE_0:3;
then ((Sgm (rng (g1 mod q))) | nn) . d <> 0 by TARSKI:def_1;
hence ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 ) by A175, A178, FINSEQ_1:def_7; ::_thesis: verum
end;
suppose ex l being Nat st
( l in dom g5 & d = (len ((Sgm (rng (g1 mod q))) | nn)) + l ) ; ::_thesis: ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 )
then consider l being Element of NAT such that
A179: l in dom g5 and
A180: d = (len ((Sgm (rng (g1 mod q))) | nn)) + l ;
g6 . d = g5 . l by A179, A180, FINSEQ_1:def_7;
hence ( g6 . d > 0 & g6 . d <= (q -' 1) div 2 ) by A139, A179; ::_thesis: verum
end;
end;
end;
A181: idseq ((q -' 1) div 2) is FinSequence of REAL by RVSUM_1:145;
len g6 = (len ((Sgm (rng (g1 mod q))) | nn)) + (len g5) by FINSEQ_1:22
.= (q -' 1) div 2 by A133, A134, A136 ;
then rng g6 = rng (idseq ((q -' 1) div 2)) by A131, A172, A173, Th40;
then N = Sum g6 by A172, A148, A181, RFINSEQ:9, RFINSEQ:26
.= (Sum ((Sgm (rng (g1 mod q))) | nn)) + (Sum g5) by RVSUM_1:75
.= (Sum ((Sgm (rng (g1 mod q))) | nn)) + (((card XX) * q) - (Sum ((Sgm (rng (g1 mod q))) /^ nn))) by A134, A132, Th47
.= ((Sum ((Sgm (rng (g1 mod q))) | nn)) + ((card XX) * q)) - (Sum ((Sgm (rng (g1 mod q))) /^ nn)) ;
then (p - 1) * N = ((q * (Sum g2)) + (2 * (Sum (Sgm XX)))) - ((card XX) * q) by A92, A94, A128;
then A182: ((p -' 1) * N) mod 2 = (((q * (Sum g2)) - ((card XX) * q)) + (2 * (Sum (Sgm XX)))) mod 2 by A6, XREAL_1:233
.= ((q * (Sum g2)) - ((card XX) * q)) mod 2 by EULER_1:12 ;
2 divides (p -' 1) * N by A10, NAT_D:9;
then (q * ((Sum g2) - (card XX))) mod 2 = 0 by A182, PEPIN:6;
then 2 divides q * ((Sum g2) - (card XX)) by Lm1;
then 2 divides (Sum g2) - (card XX) by A70, INT_2:25;
then Sum g2, card XX are_congruent_mod 2 by INT_2:15;
then (Sum g2) mod 2 = (card XX) mod 2 by NAT_D:64;
then (- 1) |^ (Sum g2) = (- 1) |^ (card XX) by Th45;
hence Lege (p,q) = (- 1) |^ (Sum g2) by A2, A5, A78, Th41; ::_thesis: verum
end;
for d being Nat st d in dom (idseq ((p -' 1) div 2)) holds
(idseq ((p -' 1) div 2)) . d in NAT ;
then idseq ((p -' 1) div 2) is FinSequence of NAT by FINSEQ_2:12;
then reconsider M = Sum (idseq ((p -' 1) div 2)) as Element of NAT by Lm4;
A183: 2,p are_relative_prime by A1, EULER_1:2;
set X = { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } ;
for x being set st x in { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } holds
x in rng (Sgm (rng (f1 mod p)))
proof
let x be set ; ::_thesis: ( x in { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } implies x in rng (Sgm (rng (f1 mod p))) )
assume x in { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } ; ::_thesis: x in rng (Sgm (rng (f1 mod p)))
then ex k being Element of NAT st
( x = k & k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) ;
hence x in rng (Sgm (rng (f1 mod p))) ; ::_thesis: verum
end;
then A184: { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } c= rng (Sgm (rng (f1 mod p))) by TARSKI:def_3;
A185: (p -' 1) div 2 >= 1 by A7, A97, NAT_2:13;
A186: (Sum f2) + (Sum g2) = ((p -' 1) div 2) * ((q -' 1) div 2)
proof
reconsider A = Seg ((p -' 1) div 2), B = Seg ((q -' 1) div 2) as non empty finite Subset of NAT by A185, A31;
deffunc H3( Element of A, Element of B) -> set = ($1 / p) - ($2 / q);
A187: for x being Element of A
for y being Element of B holds H3(x,y) in REAL by XREAL_0:def_1;
consider z being Function of [:A,B:],REAL such that
A188: for x being Element of A
for y being Element of B holds z . (x,y) = H3(x,y) from FUNCT_7:sch_1(A187);
defpred S1[ set , set ] means ex x being Element of A st
( $1 = x & $2 = { [x,y] where y is Element of B : z . (x,y) > 0 } );
A189: for d being Nat st d in Seg ((p -' 1) div 2) holds
ex x1 being Element of bool (dom z) st S1[d,x1]
proof
let d be Nat; ::_thesis: ( d in Seg ((p -' 1) div 2) implies ex x1 being Element of bool (dom z) st S1[d,x1] )
assume d in Seg ((p -' 1) div 2) ; ::_thesis: ex x1 being Element of bool (dom z) st S1[d,x1]
then reconsider d = d as Element of A ;
take x1 = { [d,y] where y is Element of B : z . (d,y) > 0 } ; ::_thesis: ( x1 is Element of bool (dom z) & S1[d,x1] )
x1 c= dom z
proof
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in x1 or l in dom z )
assume l in x1 ; ::_thesis: l in dom z
then ex yy being Element of B st
( [d,yy] = l & z . (d,yy) > 0 ) ;
then l in [:A,B:] ;
hence l in dom z by FUNCT_2:def_1; ::_thesis: verum
end;
hence ( x1 is Element of bool (dom z) & S1[d,x1] ) ; ::_thesis: verum
end;
consider Pr being FinSequence of bool (dom z) such that
A190: ( dom Pr = Seg ((p -' 1) div 2) & ( for d being Nat st d in Seg ((p -' 1) div 2) holds
S1[d,Pr . d] ) ) from FINSEQ_1:sch_5(A189);
A191: dom (Card Pr) = dom Pr by CARD_3:def_2
.= dom f2 by A27, A190, FINSEQ_1:def_3 ;
for d being Nat st d in dom (Card Pr) holds
(Card Pr) . d = f2 . d
proof
let d be Nat; ::_thesis: ( d in dom (Card Pr) implies (Card Pr) . d = f2 . d )
assume A192: d in dom (Card Pr) ; ::_thesis: (Card Pr) . d = f2 . d
then d in Seg ((p -' 1) div 2) by A27, A191, FINSEQ_1:def_3;
then consider m being Element of A such that
A193: m = d and
A194: Pr . d = { [m,y] where y is Element of B : z . (m,y) > 0 } by A190;
Pr . d = [:{m},(Seg (f2 . m)):]
proof
set L = [:{m},(Seg (f2 . m)):];
A195: [:{m},(Seg (f2 . m)):] c= Pr . d
proof
now__::_thesis:_not_q_mod_p_=_0
assume q mod p = 0 ; ::_thesis: contradiction
then A196: p divides q by PEPIN:6;
then p <= q by NAT_D:7;
then p < q by A3, XXREAL_0:1;
hence contradiction by A6, A196, NAT_4:12; ::_thesis: verum
end;
then A197: - (q div p) = ((- q) div p) + 1 by WSIERP_1:41;
2 divides (p -' 1) * q by A10, NAT_D:9;
then ((p -' 1) * q) mod 2 = 0 by PEPIN:6;
then ((p -' 1) * q) div 2 = ((p -' 1) * q) / 2 by REAL_3:4;
then A198: (((p -' 1) div 2) * q) div p = ((p - 1) * q) div (2 * p) by A7, A11, NAT_2:27
.= (((p * q) - q) div p) div 2 by PRE_FF:5
.= (q + ((- (q div p)) - 1)) div 2 by A197, NAT_D:61
.= ((2 * ((q -' 1) div 2)) + (- (q div p))) div 2 by A29, A40
.= ((q -' 1) div 2) + ((- (q div p)) div 2) by NAT_D:61 ;
A199: (((p -' 1) div 2) * q) div p <= (q -' 1) div 2
proof
percases ( (q div p) mod 2 = 0 or (q div p) mod 2 <> 0 ) ;
suppose (q div p) mod 2 = 0 ; ::_thesis: (((p -' 1) div 2) * q) div p <= (q -' 1) div 2
then (- (q div p)) div 2 = - ((q div p) div 2) by WSIERP_1:42
.= - (q div (2 * p)) by NAT_2:27 ;
then (((p -' 1) div 2) * q) div p = ((q -' 1) div 2) - (q div (2 * p)) by A198;
hence (((p -' 1) div 2) * q) div p <= (q -' 1) div 2 by XREAL_1:43; ::_thesis: verum
end;
suppose (q div p) mod 2 <> 0 ; ::_thesis: (((p -' 1) div 2) * q) div p <= (q -' 1) div 2
then - ((q div p) div 2) = ((- (q div p)) div 2) + 1 by WSIERP_1:41;
then (- (q div p)) div 2 = (- ((q div p) div 2)) - 1
.= (- (q div (2 * p))) - 1 by NAT_2:27 ;
then (((p -' 1) div 2) * q) div p = ((q -' 1) div 2) - ((q div (2 * p)) + 1) by A198;
hence (((p -' 1) div 2) * q) div p <= (q -' 1) div 2 by XREAL_1:43; ::_thesis: verum
end;
end;
end;
m <= (p -' 1) div 2 by FINSEQ_1:1;
then m * q <= ((p -' 1) div 2) * q by XREAL_1:64;
then (m * q) div p <= (((p -' 1) div 2) * q) div p by NAT_2:24;
then A200: (m * q) div p <= (q -' 1) div 2 by A199, XXREAL_0:2;
m in Seg ((p -' 1) div 2) ;
then A201: m in dom f1 by A18, FINSEQ_1:def_3;
then A202: f2 . m = (f1 . m) div p by A27, A99
.= (m * q) div p by A13, A201 ;
now__::_thesis:_not_(m_*_q)_/_p_is_integer
assume (m * q) / p is integer ; ::_thesis: contradiction
then A203: p divides m * q by WSIERP_1:17;
A204: m <= (p -' 1) div 2 by FINSEQ_1:1;
0 + 1 <= m by FINSEQ_1:1;
then p <= m by A5, A203, NAT_D:7, WSIERP_1:30;
hence contradiction by A12, A204, XXREAL_0:2; ::_thesis: verum
end;
then A205: [\((m * q) / p)/] < (m * q) / p by INT_1:26;
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in [:{m},(Seg (f2 . m)):] or l in Pr . d )
assume l in [:{m},(Seg (f2 . m)):] ; ::_thesis: l in Pr . d
then consider x, y being set such that
A206: x in {m} and
A207: y in Seg (f2 . m) and
A208: l = [x,y] by ZFMISC_1:def_2;
reconsider y = y as Element of NAT by A207;
A209: 1 <= y by A207, FINSEQ_1:1;
y <= f2 . m by A207, FINSEQ_1:1;
then y <= (q -' 1) div 2 by A200, A202, XXREAL_0:2;
then reconsider y = y as Element of B by A209, FINSEQ_1:1;
y <= [\((m * q) / p)/] by A207, A202, FINSEQ_1:1;
then y < (m * q) / p by A205, XXREAL_0:2;
then y * p < ((m * q) / p) * p by XREAL_1:68;
then y * p < m * q by XCMPLX_1:87;
then y / q < m / p by XREAL_1:106;
then (m / p) - (y / q) > 0 by XREAL_1:50;
then z . (m,y) > 0 by A188;
then [m,y] in Pr . d by A194;
hence l in Pr . d by A206, A208, TARSKI:def_1; ::_thesis: verum
end;
Pr . d c= [:{m},(Seg (f2 . m)):]
proof
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in Pr . d or l in [:{m},(Seg (f2 . m)):] )
A210: m in {m} by TARSKI:def_1;
m in Seg ((p -' 1) div 2) ;
then A211: m in dom f1 by A18, FINSEQ_1:def_3;
assume l in Pr . d ; ::_thesis: l in [:{m},(Seg (f2 . m)):]
then consider y1 being Element of B such that
A212: l = [m,y1] and
A213: z . (m,y1) > 0 by A194;
(m / p) - (y1 / q) > 0 by A188, A213;
then ((m / p) - (y1 / q)) + (y1 / q) > 0 + (y1 / q) by XREAL_1:6;
then (m / p) * q > (y1 / q) * q by XREAL_1:68;
then (m * q) / p > y1 by XCMPLX_1:87;
then (m * q) div p >= y1 by INT_1:54;
then (f1 . m) div p >= y1 by A13, A211;
then A214: y1 <= f2 . m by A27, A99, A211;
y1 >= 1 by FINSEQ_1:1;
then y1 in Seg (f2 . m) by A214, FINSEQ_1:1;
hence l in [:{m},(Seg (f2 . m)):] by A212, A210, ZFMISC_1:def_2; ::_thesis: verum
end;
hence Pr . d = [:{m},(Seg (f2 . m)):] by A195, XBOOLE_0:def_10; ::_thesis: verum
end;
then card (Pr . d) = card [:(Seg (f2 . m)),{m}:] by CARD_2:4
.= card (Seg (f2 . m)) by CARD_1:69 ;
then A215: card (Pr . d) = card (f2 . d) by A193, FINSEQ_1:55
.= f2 . d by CARD_1:def_2 ;
d in dom Pr by A192, CARD_3:def_2;
hence (Card Pr) . d = f2 . d by A215, CARD_3:def_2; ::_thesis: verum
end;
then A216: Card Pr = f2 by A191, FINSEQ_1:13;
defpred S2[ set , set ] means ex y being Element of B st
( $1 = y & $2 = { [x,y] where x is Element of A : z . (x,y) < 0 } );
A217: for d being Nat st d in Seg ((q -' 1) div 2) holds
ex x1 being Element of bool (dom z) st S2[d,x1]
proof
let d be Nat; ::_thesis: ( d in Seg ((q -' 1) div 2) implies ex x1 being Element of bool (dom z) st S2[d,x1] )
assume d in Seg ((q -' 1) div 2) ; ::_thesis: ex x1 being Element of bool (dom z) st S2[d,x1]
then reconsider d = d as Element of B ;
take x1 = { [x,d] where x is Element of A : z . (x,d) < 0 } ; ::_thesis: ( x1 is Element of bool (dom z) & S2[d,x1] )
x1 c= dom z
proof
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in x1 or l in dom z )
assume l in x1 ; ::_thesis: l in dom z
then ex xx being Element of A st
( [xx,d] = l & z . (xx,d) < 0 ) ;
then l in [:A,B:] ;
hence l in dom z by FUNCT_2:def_1; ::_thesis: verum
end;
hence ( x1 is Element of bool (dom z) & S2[d,x1] ) ; ::_thesis: verum
end;
consider Pk being FinSequence of bool (dom z) such that
A218: ( dom Pk = Seg ((q -' 1) div 2) & ( for d being Nat st d in Seg ((q -' 1) div 2) holds
S2[d,Pk . d] ) ) from FINSEQ_1:sch_5(A217);
A219: dom (Card Pk) = Seg (len g2) by A33, A218, CARD_3:def_2
.= dom g2 by FINSEQ_1:def_3 ;
A220: for d being Nat st d in dom (Card Pk) holds
(Card Pk) . d = g2 . d
proof
let d be Nat; ::_thesis: ( d in dom (Card Pk) implies (Card Pk) . d = g2 . d )
assume A221: d in dom (Card Pk) ; ::_thesis: (Card Pk) . d = g2 . d
then d in Seg ((q -' 1) div 2) by A33, A219, FINSEQ_1:def_3;
then consider n being Element of B such that
A222: n = d and
A223: Pk . d = { [x,n] where x is Element of A : z . (x,n) < 0 } by A218;
Pk . d = [:(Seg (g2 . n)),{n}:]
proof
set L = [:(Seg (g2 . n)),{n}:];
A224: [:(Seg (g2 . n)),{n}:] c= Pk . d
proof
now__::_thesis:_not_p_mod_q_=_0
assume p mod q = 0 ; ::_thesis: contradiction
then A225: q divides p by PEPIN:6;
then q <= p by NAT_D:7;
then q < p by A3, XXREAL_0:1;
hence contradiction by A28, A225, NAT_4:12; ::_thesis: verum
end;
then A226: - (p div q) = ((- p) div q) + 1 by WSIERP_1:41;
2 divides (q -' 1) * p by A39, NAT_D:9;
then ((q -' 1) * p) mod 2 = 0 by PEPIN:6;
then ((q -' 1) * p) div 2 = ((q -' 1) * p) / 2 by REAL_3:4;
then A227: (((q -' 1) div 2) * p) div q = ((q - 1) * p) div (2 * q) by A29, A40, NAT_2:27
.= (((q * p) - p) div q) div 2 by PRE_FF:5
.= (p + ((- (p div q)) - 1)) div 2 by A226, NAT_D:61
.= ((2 * ((p -' 1) div 2)) - (p div q)) div 2 by A7, A11
.= ((p -' 1) div 2) + ((- (p div q)) div 2) by NAT_D:61 ;
A228: (((q -' 1) div 2) * p) div q <= (p -' 1) div 2
proof
percases ( (p div q) mod 2 = 0 or (p div q) mod 2 <> 0 ) ;
suppose (p div q) mod 2 = 0 ; ::_thesis: (((q -' 1) div 2) * p) div q <= (p -' 1) div 2
then (- (p div q)) div 2 = - ((p div q) div 2) by WSIERP_1:42
.= - (p div (2 * q)) by NAT_2:27 ;
then (((q -' 1) div 2) * p) div q = ((p -' 1) div 2) - (p div (2 * q)) by A227;
hence (((q -' 1) div 2) * p) div q <= (p -' 1) div 2 by XREAL_1:43; ::_thesis: verum
end;
suppose (p div q) mod 2 <> 0 ; ::_thesis: (((q -' 1) div 2) * p) div q <= (p -' 1) div 2
then - ((p div q) div 2) = ((- (p div q)) div 2) + 1 by WSIERP_1:41;
then (- (p div q)) div 2 = (- ((p div q) div 2)) - 1
.= (- (p div (2 * q))) - 1 by NAT_2:27 ;
then (((q -' 1) div 2) * p) div q = ((p -' 1) div 2) - ((p div (2 * q)) + 1) by A227;
hence (((q -' 1) div 2) * p) div q <= (p -' 1) div 2 by XREAL_1:43; ::_thesis: verum
end;
end;
end;
n in Seg ((q -' 1) div 2) ;
then A229: n in dom g1 by A23, FINSEQ_1:def_3;
then A230: g2 . n = (g1 . n) div q by A33, A34
.= (n * p) div q by A19, A229 ;
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in [:(Seg (g2 . n)),{n}:] or l in Pk . d )
assume l in [:(Seg (g2 . n)),{n}:] ; ::_thesis: l in Pk . d
then consider x, y being set such that
A231: x in Seg (g2 . n) and
A232: y in {n} and
A233: l = [x,y] by ZFMISC_1:def_2;
reconsider x = x as Element of NAT by A231;
A234: x <= g2 . n by A231, FINSEQ_1:1;
n <= (q -' 1) div 2 by FINSEQ_1:1;
then n * p <= ((q -' 1) div 2) * p by XREAL_1:64;
then (n * p) div q <= (((q -' 1) div 2) * p) div q by NAT_2:24;
then (n * p) div q <= (p -' 1) div 2 by A228, XXREAL_0:2;
then A235: x <= (p -' 1) div 2 by A230, A234, XXREAL_0:2;
1 <= x by A231, FINSEQ_1:1;
then reconsider x = x as Element of A by A235, FINSEQ_1:1;
now__::_thesis:_not_(n_*_p)_/_q_is_integer
assume (n * p) / q is integer ; ::_thesis: contradiction
then A236: q divides n * p by WSIERP_1:17;
A237: n <= (q -' 1) div 2 by FINSEQ_1:1;
0 + 1 <= n by FINSEQ_1:1;
then q <= n by A5, A236, NAT_D:7, WSIERP_1:30;
hence contradiction by A41, A237, XXREAL_0:2; ::_thesis: verum
end;
then [\((n * p) / q)/] < (n * p) / q by INT_1:26;
then x < (n * p) / q by A230, A234, XXREAL_0:2;
then x * q < ((n * p) / q) * q by XREAL_1:68;
then x * q < n * p by XCMPLX_1:87;
then (x / p) - (n / q) < 0 by XREAL_1:49, XREAL_1:106;
then z . (x,n) < 0 by A188;
then [x,n] in Pk . d by A223;
hence l in Pk . d by A232, A233, TARSKI:def_1; ::_thesis: verum
end;
Pk . d c= [:(Seg (g2 . n)),{n}:]
proof
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in Pk . d or l in [:(Seg (g2 . n)),{n}:] )
A238: n in {n} by TARSKI:def_1;
n in Seg ((q -' 1) div 2) ;
then A239: n in dom g1 by A23, FINSEQ_1:def_3;
assume l in Pk . d ; ::_thesis: l in [:(Seg (g2 . n)),{n}:]
then consider x being Element of A such that
A240: l = [x,n] and
A241: z . (x,n) < 0 by A223;
(x / p) - (n / q) < 0 by A188, A241;
then ((x / p) - (n / q)) + (n / q) < 0 + (n / q) by XREAL_1:6;
then (x / p) * p < (n / q) * p by XREAL_1:68;
then x < (n * p) / q by XCMPLX_1:87;
then x <= (n * p) div q by INT_1:54;
then (g1 . n) div q >= x by A19, A239;
then A242: x <= g2 . n by A33, A34, A239;
x >= 1 by FINSEQ_1:1;
then x in Seg (g2 . n) by A242, FINSEQ_1:1;
hence l in [:(Seg (g2 . n)),{n}:] by A240, A238, ZFMISC_1:def_2; ::_thesis: verum
end;
hence Pk . d = [:(Seg (g2 . n)),{n}:] by A224, XBOOLE_0:def_10; ::_thesis: verum
end;
then card (Pk . d) = card (Seg (g2 . n)) by CARD_1:69;
then A243: card (Pk . d) = card (g2 . d) by A222, FINSEQ_1:55
.= g2 . d by CARD_1:def_2 ;
d in dom Pk by A221, CARD_3:def_2;
hence (Card Pk) . d = g2 . d by A243, CARD_3:def_2; ::_thesis: verum
end;
reconsider U1 = union (rng Pr), U2 = union (rng Pk) as finite Subset of (dom z) by PROB_3:48;
dom z c= U1 \/ U2
proof
let l be set ; :: according to TARSKI:def_3 ::_thesis: ( not l in dom z or l in U1 \/ U2 )
assume l in dom z ; ::_thesis: l in U1 \/ U2
then consider x, y being set such that
A244: x in A and
A245: y in B and
A246: l = [x,y] by ZFMISC_1:def_2;
reconsider y = y as Element of B by A245;
reconsider x = x as Element of A by A244;
A247: z . (x,y) <> 0
proof
assume z . (x,y) = 0 ; ::_thesis: contradiction
then (x / p) - (y / q) = 0 by A188;
then x * q = y * p by XCMPLX_1:95;
then A248: p divides x * q by NAT_D:def_3;
A249: x <= (p -' 1) div 2 by FINSEQ_1:1;
x >= 0 + 1 by FINSEQ_1:1;
then p <= x by A5, A248, NAT_D:7, WSIERP_1:30;
hence contradiction by A12, A249, XXREAL_0:2; ::_thesis: verum
end;
percases ( z . (x,y) > 0 or z . (x,y) < 0 ) by A247;
supposeA250: z . (x,y) > 0 ; ::_thesis: l in U1 \/ U2
S1[x,Pr . x] by A190;
then l in Pr . x by A246, A250;
then l in Union Pr by A190, PROB_3:49;
hence l in U1 \/ U2 by XBOOLE_0:def_3; ::_thesis: verum
end;
supposeA251: z . (x,y) < 0 ; ::_thesis: l in U1 \/ U2
S2[y,Pk . y] by A218;
then l in Pk . y by A246, A251;
then l in Union Pk by A218, PROB_3:49;
hence l in U1 \/ U2 by XBOOLE_0:def_3; ::_thesis: verum
end;
end;
end;
then A252: U1 \/ U2 = dom z by XBOOLE_0:def_10;
A253: U1 misses U2
proof
assume U1 meets U2 ; ::_thesis: contradiction
then consider l being set such that
A254: l in U1 and
A255: l in U2 by XBOOLE_0:3;
l in Union Pk by A255;
then consider k2 being Nat such that
A256: k2 in dom Pk and
A257: l in Pk . k2 by PROB_3:49;
l in Union Pr by A254;
then consider k1 being Nat such that
A258: k1 in dom Pr and
A259: l in Pr . k1 by PROB_3:49;
reconsider k1 = k1, k2 = k2 as Element of NAT by ORDINAL1:def_12;
consider n1 being Element of B such that
n1 = k2 and
A260: Pk . k2 = { [x,n1] where x is Element of A : z . (x,n1) < 0 } by A218, A256;
consider n2 being Element of A such that
A261: l = [n2,n1] and
A262: z . (n2,n1) < 0 by A257, A260;
consider m1 being Element of A such that
m1 = k1 and
A263: Pr . k1 = { [m1,y] where y is Element of B : z . (m1,y) > 0 } by A190, A258;
A264: ex m2 being Element of B st
( l = [m1,m2] & z . (m1,m2) > 0 ) by A259, A263;
then m1 = n2 by A261, XTUPLE_0:1;
hence contradiction by A264, A261, A262, XTUPLE_0:1; ::_thesis: verum
end;
A265: for d, e being Nat st d in dom Pk & e in dom Pk & d <> e holds
Pk . d misses Pk . e
proof
let d, e be Nat; ::_thesis: ( d in dom Pk & e in dom Pk & d <> e implies Pk . d misses Pk . e )
assume that
A266: d in dom Pk and
A267: e in dom Pk and
A268: d <> e ; ::_thesis: Pk . d misses Pk . e
consider y2 being Element of B such that
A269: y2 = e and
A270: Pk . e = { [x,y2] where x is Element of A : z . (x,y2) < 0 } by A218, A267;
consider y1 being Element of B such that
A271: y1 = d and
A272: Pk . d = { [x,y1] where x is Element of A : z . (x,y1) < 0 } by A218, A266;
now__::_thesis:_Pk_._d_misses_Pk_._e
assume not Pk . d misses Pk . e ; ::_thesis: contradiction
then consider l being set such that
A273: l in Pk . d and
A274: l in Pk . e by XBOOLE_0:3;
A275: ex x2 being Element of A st
( l = [x2,y2] & z . (x2,y2) < 0 ) by A270, A274;
ex x1 being Element of A st
( l = [x1,y1] & z . (x1,y1) < 0 ) by A272, A273;
hence contradiction by A268, A271, A269, A275, XTUPLE_0:1; ::_thesis: verum
end;
hence Pk . d misses Pk . e ; ::_thesis: verum
end;
len Pk = (q -' 1) div 2 by A218, FINSEQ_1:def_3;
then A276: card (union (rng Pk)) = Sum (Card Pk) by A265, Th48;
A277: for d, e being Nat st d in dom Pr & e in dom Pr & d <> e holds
Pr . d misses Pr . e
proof
let d, e be Nat; ::_thesis: ( d in dom Pr & e in dom Pr & d <> e implies Pr . d misses Pr . e )
assume that
A278: d in dom Pr and
A279: e in dom Pr and
A280: d <> e ; ::_thesis: Pr . d misses Pr . e
consider x2 being Element of A such that
A281: x2 = e and
A282: Pr . e = { [x2,y] where y is Element of B : z . (x2,y) > 0 } by A190, A279;
consider x1 being Element of A such that
A283: x1 = d and
A284: Pr . d = { [x1,y] where y is Element of B : z . (x1,y) > 0 } by A190, A278;
now__::_thesis:_Pr_._d_misses_Pr_._e
assume not Pr . d misses Pr . e ; ::_thesis: contradiction
then consider l being set such that
A285: l in Pr . d and
A286: l in Pr . e by XBOOLE_0:3;
A287: ex y2 being Element of B st
( l = [x2,y2] & z . (x2,y2) > 0 ) by A282, A286;
ex y1 being Element of B st
( l = [x1,y1] & z . (x1,y1) > 0 ) by A284, A285;
hence contradiction by A280, A283, A281, A287, XTUPLE_0:1; ::_thesis: verum
end;
hence Pr . d misses Pr . e ; ::_thesis: verum
end;
len Pr = (p -' 1) div 2 by A190, FINSEQ_1:def_3;
then card (union (rng Pr)) = Sum (Card Pr) by A277, Th48;
then card (U1 \/ U2) = (Sum (Card Pr)) + (Sum (Card Pk)) by A276, A253, CARD_2:40;
then (Sum (Card Pr)) + (Sum (Card Pk)) = card [:A,B:] by A252, FUNCT_2:def_1
.= (card A) * (card B) by CARD_2:46
.= ((p -' 1) div 2) * (card B) by FINSEQ_1:57
.= ((p -' 1) div 2) * ((q -' 1) div 2) by FINSEQ_1:57 ;
hence (Sum f2) + (Sum g2) = ((p -' 1) div 2) * ((q -' 1) div 2) by A216, A219, A220, FINSEQ_1:13; ::_thesis: verum
end;
dom (p * f2) = dom f2 by VALUED_1:def_5;
then A288: len (p * f2) = (p -' 1) div 2 by A27, FINSEQ_3:29;
p * f2 is Element of NAT * by FINSEQ_1:def_11;
then p * f2 in ((p -' 1) div 2) -tuples_on NAT by A288;
then A289: p * f2 is Element of ((p -' 1) div 2) -tuples_on REAL by FINSEQ_2:109;
A290: (p -' 1) div 2 = ((p -' 1) + 1) div 2 by A9, NAT_2:26
.= p div 2 by A6, XREAL_1:235 ;
reconsider X = { k where k is Element of NAT : ( k in rng (Sgm (rng (f1 mod p))) & k > p / 2 ) } as finite Subset of NAT by A184, XBOOLE_1:1;
set m = card X;
reconsider Y = (rng (Sgm (rng (f1 mod p)))) \ X as finite Subset of NAT ;
A291: f1 mod p is Element of NAT * by FINSEQ_1:def_11;
len (f1 mod p) = (p -' 1) div 2 by A17, A95, CARD_1:def_7;
then f1 mod p in ((p -' 1) div 2) -tuples_on NAT by A291;
then A292: f1 mod p is Element of ((p -' 1) div 2) -tuples_on REAL by FINSEQ_2:109;
A293: rng (f1 mod p) c= Seg n1 by A98, A107, XBOOLE_1:73;
then A294: rng (Sgm (rng (f1 mod p))) = rng (f1 mod p) by FINSEQ_1:def_13;
then A295: X c= Seg n1 by A293, A184, XBOOLE_1:1;
A296: dom ((p * f2) + (f1 mod p)) = (dom (p * f2)) /\ (dom (f1 mod p)) by VALUED_1:def_1
.= (dom f2) /\ (dom (f1 mod p)) by VALUED_1:def_5
.= dom f1 by A96, A99 ;
for d being Nat st d in dom f1 holds
f1 . d = ((p * f2) + (f1 mod p)) . d
proof
let d be Nat; ::_thesis: ( d in dom f1 implies f1 . d = ((p * f2) + (f1 mod p)) . d )
assume A297: d in dom f1 ; ::_thesis: f1 . d = ((p * f2) + (f1 mod p)) . d
then A298: d in dom (p * f2) by A99, VALUED_1:def_5;
((p * f2) + (f1 mod p)) . d = ((p * f2) . d) + ((f1 mod p) . d) by A296, A297, VALUED_1:def_1;
hence ((p * f2) + (f1 mod p)) . d = (p * (f2 . d)) + ((f1 mod p) . d) by A298, VALUED_1:def_5
.= f1 . d by A100, A297 ;
::_thesis: verum
end;
then f1 = (p * f2) + (f1 mod p) by A296, FINSEQ_1:13;
then A299: Sum f1 = (Sum (p * f2)) + (Sum (f1 mod p)) by A289, A292, RVSUM_1:89
.= (p * (Sum f2)) + (Sum (f1 mod p)) by RVSUM_1:87 ;
A300: (rng (Sgm (rng (f1 mod p)))) \ X c= rng (Sgm (rng (f1 mod p))) by XBOOLE_1:36;
then A301: Y c= Seg n1 by A293, A294, XBOOLE_1:1;
A302: len (f1 mod p) = card (rng (Sgm (rng (f1 mod p)))) by A126, A294, FINSEQ_4:62;
then reconsider n = ((p -' 1) div 2) - (card X) as Element of NAT by A18, A95, A184, NAT_1:21, NAT_1:43;
A303: Sgm (rng (f1 mod p)) = ((Sgm (rng (f1 mod p))) | n) ^ ((Sgm (rng (f1 mod p))) /^ n) by RFINSEQ:8;
then A304: (Sgm (rng (f1 mod p))) /^ n is one-to-one by A108, FINSEQ_3:91;
Sgm (rng (f1 mod p)) is FinSequence of REAL by FINSEQ_2:24;
then A305: Sum (Sgm (rng (f1 mod p))) = Sum (f1 mod p) by A126, A294, A108, RFINSEQ:9, RFINSEQ:26;
for k, l being Element of NAT st k in Y & l in X holds
k < l
proof
let k, l be Element of NAT ; ::_thesis: ( k in Y & l in X implies k < l )
assume that
A306: k in Y and
A307: l in X ; ::_thesis: k < l
A308: not k in X by A306, XBOOLE_0:def_5;
A309: ex l1 being Element of NAT st
( l1 = l & l1 in rng (Sgm (rng (f1 mod p))) & l1 > p / 2 ) by A307;
k in rng (Sgm (rng (f1 mod p))) by A306, XBOOLE_0:def_5;
then k <= p / 2 by A308;
hence k < l by A309, XXREAL_0:2; ::_thesis: verum
end;
then Sgm (Y \/ X) = (Sgm Y) ^ (Sgm X) by A295, A301, FINSEQ_3:42;
then Sgm ((rng (Sgm (rng (f1 mod p)))) \/ X) = (Sgm Y) ^ (Sgm X) by XBOOLE_1:39;
then A310: Sgm (rng (f1 mod p)) = (Sgm Y) ^ (Sgm X) by A294, A184, XBOOLE_1:12;
then Sum (Sgm (rng (f1 mod p))) = (Sum (Sgm Y)) + (Sum (Sgm X)) by RVSUM_1:75;
then A311: q * (Sum (idseq ((p -' 1) div 2))) = ((p * (Sum f2)) + (Sum (Sgm Y))) + (Sum (Sgm X)) by A299, A305, RVSUM_1:87;
A312: len (Sgm Y) = card Y by A293, A294, A300, FINSEQ_3:39, XBOOLE_1:1
.= ((p -' 1) div 2) - (card X) by A18, A95, A184, A302, CARD_2:44 ;
then A313: (Sgm (rng (f1 mod p))) /^ n = Sgm X by A310, FINSEQ_5:37;
A314: (Sgm (rng (f1 mod p))) | n = Sgm Y by A310, A312, FINSEQ_3:113, FINSEQ_6:10;
A315: (Sgm (rng (f1 mod p))) | n is one-to-one by A108, A303, FINSEQ_3:91;
Lege (q,p) = (- 1) |^ (Sum f2)
proof
set f5 = ((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n);
set f6 = ((Sgm (rng (f1 mod p))) | n) ^ (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n));
A316: rng (idseq ((p -' 1) div 2)) = Seg ((p -' 1) div 2) by RELAT_1:45;
A317: (Sgm (rng (f1 mod p))) /^ n is FinSequence of REAL by FINSEQ_2:24;
A318: len ((Sgm (rng (f1 mod p))) | n) = n by A127, FINSEQ_1:59, XREAL_1:43;
A319: len ((Sgm (rng (f1 mod p))) /^ n) = (len (Sgm (rng (f1 mod p)))) -' n by RFINSEQ:29
.= (len (Sgm (rng (f1 mod p)))) - n by A127, XREAL_1:43, XREAL_1:233
.= card X by A127 ;
A320: dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) = (dom ((card X) |-> p)) /\ (dom ((Sgm (rng (f1 mod p))) /^ n)) by VALUED_1:12
.= (Seg (len ((card X) |-> p))) /\ (dom ((Sgm (rng (f1 mod p))) /^ n)) by FINSEQ_1:def_3
.= (Seg (len ((Sgm (rng (f1 mod p))) /^ n))) /\ (dom ((Sgm (rng (f1 mod p))) /^ n)) by A319, CARD_1:def_7
.= (dom ((Sgm (rng (f1 mod p))) /^ n)) /\ (dom ((Sgm (rng (f1 mod p))) /^ n)) by FINSEQ_1:def_3
.= dom ((Sgm (rng (f1 mod p))) /^ n) ;
then A321: len (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) = len ((Sgm (rng (f1 mod p))) /^ n) by FINSEQ_3:29;
A322: for d being Nat st d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) holds
(((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d)
proof
let d be Nat; ::_thesis: ( d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) implies (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d) )
assume A323: d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) ; ::_thesis: (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d)
then d in Seg (card X) by A319, A320, FINSEQ_1:def_3;
then ((card X) |-> p) . d = p by FINSEQ_2:57;
hence (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d) by A323, VALUED_1:13; ::_thesis: verum
end;
A324: for d being Nat st d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) holds
( (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d > 0 & (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d <= (p -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) implies ( (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d > 0 & (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d <= (p -' 1) div 2 ) )
reconsider w = (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d as Element of INT by INT_1:def_2;
assume A325: d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) ; ::_thesis: ( (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d > 0 & (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d <= (p -' 1) div 2 )
then (Sgm X) . d in rng (Sgm X) by A313, A320, FUNCT_1:3;
then (Sgm X) . d in X by A295, FINSEQ_1:def_13;
then A326: ex ll being Element of NAT st
( ll = (Sgm X) . d & ll in rng (f1 mod p) & ll > p / 2 ) by A294;
then consider e being Nat such that
A327: e in dom (f1 mod p) and
A328: (f1 mod p) . e = ((Sgm (rng (f1 mod p))) /^ n) . d by A313, FINSEQ_2:10;
((Sgm (rng (f1 mod p))) /^ n) . d = (f1 . e) mod p by A96, A327, A328, EULER_2:def_1;
then A329: ((Sgm (rng (f1 mod p))) /^ n) . d < p by NAT_D:1;
A330: (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d) by A322, A325;
then w < p - (p / 2) by A313, A326, XREAL_1:10;
hence ( (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d > 0 & (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d <= (p -' 1) div 2 ) by A290, A330, A329, INT_1:54, XREAL_1:50; ::_thesis: verum
end;
A331: rng (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) c= INT by RELAT_1:def_19;
for d being Nat st d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) holds
(((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d in NAT
proof
let d be Nat; ::_thesis: ( d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) implies (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d in NAT )
assume A332: d in dom (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) ; ::_thesis: (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d in NAT
(((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d > 0 by A332, A324;
hence (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) . d in NAT by A331, INT_1:3; ::_thesis: verum
end;
then reconsider f5 = ((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n) as FinSequence of NAT by FINSEQ_2:12;
f5 is FinSequence of NAT ;
then reconsider f6 = ((Sgm (rng (f1 mod p))) | n) ^ (((card X) |-> p) - ((Sgm (rng (f1 mod p))) /^ n)) as FinSequence of NAT by FINSEQ_1:75;
A333: f6 is FinSequence of REAL by FINSEQ_2:24;
A334: n <= len (Sgm (rng (f1 mod p))) by A127, XREAL_1:43;
A335: rng ((Sgm (rng (f1 mod p))) | n) misses rng f5
proof
assume not rng ((Sgm (rng (f1 mod p))) | n) misses rng f5 ; ::_thesis: contradiction
then consider x being set such that
A336: x in rng ((Sgm (rng (f1 mod p))) | n) and
A337: x in rng f5 by XBOOLE_0:3;
consider e being Nat such that
A338: e in dom f5 and
A339: f5 . e = x by A337, FINSEQ_2:10;
x = p - (((Sgm (rng (f1 mod p))) /^ n) . e) by A322, A338, A339;
then A340: x = p - ((Sgm (rng (f1 mod p))) . (e + n)) by A334, A320, A338, RFINSEQ:def_1;
e + n in dom (Sgm (rng (f1 mod p))) by A320, A338, FINSEQ_5:26;
then consider e1 being Nat such that
A341: e1 in dom (f1 mod p) and
A342: (f1 mod p) . e1 = (Sgm (rng (f1 mod p))) . (e + n) by A294, FINSEQ_2:10, FUNCT_1:3;
A343: e1 <= (p -' 1) div 2 by A18, A95, A341, FINSEQ_3:25;
rng ((Sgm (rng (f1 mod p))) | n) c= rng (Sgm (rng (f1 mod p))) by FINSEQ_5:19;
then consider d1 being Nat such that
A344: d1 in dom (f1 mod p) and
A345: (f1 mod p) . d1 = x by A294, A336, FINSEQ_2:10;
d1 <= (p -' 1) div 2 by A18, A95, A344, FINSEQ_3:25;
then d1 + e1 <= ((p -' 1) div 2) + ((p -' 1) div 2) by A343, XREAL_1:7;
then A346: d1 + e1 < p by A7, A11, XREAL_1:146, XXREAL_0:2;
x = (f1 . d1) mod p by A96, A344, A345, EULER_2:def_1;
then ((f1 . d1) mod p) + ((Sgm (rng (f1 mod p))) . (e + n)) = p by A340;
then ((f1 . d1) mod p) + ((f1 . e1) mod p) = p by A96, A341, A342, EULER_2:def_1;
then (((f1 . d1) mod p) + ((f1 . e1) mod p)) mod p = 0 by NAT_D:25;
then ((f1 . d1) + (f1 . e1)) mod p = 0 by EULER_2:6;
then p divides (f1 . d1) + (f1 . e1) by PEPIN:6;
then p divides (d1 * q) + (f1 . e1) by A13, A96, A344;
then p divides (d1 * q) + (e1 * q) by A13, A96, A341;
then A347: p divides (d1 + e1) * q ;
d1 >= 1 by A344, FINSEQ_3:25;
hence contradiction by A4, A347, A346, NAT_D:7, PEPIN:3; ::_thesis: verum
end;
for d, e being Element of NAT st 1 <= d & d < e & e <= len f5 holds
f5 . d <> f5 . e
proof
let d, e be Element of NAT ; ::_thesis: ( 1 <= d & d < e & e <= len f5 implies f5 . d <> f5 . e )
assume that
A348: 1 <= d and
A349: d < e and
A350: e <= len f5 ; ::_thesis: f5 . d <> f5 . e
1 <= e by A348, A349, XXREAL_0:2;
then A351: e in dom f5 by A350, FINSEQ_3:25;
then A352: f5 . e = p - (((Sgm (rng (f1 mod p))) /^ n) . e) by A322;
d < len f5 by A349, A350, XXREAL_0:2;
then A353: d in dom f5 by A348, FINSEQ_3:25;
then f5 . d = p - (((Sgm (rng (f1 mod p))) /^ n) . d) by A322;
hence f5 . d <> f5 . e by A304, A320, A349, A353, A351, A352, FUNCT_1:def_4; ::_thesis: verum
end;
then len f5 = card (rng f5) by GRAPH_5:7;
then f5 is one-to-one by FINSEQ_4:62;
then A354: f6 is one-to-one by A315, A335, FINSEQ_3:91;
A355: for d being Nat st d in dom f6 holds
( f6 . d > 0 & f6 . d <= (p -' 1) div 2 )
proof
let d be Nat; ::_thesis: ( d in dom f6 implies ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 ) )
assume A356: d in dom f6 ; ::_thesis: ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 )
percases ( d in dom ((Sgm (rng (f1 mod p))) | n) or ex l being Nat st
( l in dom f5 & d = (len ((Sgm (rng (f1 mod p))) | n)) + l ) ) by A356, FINSEQ_1:25;
supposeA357: d in dom ((Sgm (rng (f1 mod p))) | n) ; ::_thesis: ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 )
then ((Sgm (rng (f1 mod p))) | n) . d in rng (Sgm Y) by A314, FUNCT_1:3;
then A358: ((Sgm (rng (f1 mod p))) | n) . d in Y by A301, FINSEQ_1:def_13;
then A359: ((Sgm (rng (f1 mod p))) | n) . d in rng (Sgm (rng (f1 mod p))) by XBOOLE_0:def_5;
not ((Sgm (rng (f1 mod p))) | n) . d in X by A358, XBOOLE_0:def_5;
then ((Sgm (rng (f1 mod p))) | n) . d <= p / 2 by A359;
then A360: ((Sgm (rng (f1 mod p))) | n) . d <= (p -' 1) div 2 by A290, INT_1:54;
not ((Sgm (rng (f1 mod p))) | n) . d in {0} by A107, A294, A359, XBOOLE_0:3;
then ((Sgm (rng (f1 mod p))) | n) . d <> 0 by TARSKI:def_1;
hence ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 ) by A357, A360, FINSEQ_1:def_7; ::_thesis: verum
end;
suppose ex l being Nat st
( l in dom f5 & d = (len ((Sgm (rng (f1 mod p))) | n)) + l ) ; ::_thesis: ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 )
then consider l being Element of NAT such that
A361: l in dom f5 and
A362: d = (len ((Sgm (rng (f1 mod p))) | n)) + l ;
f6 . d = f5 . l by A361, A362, FINSEQ_1:def_7;
hence ( f6 . d > 0 & f6 . d <= (p -' 1) div 2 ) by A324, A361; ::_thesis: verum
end;
end;
end;
A363: idseq ((p -' 1) div 2) is FinSequence of REAL by RVSUM_1:145;
len f6 = (len ((Sgm (rng (f1 mod p))) | n)) + (len f5) by FINSEQ_1:22
.= (p -' 1) div 2 by A318, A319, A321 ;
then rng f6 = rng (idseq ((p -' 1) div 2)) by A316, A354, A355, Th40;
then M = Sum f6 by A363, A354, A333, RFINSEQ:9, RFINSEQ:26
.= (Sum ((Sgm (rng (f1 mod p))) | n)) + (Sum f5) by RVSUM_1:75
.= (Sum ((Sgm (rng (f1 mod p))) | n)) + (((card X) * p) - (Sum ((Sgm (rng (f1 mod p))) /^ n))) by A319, A317, Th47
.= ((Sum ((Sgm (rng (f1 mod p))) | n)) + ((card X) * p)) - (Sum ((Sgm (rng (f1 mod p))) /^ n)) ;
then (q - 1) * M = ((p * (Sum f2)) + (2 * (Sum (Sgm X)))) - ((card X) * p) by A311, A313, A314;
then A364: ((q -' 1) * M) mod 2 = (((p * (Sum f2)) - ((card X) * p)) + (2 * (Sum (Sgm X)))) mod 2 by A28, XREAL_1:233
.= ((p * (Sum f2)) - ((card X) * p)) mod 2 by EULER_1:12 ;
2 divides (q -' 1) * M by A39, NAT_D:9;
then ((q -' 1) * M) mod 2 = 0 by PEPIN:6;
then 2 divides p * ((Sum f2) - (card X)) by A364, Lm1;
then 2 divides (Sum f2) - (card X) by A183, INT_2:25;
then Sum f2, card X are_congruent_mod 2 by INT_2:15;
then (Sum f2) mod 2 = (card X) mod 2 by NAT_D:64;
then (- 1) |^ (Sum f2) = (- 1) |^ (card X) by Th45;
hence Lege (q,p) = (- 1) |^ (Sum f2) by A1, A5, A294, Th41; ::_thesis: verum
end;
hence (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ (((p -' 1) div 2) * ((q -' 1) div 2)) by A130, A186, NEWTON:8; ::_thesis: verum
end;
theorem :: INT_5:50
for p, q being Prime st p > 2 & q > 2 & p <> q & p mod 4 = 3 & q mod 4 = 3 holds
Lege (p,q) = - (Lege (q,p))
proof
let p, q be Prime; ::_thesis: ( p > 2 & q > 2 & p <> q & p mod 4 = 3 & q mod 4 = 3 implies Lege (p,q) = - (Lege (q,p)) )
assume that
A1: p > 2 and
A2: q > 2 and
A3: p <> q and
A4: p mod 4 = 3 and
A5: q mod 4 = 3 ; ::_thesis: Lege (p,q) = - (Lege (q,p))
q > 1 by INT_2:def_4;
then A6: q -' 1 = q - 1 by XREAL_1:233;
q = (4 * (q div 4)) + 3 by A5, NAT_D:2;
then q -' 1 = 2 * ((2 * (q div 4)) + 1) by A6;
then A7: (q -' 1) div 2 = (2 * (q div 4)) + 1 by NAT_D:18;
p > 1 by INT_2:def_4;
then A8: p -' 1 = p - 1 by XREAL_1:233;
p = (4 * (p div 4)) + 3 by A4, NAT_D:2;
then p -' 1 = 2 * ((2 * (p div 4)) + 1) by A8;
then (p -' 1) div 2 = (2 * (p div 4)) + 1 by NAT_D:18;
then A9: (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ (((2 * (p div 4)) + 1) * ((2 * (q div 4)) + 1)) by A1, A2, A3, A7, Th49
.= ((- 1) |^ ((2 * (p div 4)) + 1)) |^ ((2 * (q div 4)) + 1) by NEWTON:9
.= (((- 1) |^ (2 * (p div 4))) * (- 1)) |^ ((2 * (q div 4)) + 1) by NEWTON:6
.= ((((- 1) |^ 2) |^ (p div 4)) * (- 1)) |^ ((2 * (q div 4)) + 1) by NEWTON:9
.= (((1 |^ 2) |^ (p div 4)) * (- 1)) |^ ((2 * (q div 4)) + 1) by WSIERP_1:1
.= (((1 ^2) |^ (p div 4)) * (- 1)) |^ ((2 * (q div 4)) + 1) by NEWTON:81
.= (1 * (- 1)) |^ ((2 * (q div 4)) + 1) by NEWTON:10
.= ((- 1) |^ (2 * (q div 4))) * (- 1) by NEWTON:6
.= (((- 1) |^ 2) |^ (q div 4)) * (- 1) by NEWTON:9
.= ((1 |^ 2) |^ (q div 4)) * (- 1) by WSIERP_1:1
.= ((1 ^2) |^ (q div 4)) * (- 1) by NEWTON:81
.= 1 * (- 1) by NEWTON:10 ;
percases ( Lege (p,q) = 1 or Lege (p,q) = 0 or Lege (p,q) = - 1 ) by Th25;
suppose Lege (p,q) = 1 ; ::_thesis: Lege (p,q) = - (Lege (q,p))
hence Lege (p,q) = - (Lege (q,p)) by A9; ::_thesis: verum
end;
suppose Lege (p,q) = 0 ; ::_thesis: Lege (p,q) = - (Lege (q,p))
hence Lege (p,q) = - (Lege (q,p)) by A9; ::_thesis: verum
end;
suppose Lege (p,q) = - 1 ; ::_thesis: Lege (p,q) = - (Lege (q,p))
hence Lege (p,q) = - (Lege (q,p)) by A9; ::_thesis: verum
end;
end;
end;
theorem :: INT_5:51
for p, q being Prime st p > 2 & q > 2 & p <> q & ( p mod 4 = 1 or q mod 4 = 1 ) holds
Lege (p,q) = Lege (q,p)
proof
let p, q be Prime; ::_thesis: ( p > 2 & q > 2 & p <> q & ( p mod 4 = 1 or q mod 4 = 1 ) implies Lege (p,q) = Lege (q,p) )
assume that
A1: p > 2 and
A2: q > 2 and
A3: p <> q and
A4: ( p mod 4 = 1 or q mod 4 = 1 ) ; ::_thesis: Lege (p,q) = Lege (q,p)
p > 1 by INT_2:def_4;
then A5: p -' 1 = p - 1 by XREAL_1:233;
q > 1 by INT_2:def_4;
then A6: q -' 1 = q - 1 by XREAL_1:233;
percases ( p mod 4 = 1 or q mod 4 = 1 ) by A4;
suppose p mod 4 = 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
then p = (4 * (p div 4)) + 1 by NAT_D:2;
then p -' 1 = 2 * (2 * (p div 4)) by A5;
then (p -' 1) div 2 = 2 * (p div 4) by NAT_D:18;
then A7: (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ ((2 * (p div 4)) * ((q -' 1) div 2)) by A1, A2, A3, Th49
.= ((- 1) |^ (2 * (p div 4))) |^ ((q -' 1) div 2) by NEWTON:9
.= (((- 1) |^ 2) |^ (p div 4)) |^ ((q -' 1) div 2) by NEWTON:9
.= ((1 |^ 2) |^ (p div 4)) |^ ((q -' 1) div 2) by WSIERP_1:1
.= ((1 ^2) |^ (p div 4)) |^ ((q -' 1) div 2) by NEWTON:81
.= 1 |^ ((q -' 1) div 2) by NEWTON:10
.= 1 by NEWTON:10 ;
percases ( Lege (p,q) = 1 or Lege (p,q) = 0 or Lege (p,q) = - 1 ) by Th25;
suppose Lege (p,q) = 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A7; ::_thesis: verum
end;
suppose Lege (p,q) = 0 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A7; ::_thesis: verum
end;
suppose Lege (p,q) = - 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A7; ::_thesis: verum
end;
end;
end;
suppose q mod 4 = 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
then q = (4 * (q div 4)) + 1 by NAT_D:2;
then q -' 1 = 2 * (2 * (q div 4)) by A6;
then (q -' 1) div 2 = 2 * (q div 4) by NAT_D:18;
then A8: (Lege (p,q)) * (Lege (q,p)) = (- 1) |^ ((2 * (q div 4)) * ((p -' 1) div 2)) by A1, A2, A3, Th49
.= ((- 1) |^ (2 * (q div 4))) |^ ((p -' 1) div 2) by NEWTON:9
.= (((- 1) |^ 2) |^ (q div 4)) |^ ((p -' 1) div 2) by NEWTON:9
.= ((1 |^ 2) |^ (q div 4)) |^ ((p -' 1) div 2) by WSIERP_1:1
.= ((1 ^2) |^ (q div 4)) |^ ((p -' 1) div 2) by NEWTON:81
.= 1 |^ ((p -' 1) div 2) by NEWTON:10
.= 1 by NEWTON:10 ;
percases ( Lege (p,q) = 1 or Lege (p,q) = 0 or Lege (p,q) = - 1 ) by Th25;
suppose Lege (p,q) = 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A8; ::_thesis: verum
end;
suppose Lege (p,q) = 0 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A8; ::_thesis: verum
end;
suppose Lege (p,q) = - 1 ; ::_thesis: Lege (p,q) = Lege (q,p)
hence Lege (p,q) = Lege (q,p) by A8; ::_thesis: verum
end;
end;
end;
end;
end;