:: IDEA_1 semantic presentation

Lemma1: for b1, b2 being Nat st b1 <> 0 & b1 < b2 & b2 is prime holds
b1,b2 are_relative_prime
proof end;

Lemma2: for b1, b2, b3 being Nat st b1 is prime & b2 < b1 & b3 < b1 & b2 <> 0 holds
ex b4 being Nat st (b4 * b2) mod b1 = b3
proof end;

theorem Th1: :: IDEA_1:1
for b1, b2, b3 being Nat st b2 is prime & b1 < b2 & b3 < b2 & b1 <> 0 holds
ex b4 being Nat st
( (b4 * b1) mod b2 = b3 & b4 < b2 )
proof end;

theorem Th2: :: IDEA_1:2
for b1, b2, b3 being Nat st b1 <> 0 & b2 mod b1 = b3 mod b1 & b2 <= b3 holds
ex b4 being Nat st b3 - b2 = b1 * b4
proof end;

theorem Th3: :: IDEA_1:3
for b1, b2 being Nat holds b1 - b2 <= b1
proof end;

theorem Th4: :: IDEA_1:4
for b1, b2, b3 being Nat st b2 <= b3 holds
b2 - b1 <= b3
proof end;

theorem Th5: :: IDEA_1:5
for b1, b2, b3 being Nat st 0 < b1 & 0 < b2 & b1 < b3 & b2 < b3 & b3 is prime holds
(b1 * b2) mod b3 <> 0
proof end;

definition
let c1 be Nat;
func ZERO c1 -> Tuple of a1,BOOLEAN equals :: IDEA_1:def 1
a1 |-> FALSE ;
correctness
coherence
c1 |-> FALSE is Tuple of c1,BOOLEAN
;
by FINSEQ_2:132;
end;

:: deftheorem Def1 defines ZERO IDEA_1:def 1 :
for b1 being Nat holds ZERO b1 = b1 |-> FALSE ;

definition
let c1 be Nat;
let c2, c3 be Tuple of c1,BOOLEAN ;
func c2 'xor' c3 -> Tuple of a1,BOOLEAN means :Def2: :: IDEA_1:def 2
for b1 being Nat st b1 in Seg a1 holds
a4 /. b1 = (a2 /. b1) 'xor' (a3 /. b1);
existence
ex b1 being Tuple of c1,BOOLEAN st
for b2 being Nat st b2 in Seg c1 holds
b1 /. b2 = (c2 /. b2) 'xor' (c3 /. b2)
proof end;
uniqueness
for b1, b2 being Tuple of c1,BOOLEAN st ( for b3 being Nat st b3 in Seg c1 holds
b1 /. b3 = (c2 /. b3) 'xor' (c3 /. b3) ) & ( for b3 being Nat st b3 in Seg c1 holds
b2 /. b3 = (c2 /. b3) 'xor' (c3 /. b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines 'xor' IDEA_1:def 2 :
for b1 being Nat
for b2, b3, b4 being Tuple of b1,BOOLEAN holds
( b4 = b2 'xor' b3 iff for b5 being Nat st b5 in Seg b1 holds
b4 /. b5 = (b2 /. b5) 'xor' (b3 /. b5) );

theorem Th6: :: IDEA_1:6
canceled;

theorem Th7: :: IDEA_1:7
for b1 being Nat
for b2 being Tuple of b1,BOOLEAN holds b2 'xor' b2 = ZERO b1
proof end;

theorem Th8: :: IDEA_1:8
for b1 being Nat
for b2, b3 being Tuple of b1,BOOLEAN holds b2 'xor' b3 = b3 'xor' b2
proof end;

definition
let c1 be Nat;
let c2, c3 be Tuple of c1,BOOLEAN ;
redefine func 'xor' as c2 'xor' c3 -> Tuple of a1,BOOLEAN ;
commutativity
for b1, b2 being Tuple of c1,BOOLEAN holds b1 'xor' b2 = b2 'xor' b1
by Th8;
end;

theorem Th9: :: IDEA_1:9
for b1 being Nat
for b2 being Tuple of b1,BOOLEAN holds (ZERO b1) 'xor' b2 = b2
proof end;

theorem Th10: :: IDEA_1:10
for b1 being Nat
for b2, b3, b4 being Tuple of b1,BOOLEAN holds (b2 'xor' b3) 'xor' b4 = b2 'xor' (b3 'xor' b4)
proof end;

definition
let c1, c2 be Nat;
pred c2 is_expressible_by c1 means :Def3: :: IDEA_1:def 3
a2 < 2 to_power a1;
end;

:: deftheorem Def3 defines is_expressible_by IDEA_1:def 3 :
for b1, b2 being Nat holds
( b2 is_expressible_by b1 iff b2 < 2 to_power b1 );

theorem Th11: :: IDEA_1:11
for b1 being Nat holds b1 -BinarySequence 0 = ZERO b1
proof end;

definition
let c1 be Nat;
let c2, c3 be Nat;
func ADD_MOD c2,c3,c1 -> Nat equals :: IDEA_1:def 4
(a2 + a3) mod (2 to_power a1);
coherence
(c2 + c3) mod (2 to_power c1) is Nat
;
end;

:: deftheorem Def4 defines ADD_MOD IDEA_1:def 4 :
for b1, b2, b3 being Nat holds ADD_MOD b2,b3,b1 = (b2 + b3) mod (2 to_power b1);

definition
let c1, c2 be Nat;
assume E14: c2 is_expressible_by c1 ;
func NEG_N c2,c1 -> Nat equals :Def5: :: IDEA_1:def 5
(2 to_power a1) - a2;
coherence
(2 to_power c1) - c2 is Nat
proof end;
end;

:: deftheorem Def5 defines NEG_N IDEA_1:def 5 :
for b1, b2 being Nat st b2 is_expressible_by b1 holds
NEG_N b2,b1 = (2 to_power b1) - b2;

definition
let c1, c2 be Nat;
func NEG_MOD c2,c1 -> Nat equals :: IDEA_1:def 6
(NEG_N a2,a1) mod (2 to_power a1);
coherence
(NEG_N c2,c1) mod (2 to_power c1) is Nat
;
end;

:: deftheorem Def6 defines NEG_MOD IDEA_1:def 6 :
for b1, b2 being Nat holds NEG_MOD b2,b1 = (NEG_N b2,b1) mod (2 to_power b1);

theorem Th12: :: IDEA_1:12
for b1, b2 being Nat st b1 is_expressible_by b2 holds
ADD_MOD b1,(NEG_MOD b1,b2),b2 = 0
proof end;

theorem Th13: :: IDEA_1:13
for b1, b2, b3 being Nat holds ADD_MOD b1,b2,b3 = ADD_MOD b2,b1,b3 ;

theorem Th14: :: IDEA_1:14
for b1, b2 being Nat st b1 is_expressible_by b2 holds
ADD_MOD 0,b1,b2 = b1
proof end;

theorem Th15: :: IDEA_1:15
for b1, b2, b3, b4 being Nat holds ADD_MOD (ADD_MOD b1,b2,b3),b4,b3 = ADD_MOD b1,(ADD_MOD b2,b4,b3),b3
proof end;

theorem Th16: :: IDEA_1:16
for b1, b2, b3 being Nat holds ADD_MOD b1,b2,b3 is_expressible_by b3
proof end;

theorem Th17: :: IDEA_1:17
for b1, b2 being Nat holds NEG_MOD b1,b2 is_expressible_by b2
proof end;

definition
let c1, c2 be Nat;
func ChangeVal_1 c2,c1 -> Nat equals :Def7: :: IDEA_1:def 7
2 to_power a1 if a2 = 0
otherwise a2;
correctness
coherence
( ( c2 = 0 implies 2 to_power c1 is Nat ) & ( not c2 = 0 implies c2 is Nat ) )
;
consistency
for b1 being Nat holds verum
;
;
end;

:: deftheorem Def7 defines ChangeVal_1 IDEA_1:def 7 :
for b1, b2 being Nat holds
( ( b2 = 0 implies ChangeVal_1 b2,b1 = 2 to_power b1 ) & ( not b2 = 0 implies ChangeVal_1 b2,b1 = b2 ) );

theorem Th18: :: IDEA_1:18
for b1, b2 being Nat st b1 is_expressible_by b2 holds
( ChangeVal_1 b1,b2 <= 2 to_power b2 & ChangeVal_1 b1,b2 > 0 )
proof end;

theorem Th19: :: IDEA_1:19
for b1, b2, b3 being Nat st b2 is_expressible_by b1 & b3 is_expressible_by b1 & ChangeVal_1 b2,b1 = ChangeVal_1 b3,b1 holds
b2 = b3
proof end;

definition
let c1, c2 be Nat;
func ChangeVal_2 c2,c1 -> Nat equals :Def8: :: IDEA_1:def 8
0 if a2 = 2 to_power a1
otherwise a2;
correctness
coherence
( ( c2 = 2 to_power c1 implies 0 is Nat ) & ( not c2 = 2 to_power c1 implies c2 is Nat ) )
;
consistency
for b1 being Nat holds verum
;
;
end;

:: deftheorem Def8 defines ChangeVal_2 IDEA_1:def 8 :
for b1, b2 being Nat holds
( ( b2 = 2 to_power b1 implies ChangeVal_2 b2,b1 = 0 ) & ( not b2 = 2 to_power b1 implies ChangeVal_2 b2,b1 = b2 ) );

theorem Th20: :: IDEA_1:20
for b1, b2 being Nat st b1 is_expressible_by b2 holds
ChangeVal_2 b1,b2 is_expressible_by b2
proof end;

theorem Th21: :: IDEA_1:21
for b1, b2, b3 being Nat st b2 <> 0 & b3 <> 0 & ChangeVal_2 b2,b1 = ChangeVal_2 b3,b1 holds
b2 = b3
proof end;

definition
let c1 be Nat;
let c2, c3 be Nat;
func MUL_MOD c2,c3,c1 -> Nat equals :: IDEA_1:def 9
ChangeVal_2 (((ChangeVal_1 a2,a1) * (ChangeVal_1 a3,a1)) mod ((2 to_power a1) + 1)),a1;
coherence
ChangeVal_2 (((ChangeVal_1 c2,c1) * (ChangeVal_1 c3,c1)) mod ((2 to_power c1) + 1)),c1 is Nat
;
end;

:: deftheorem Def9 defines MUL_MOD IDEA_1:def 9 :
for b1, b2, b3 being Nat holds MUL_MOD b2,b3,b1 = ChangeVal_2 (((ChangeVal_1 b2,b1) * (ChangeVal_1 b3,b1)) mod ((2 to_power b1) + 1)),b1;

definition
let c1 be non empty Nat;
let c2 be Nat;
assume E24: ( c2 is_expressible_by c1 & (2 to_power c1) + 1 is prime ) ;
func INV_MOD c2,c1 -> Nat means :Def10: :: IDEA_1:def 10
( MUL_MOD a2,a3,a1 = 1 & a3 is_expressible_by a1 );
existence
ex b1 being Nat st
( MUL_MOD c2,b1,c1 = 1 & b1 is_expressible_by c1 )
proof end;
uniqueness
for b1, b2 being Nat st MUL_MOD c2,b1,c1 = 1 & b1 is_expressible_by c1 & MUL_MOD c2,b2,c1 = 1 & b2 is_expressible_by c1 holds
b1 = b2
proof end;
end;

:: deftheorem Def10 defines INV_MOD IDEA_1:def 10 :
for b1 being non empty Nat
for b2 being Nat st b2 is_expressible_by b1 & (2 to_power b1) + 1 is prime holds
for b3 being Nat holds
( b3 = INV_MOD b2,b1 iff ( MUL_MOD b2,b3,b1 = 1 & b3 is_expressible_by b1 ) );

theorem Th22: :: IDEA_1:22
for b1, b2, b3 being Nat holds MUL_MOD b1,b2,b3 = MUL_MOD b2,b1,b3 ;

theorem Th23: :: IDEA_1:23
for b1, b2 being Nat st b1 is_expressible_by b2 holds
MUL_MOD 1,b1,b2 = b1
proof end;

theorem Th24: :: IDEA_1:24
for b1, b2, b3, b4 being Nat st (2 to_power b1) + 1 is prime & b2 is_expressible_by b1 & b3 is_expressible_by b1 & b4 is_expressible_by b1 holds
MUL_MOD (MUL_MOD b2,b3,b1),b4,b1 = MUL_MOD b2,(MUL_MOD b3,b4,b1),b1
proof end;

theorem Th25: :: IDEA_1:25
for b1, b2, b3 being Nat holds MUL_MOD b1,b2,b3 is_expressible_by b3
proof end;

theorem Th26: :: IDEA_1:26
for b1, b2 being Nat st ChangeVal_2 b1,b2 = 1 holds
b1 = 1
proof end;

definition
let c1 be Nat;
let c2, c3 be FinSequence of NAT ;
func IDEAoperationA c2,c3,c1 -> FinSequence of NAT means :Def11: :: IDEA_1:def 11
( len a4 = len a2 & ( for b1 being Nat st b1 in dom a2 holds
( ( b1 = 1 implies a4 . b1 = MUL_MOD (a2 . 1),(a3 . 1),a1 ) & ( b1 = 2 implies a4 . b1 = ADD_MOD (a2 . 2),(a3 . 2),a1 ) & ( b1 = 3 implies a4 . b1 = ADD_MOD (a2 . 3),(a3 . 3),a1 ) & ( b1 = 4 implies a4 . b1 = MUL_MOD (a2 . 4),(a3 . 4),a1 ) & ( b1 <> 1 & b1 <> 2 & b1 <> 3 & b1 <> 4 implies a4 . b1 = a2 . b1 ) ) ) );
existence
ex b1 being FinSequence of NAT st
( len b1 = len c2 & ( for b2 being Nat st b2 in dom c2 holds
( ( b2 = 1 implies b1 . b2 = MUL_MOD (c2 . 1),(c3 . 1),c1 ) & ( b2 = 2 implies b1 . b2 = ADD_MOD (c2 . 2),(c3 . 2),c1 ) & ( b2 = 3 implies b1 . b2 = ADD_MOD (c2 . 3),(c3 . 3),c1 ) & ( b2 = 4 implies b1 . b2 = MUL_MOD (c2 . 4),(c3 . 4),c1 ) & ( b2 <> 1 & b2 <> 2 & b2 <> 3 & b2 <> 4 implies b1 . b2 = c2 . b2 ) ) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of NAT st len b1 = len c2 & ( for b3 being Nat st b3 in dom c2 holds
( ( b3 = 1 implies b1 . b3 = MUL_MOD (c2 . 1),(c3 . 1),c1 ) & ( b3 = 2 implies b1 . b3 = ADD_MOD (c2 . 2),(c3 . 2),c1 ) & ( b3 = 3 implies b1 . b3 = ADD_MOD (c2 . 3),(c3 . 3),c1 ) & ( b3 = 4 implies b1 . b3 = MUL_MOD (c2 . 4),(c3 . 4),c1 ) & ( b3 <> 1 & b3 <> 2 & b3 <> 3 & b3 <> 4 implies b1 . b3 = c2 . b3 ) ) ) & len b2 = len c2 & ( for b3 being Nat st b3 in dom c2 holds
( ( b3 = 1 implies b2 . b3 = MUL_MOD (c2 . 1),(c3 . 1),c1 ) & ( b3 = 2 implies b2 . b3 = ADD_MOD (c2 . 2),(c3 . 2),c1 ) & ( b3 = 3 implies b2 . b3 = ADD_MOD (c2 . 3),(c3 . 3),c1 ) & ( b3 = 4 implies b2 . b3 = MUL_MOD (c2 . 4),(c3 . 4),c1 ) & ( b3 <> 1 & b3 <> 2 & b3 <> 3 & b3 <> 4 implies b2 . b3 = c2 . b3 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines IDEAoperationA IDEA_1:def 11 :
for b1 being Nat
for b2, b3, b4 being FinSequence of NAT holds
( b4 = IDEAoperationA b2,b3,b1 iff ( len b4 = len b2 & ( for b5 being Nat st b5 in dom b2 holds
( ( b5 = 1 implies b4 . b5 = MUL_MOD (b2 . 1),(b3 . 1),b1 ) & ( b5 = 2 implies b4 . b5 = ADD_MOD (b2 . 2),(b3 . 2),b1 ) & ( b5 = 3 implies b4 . b5 = ADD_MOD (b2 . 3),(b3 . 3),b1 ) & ( b5 = 4 implies b4 . b5 = MUL_MOD (b2 . 4),(b3 . 4),b1 ) & ( b5 <> 1 & b5 <> 2 & b5 <> 3 & b5 <> 4 implies b4 . b5 = b2 . b5 ) ) ) ) );

definition
let c1 be non empty Nat;
let c2, c3 be FinSequence of NAT ;
func IDEAoperationB c2,c3,c1 -> FinSequence of NAT means :Def12: :: IDEA_1:def 12
( len a4 = len a2 & ( for b1 being Nat st b1 in dom a2 holds
( ( b1 = 1 implies a4 . b1 = Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(Absval ((a1 -BinarySequence (a2 . 2)) 'xor' (a1 -BinarySequence (a2 . 4)))),a1),(a3 . 6),a1))) ) & ( b1 = 2 implies a4 . b1 = Absval ((a1 -BinarySequence (a2 . 2)) 'xor' (a1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(Absval ((a1 -BinarySequence (a2 . 2)) 'xor' (a1 -BinarySequence (a2 . 4)))),a1),(a3 . 6),a1),a1))) ) & ( b1 = 3 implies a4 . b1 = Absval ((a1 -BinarySequence (a2 . 3)) 'xor' (a1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(Absval ((a1 -BinarySequence (a2 . 2)) 'xor' (a1 -BinarySequence (a2 . 4)))),a1),(a3 . 6),a1))) ) & ( b1 = 4 implies a4 . b1 = Absval ((a1 -BinarySequence (a2 . 4)) 'xor' (a1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((a1 -BinarySequence (a2 . 1)) 'xor' (a1 -BinarySequence (a2 . 3)))),(a3 . 5),a1),(Absval ((a1 -BinarySequence (a2 . 2)) 'xor' (a1 -BinarySequence (a2 . 4)))),a1),(a3 . 6),a1),a1))) ) & ( b1 <> 1 & b1 <> 2 & b1 <> 3 & b1 <> 4 implies a4 . b1 = a2 . b1 ) ) ) );
existence
ex b1 being FinSequence of NAT st
( len b1 = len c2 & ( for b2 being Nat st b2 in dom c2 holds
( ( b2 = 1 implies b1 . b2 = Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b2 = 2 implies b1 . b2 = Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b2 = 3 implies b1 . b2 = Absval ((c1 -BinarySequence (c2 . 3)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b2 = 4 implies b1 . b2 = Absval ((c1 -BinarySequence (c2 . 4)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b2 <> 1 & b2 <> 2 & b2 <> 3 & b2 <> 4 implies b1 . b2 = c2 . b2 ) ) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of NAT st len b1 = len c2 & ( for b3 being Nat st b3 in dom c2 holds
( ( b3 = 1 implies b1 . b3 = Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b3 = 2 implies b1 . b3 = Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b3 = 3 implies b1 . b3 = Absval ((c1 -BinarySequence (c2 . 3)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b3 = 4 implies b1 . b3 = Absval ((c1 -BinarySequence (c2 . 4)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b3 <> 1 & b3 <> 2 & b3 <> 3 & b3 <> 4 implies b1 . b3 = c2 . b3 ) ) ) & len b2 = len c2 & ( for b3 being Nat st b3 in dom c2 holds
( ( b3 = 1 implies b2 . b3 = Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b3 = 2 implies b2 . b3 = Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b3 = 3 implies b2 . b3 = Absval ((c1 -BinarySequence (c2 . 3)) 'xor' (c1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1))) ) & ( b3 = 4 implies b2 . b3 = Absval ((c1 -BinarySequence (c2 . 4)) 'xor' (c1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((c1 -BinarySequence (c2 . 1)) 'xor' (c1 -BinarySequence (c2 . 3)))),(c3 . 5),c1),(Absval ((c1 -BinarySequence (c2 . 2)) 'xor' (c1 -BinarySequence (c2 . 4)))),c1),(c3 . 6),c1),c1))) ) & ( b3 <> 1 & b3 <> 2 & b3 <> 3 & b3 <> 4 implies b2 . b3 = c2 . b3 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def12 defines IDEAoperationB IDEA_1:def 12 :
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT holds
( b4 = IDEAoperationB b2,b3,b1 iff ( len b4 = len b2 & ( for b5 being Nat st b5 in dom b2 holds
( ( b5 = 1 implies b4 . b5 = Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(Absval ((b1 -BinarySequence (b2 . 2)) 'xor' (b1 -BinarySequence (b2 . 4)))),b1),(b3 . 6),b1))) ) & ( b5 = 2 implies b4 . b5 = Absval ((b1 -BinarySequence (b2 . 2)) 'xor' (b1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(Absval ((b1 -BinarySequence (b2 . 2)) 'xor' (b1 -BinarySequence (b2 . 4)))),b1),(b3 . 6),b1),b1))) ) & ( b5 = 3 implies b4 . b5 = Absval ((b1 -BinarySequence (b2 . 3)) 'xor' (b1 -BinarySequence (MUL_MOD (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(Absval ((b1 -BinarySequence (b2 . 2)) 'xor' (b1 -BinarySequence (b2 . 4)))),b1),(b3 . 6),b1))) ) & ( b5 = 4 implies b4 . b5 = Absval ((b1 -BinarySequence (b2 . 4)) 'xor' (b1 -BinarySequence (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(MUL_MOD (ADD_MOD (MUL_MOD (Absval ((b1 -BinarySequence (b2 . 1)) 'xor' (b1 -BinarySequence (b2 . 3)))),(b3 . 5),b1),(Absval ((b1 -BinarySequence (b2 . 2)) 'xor' (b1 -BinarySequence (b2 . 4)))),b1),(b3 . 6),b1),b1))) ) & ( b5 <> 1 & b5 <> 2 & b5 <> 3 & b5 <> 4 implies b4 . b5 = b2 . b5 ) ) ) ) );

definition
let c1 be FinSequence of NAT ;
func IDEAoperationC c1 -> FinSequence of NAT means :Def13: :: IDEA_1:def 13
( len a2 = len a1 & ( for b1 being Nat st b1 in dom a1 holds
a2 . b1 = IFEQ b1,2,(a1 . 3),(IFEQ b1,3,(a1 . 2),(a1 . b1)) ) );
existence
ex b1 being FinSequence of NAT st
( len b1 = len c1 & ( for b2 being Nat st b2 in dom c1 holds
b1 . b2 = IFEQ b2,2,(c1 . 3),(IFEQ b2,3,(c1 . 2),(c1 . b2)) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of NAT st len b1 = len c1 & ( for b3 being Nat st b3 in dom c1 holds
b1 . b3 = IFEQ b3,2,(c1 . 3),(IFEQ b3,3,(c1 . 2),(c1 . b3)) ) & len b2 = len c1 & ( for b3 being Nat st b3 in dom c1 holds
b2 . b3 = IFEQ b3,2,(c1 . 3),(IFEQ b3,3,(c1 . 2),(c1 . b3)) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def13 defines IDEAoperationC IDEA_1:def 13 :
for b1, b2 being FinSequence of NAT holds
( b2 = IDEAoperationC b1 iff ( len b2 = len b1 & ( for b3 being Nat st b3 in dom b1 holds
b2 . b3 = IFEQ b3,2,(b1 . 3),(IFEQ b3,3,(b1 . 2),(b1 . b3)) ) ) );

theorem Th27: :: IDEA_1:27
for b1 being Nat
for b2, b3 being FinSequence of NAT st len b2 >= 4 holds
( (IDEAoperationA b2,b3,b1) . 1 is_expressible_by b1 & (IDEAoperationA b2,b3,b1) . 2 is_expressible_by b1 & (IDEAoperationA b2,b3,b1) . 3 is_expressible_by b1 & (IDEAoperationA b2,b3,b1) . 4 is_expressible_by b1 )
proof end;

theorem Th28: :: IDEA_1:28
for b1, b2 being FinSequence of NAT
for b3 being non empty Nat st len b1 >= 4 holds
( (IDEAoperationB b1,b2,b3) . 1 is_expressible_by b3 & (IDEAoperationB b1,b2,b3) . 2 is_expressible_by b3 & (IDEAoperationB b1,b2,b3) . 3 is_expressible_by b3 & (IDEAoperationB b1,b2,b3) . 4 is_expressible_by b3 )
proof end;

Lemma33: for b1 being FinSequence of NAT
for b2 being Nat st b2 = 2 & b2 in dom b1 holds
(IDEAoperationC b1) . b2 = b1 . 3
proof end;

Lemma34: for b1 being FinSequence of NAT
for b2 being Nat st b2 = 3 & b2 in dom b1 holds
(IDEAoperationC b1) . b2 = b1 . 2
proof end;

Lemma35: for b1 being FinSequence of NAT
for b2 being Nat st b2 <> 2 & b2 <> 3 & b2 in dom b1 holds
(IDEAoperationC b1) . b2 = b1 . b2
proof end;

theorem Th29: :: IDEA_1:29
for b1 being Nat
for b2 being FinSequence of NAT st len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 holds
( (IDEAoperationC b2) . 1 is_expressible_by b1 & (IDEAoperationC b2) . 2 is_expressible_by b1 & (IDEAoperationC b2) . 3 is_expressible_by b1 & (IDEAoperationC b2) . 4 is_expressible_by b1 )
proof end;

theorem Th30: :: IDEA_1:30
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 1 is_expressible_by b1 & b3 . 2 is_expressible_by b1 & b3 . 3 is_expressible_by b1 & b3 . 4 is_expressible_by b1 & b4 . 1 = INV_MOD (b3 . 1),b1 & b4 . 2 = NEG_MOD (b3 . 2),b1 & b4 . 3 = NEG_MOD (b3 . 3),b1 & b4 . 4 = INV_MOD (b3 . 4),b1 holds
IDEAoperationA (IDEAoperationA b2,b3,b1),b4,b1 = b2
proof end;

theorem Th31: :: IDEA_1:31
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 1 is_expressible_by b1 & b3 . 2 is_expressible_by b1 & b3 . 3 is_expressible_by b1 & b3 . 4 is_expressible_by b1 & b4 . 1 = INV_MOD (b3 . 1),b1 & b4 . 2 = NEG_MOD (b3 . 3),b1 & b4 . 3 = NEG_MOD (b3 . 2),b1 & b4 . 4 = INV_MOD (b3 . 4),b1 holds
IDEAoperationA (IDEAoperationC (IDEAoperationA (IDEAoperationC b2),b3,b1)),b4,b1 = b2
proof end;

theorem Th32: :: IDEA_1:32
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 5 is_expressible_by b1 & b3 . 6 is_expressible_by b1 & b4 . 5 = b3 . 5 & b4 . 6 = b3 . 6 holds
IDEAoperationB (IDEAoperationB b2,b3,b1),b4,b1 = b2
proof end;

theorem Th33: :: IDEA_1:33
for b1 being FinSequence of NAT st len b1 >= 4 holds
IDEAoperationC (IDEAoperationC b1) = b1
proof end;

definition
func MESSAGES -> set equals :: IDEA_1:def 14
NAT * ;
coherence
NAT * is set
;
end;

:: deftheorem Def14 defines MESSAGES IDEA_1:def 14 :
MESSAGES = NAT * ;

registration
cluster MESSAGES -> non empty ;
coherence
not MESSAGES is empty
;
end;

registration
cluster MESSAGES -> non empty functional ;
coherence
MESSAGES is functional
;
end;

registration
cluster -> FinSequence-like Element of MESSAGES ;
coherence
for b1 being Element of MESSAGES holds b1 is FinSequence-like
by FINSEQ_1:def 11;
end;

definition
let c1 be non empty Nat;
let c2 be FinSequence of NAT ;
func IDEA_P c2,c1 -> Function of MESSAGES , MESSAGES means :Def15: :: IDEA_1:def 15
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationA (IDEAoperationC (IDEAoperationB b1,a2,a1)),a2,a1;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationA (IDEAoperationC (IDEAoperationB b2,c2,c1)),c2,c1
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationA (IDEAoperationC (IDEAoperationB b3,c2,c1)),c2,c1 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationA (IDEAoperationC (IDEAoperationB b3,c2,c1)),c2,c1 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def15 defines IDEA_P IDEA_1:def 15 :
for b1 being non empty Nat
for b2 being FinSequence of NAT
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_P b2,b1 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationA (IDEAoperationC (IDEAoperationB b4,b2,b1)),b2,b1 );

definition
let c1 be non empty Nat;
let c2 be FinSequence of NAT ;
func IDEA_Q c2,c1 -> Function of MESSAGES , MESSAGES means :Def16: :: IDEA_1:def 16
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationB (IDEAoperationA (IDEAoperationC b1),a2,a1),a2,a1;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationB (IDEAoperationA (IDEAoperationC b2),c2,c1),c2,c1
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationB (IDEAoperationA (IDEAoperationC b3),c2,c1),c2,c1 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationB (IDEAoperationA (IDEAoperationC b3),c2,c1),c2,c1 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def16 defines IDEA_Q IDEA_1:def 16 :
for b1 being non empty Nat
for b2 being FinSequence of NAT
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_Q b2,b1 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationB (IDEAoperationA (IDEAoperationC b4),b2,b1),b2,b1 );

definition
let c1, c2 be Nat;
let c3 be non empty Nat;
let c4 be Matrix of c2,6, NAT ;
func IDEA_P_F c4,c3,c1 -> FinSequence means :Def17: :: IDEA_1:def 17
( len a5 = a1 & ( for b1 being Nat st b1 in dom a5 holds
a5 . b1 = IDEA_P (Line a4,b1),a3 ) );
existence
ex b1 being FinSequence st
( len b1 = c1 & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = IDEA_P (Line c4,b2),c3 ) )
proof end;
uniqueness
for b1, b2 being FinSequence st len b1 = c1 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = IDEA_P (Line c4,b3),c3 ) & len b2 = c1 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = IDEA_P (Line c4,b3),c3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def17 defines IDEA_P_F IDEA_1:def 17 :
for b1, b2 being Nat
for b3 being non empty Nat
for b4 being Matrix of b2,6, NAT
for b5 being FinSequence holds
( b5 = IDEA_P_F b4,b3,b1 iff ( len b5 = b1 & ( for b6 being Nat st b6 in dom b5 holds
b5 . b6 = IDEA_P (Line b4,b6),b3 ) ) );

registration
let c1, c2 be Nat;
let c3 be non empty Nat;
let c4 be Matrix of c2,6, NAT ;
cluster IDEA_P_F a4,a3,a1 -> Function-yielding ;
coherence
IDEA_P_F c4,c3,c1 is Function-yielding
proof end;
end;

definition
let c1, c2 be Nat;
let c3 be non empty Nat;
let c4 be Matrix of c2,6, NAT ;
func IDEA_Q_F c4,c3,c1 -> FinSequence means :Def18: :: IDEA_1:def 18
( len a5 = a1 & ( for b1 being Nat st b1 in dom a5 holds
a5 . b1 = IDEA_Q (Line a4,((a1 -' b1) + 1)),a3 ) );
existence
ex b1 being FinSequence st
( len b1 = c1 & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = IDEA_Q (Line c4,((c1 -' b2) + 1)),c3 ) )
proof end;
uniqueness
for b1, b2 being FinSequence st len b1 = c1 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = IDEA_Q (Line c4,((c1 -' b3) + 1)),c3 ) & len b2 = c1 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = IDEA_Q (Line c4,((c1 -' b3) + 1)),c3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def18 defines IDEA_Q_F IDEA_1:def 18 :
for b1, b2 being Nat
for b3 being non empty Nat
for b4 being Matrix of b2,6, NAT
for b5 being FinSequence holds
( b5 = IDEA_Q_F b4,b3,b1 iff ( len b5 = b1 & ( for b6 being Nat st b6 in dom b5 holds
b5 . b6 = IDEA_Q (Line b4,((b1 -' b6) + 1)),b3 ) ) );

registration
let c1, c2 be Nat;
let c3 be non empty Nat;
let c4 be Matrix of c2,6, NAT ;
cluster IDEA_Q_F a4,a3,a1 -> Function-yielding ;
coherence
IDEA_Q_F c4,c3,c1 is Function-yielding
proof end;
end;

definition
let c1 be FinSequence of NAT ;
let c2 be Nat;
func IDEA_PS c1,c2 -> Function of MESSAGES , MESSAGES means :Def19: :: IDEA_1:def 19
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationA b1,a1,a2;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationA b2,c1,c2
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationA b3,c1,c2 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationA b3,c1,c2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def19 defines IDEA_PS IDEA_1:def 19 :
for b1 being FinSequence of NAT
for b2 being Nat
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_PS b1,b2 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationA b4,b1,b2 );

definition
let c1 be FinSequence of NAT ;
let c2 be Nat;
func IDEA_QS c1,c2 -> Function of MESSAGES , MESSAGES means :Def20: :: IDEA_1:def 20
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationA b1,a1,a2;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationA b2,c1,c2
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationA b3,c1,c2 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationA b3,c1,c2 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def20 defines IDEA_QS IDEA_1:def 20 :
for b1 being FinSequence of NAT
for b2 being Nat
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_QS b1,b2 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationA b4,b1,b2 );

definition
let c1 be non empty Nat;
let c2 be FinSequence of NAT ;
func IDEA_PE c2,c1 -> Function of MESSAGES , MESSAGES means :Def21: :: IDEA_1:def 21
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationA (IDEAoperationB b1,a2,a1),a2,a1;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationA (IDEAoperationB b2,c2,c1),c2,c1
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationA (IDEAoperationB b3,c2,c1),c2,c1 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationA (IDEAoperationB b3,c2,c1),c2,c1 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def21 defines IDEA_PE IDEA_1:def 21 :
for b1 being non empty Nat
for b2 being FinSequence of NAT
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_PE b2,b1 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationA (IDEAoperationB b4,b2,b1),b2,b1 );

definition
let c1 be non empty Nat;
let c2 be FinSequence of NAT ;
func IDEA_QE c2,c1 -> Function of MESSAGES , MESSAGES means :Def22: :: IDEA_1:def 22
for b1 being FinSequence of NAT holds a3 . b1 = IDEAoperationB (IDEAoperationA b1,a2,a1),a2,a1;
existence
ex b1 being Function of MESSAGES , MESSAGES st
for b2 being FinSequence of NAT holds b1 . b2 = IDEAoperationB (IDEAoperationA b2,c2,c1),c2,c1
proof end;
uniqueness
for b1, b2 being Function of MESSAGES , MESSAGES st ( for b3 being FinSequence of NAT holds b1 . b3 = IDEAoperationB (IDEAoperationA b3,c2,c1),c2,c1 ) & ( for b3 being FinSequence of NAT holds b2 . b3 = IDEAoperationB (IDEAoperationA b3,c2,c1),c2,c1 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def22 defines IDEA_QE IDEA_1:def 22 :
for b1 being non empty Nat
for b2 being FinSequence of NAT
for b3 being Function of MESSAGES , MESSAGES holds
( b3 = IDEA_QE b2,b1 iff for b4 being FinSequence of NAT holds b3 . b4 = IDEAoperationB (IDEAoperationA b4,b2,b1),b2,b1 );

theorem Th34: :: IDEA_1:34
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 1 is_expressible_by b1 & b3 . 2 is_expressible_by b1 & b3 . 3 is_expressible_by b1 & b3 . 4 is_expressible_by b1 & b3 . 5 is_expressible_by b1 & b3 . 6 is_expressible_by b1 & b4 . 1 = INV_MOD (b3 . 1),b1 & b4 . 2 = NEG_MOD (b3 . 3),b1 & b4 . 3 = NEG_MOD (b3 . 2),b1 & b4 . 4 = INV_MOD (b3 . 4),b1 & b4 . 5 = b3 . 5 & b4 . 6 = b3 . 6 holds
((IDEA_Q b4,b1) * (IDEA_P b3,b1)) . b2 = b2
proof end;

theorem Th35: :: IDEA_1:35
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 1 is_expressible_by b1 & b3 . 2 is_expressible_by b1 & b3 . 3 is_expressible_by b1 & b3 . 4 is_expressible_by b1 & b4 . 1 = INV_MOD (b3 . 1),b1 & b4 . 2 = NEG_MOD (b3 . 2),b1 & b4 . 3 = NEG_MOD (b3 . 3),b1 & b4 . 4 = INV_MOD (b3 . 4),b1 holds
((IDEA_QS b4,b1) * (IDEA_PS b3,b1)) . b2 = b2
proof end;

theorem Th36: :: IDEA_1:36
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st (2 to_power b1) + 1 is prime & len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 & b3 . 1 is_expressible_by b1 & b3 . 2 is_expressible_by b1 & b3 . 3 is_expressible_by b1 & b3 . 4 is_expressible_by b1 & b3 . 5 is_expressible_by b1 & b3 . 6 is_expressible_by b1 & b4 . 1 = INV_MOD (b3 . 1),b1 & b4 . 2 = NEG_MOD (b3 . 2),b1 & b4 . 3 = NEG_MOD (b3 . 3),b1 & b4 . 4 = INV_MOD (b3 . 4),b1 & b4 . 5 = b3 . 5 & b4 . 6 = b3 . 6 holds
((IDEA_QE b4,b1) * (IDEA_PE b3,b1)) . b2 = b2
proof end;

theorem Th37: :: IDEA_1:37
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds IDEA_P_F b3,b1,(b4 + 1) = (IDEA_P_F b3,b1,b4) ^ <*(IDEA_P (Line b3,(b4 + 1)),b1)*>
proof end;

theorem Th38: :: IDEA_1:38
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds IDEA_Q_F b3,b1,(b4 + 1) = <*(IDEA_Q (Line b3,(b4 + 1)),b1)*> ^ (IDEA_Q_F b3,b1,b4)
proof end;

theorem Th39: :: IDEA_1:39
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds IDEA_P_F b3,b1,b4 is FuncSeq-like FinSequence
proof end;

theorem Th40: :: IDEA_1:40
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds IDEA_Q_F b3,b1,b4 is FuncSeq-like FinSequence
proof end;

theorem Th41: :: IDEA_1:41
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat st b4 <> 0 holds
IDEA_P_F b3,b1,b4 is FuncSequence of MESSAGES , MESSAGES
proof end;

theorem Th42: :: IDEA_1:42
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat st b4 <> 0 holds
IDEA_Q_F b3,b1,b4 is FuncSequence of MESSAGES , MESSAGES
proof end;

theorem Th43: :: IDEA_1:43
for b1 being non empty Nat
for b2, b3, b4 being FinSequence of NAT st b2 = (IDEA_P b4,b1) . b3 & len b3 >= 4 holds
( len b2 >= 4 & b2 . 1 is_expressible_by b1 & b2 . 2 is_expressible_by b1 & b2 . 3 is_expressible_by b1 & b2 . 4 is_expressible_by b1 )
proof end;

theorem Th44: :: IDEA_1:44
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds
( rng (compose (IDEA_P_F b3,b1,b4),MESSAGES ) c= MESSAGES & dom (compose (IDEA_P_F b3,b1,b4),MESSAGES ) = MESSAGES )
proof end;

theorem Th45: :: IDEA_1:45
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat holds
( rng (compose (IDEA_Q_F b3,b1,b4),MESSAGES ) c= MESSAGES & dom (compose (IDEA_Q_F b3,b1,b4),MESSAGES ) = MESSAGES )
proof end;

theorem Th46: :: IDEA_1:46
for b1 being non empty Nat
for b2 being FinSequence of NAT
for b3 being Nat
for b4 being Matrix of b3,6, NAT
for b5 being Nat
for b6 being FinSequence of NAT st b6 = (compose (IDEA_P_F b4,b1,b5),MESSAGES ) . b2 & len b2 >= 4 holds
len b6 >= 4
proof end;

theorem Th47: :: IDEA_1:47
for b1 being non empty Nat
for b2 being Nat
for b3 being Matrix of b2,6, NAT
for b4 being Nat
for b5, b6 being FinSequence of NAT st b5 = (compose (IDEA_P_F b3,b1,b4),MESSAGES ) . b6 & len b6 >= 4 & b6 . 1 is_expressible_by b1 & b6 . 2 is_expressible_by b1 & b6 . 3 is_expressible_by b1 & b6 . 4 is_expressible_by b1 holds
( len b5 >= 4 & b5 . 1 is_expressible_by b1 & b5 . 2 is_expressible_by b1 & b5 . 3 is_expressible_by b1 & b5 . 4 is_expressible_by b1 )
proof end;

theorem Th48: :: IDEA_1:48
for b1 being non empty Nat
for b2 being Nat
for b3, b4 being Matrix of b2,6, NAT
for b5 being Nat
for b6 being FinSequence of NAT st b2 >= b5 & (2 to_power b1) + 1 is prime & len b6 >= 4 & b6 . 1 is_expressible_by b1 & b6 . 2 is_expressible_by b1 & b6 . 3 is_expressible_by b1 & b6 . 4 is_expressible_by b1 & ( for b7 being Nat st b7 <= b5 holds
( b3 * b7,1 is_expressible_by b1 & b3 * b7,2 is_expressible_by b1 & b3 * b7,3 is_expressible_by b1 & b3 * b7,4 is_expressible_by b1 & b3 * b7,5 is_expressible_by b1 & b3 * b7,6 is_expressible_by b1 & b4 * b7,1 is_expressible_by b1 & b4 * b7,2 is_expressible_by b1 & b4 * b7,3 is_expressible_by b1 & b4 * b7,4 is_expressible_by b1 & b4 * b7,5 is_expressible_by b1 & b4 * b7,6 is_expressible_by b1 & b4 * b7,1 = INV_MOD (b3 * b7,1),b1 & b4 * b7,2 = NEG_MOD (b3 * b7,3),b1 & b4 * b7,3 = NEG_MOD (b3 * b7,2),b1 & b4 * b7,4 = INV_MOD (b3 * b7,4),b1 & b3 * b7,5 = b4 * b7,5 & b3 * b7,6 = b4 * b7,6 ) ) holds
(compose ((IDEA_P_F b3,b1,b5) ^ (IDEA_Q_F b4,b1,b5)),MESSAGES ) . b6 = b6
proof end;

theorem Th49: :: IDEA_1:49
for b1 being non empty Nat
for b2 being Nat
for b3, b4 being Matrix of b2,6, NAT
for b5 being Nat
for b6, b7, b8, b9, b10 being FinSequence of NAT st b2 >= b5 & (2 to_power b1) + 1 is prime & len b10 >= 4 & b10 . 1 is_expressible_by b1 & b10 . 2 is_expressible_by b1 & b10 . 3 is_expressible_by b1 & b10 . 4 is_expressible_by b1 & ( for b11 being Nat st b11 <= b5 holds
( b3 * b11,1 is_expressible_by b1 & b3 * b11,2 is_expressible_by b1 & b3 * b11,3 is_expressible_by b1 & b3 * b11,4 is_expressible_by b1 & b3 * b11,5 is_expressible_by b1 & b3 * b11,6 is_expressible_by b1 & b4 * b11,1 is_expressible_by b1 & b4 * b11,2 is_expressible_by b1 & b4 * b11,3 is_expressible_by b1 & b4 * b11,4 is_expressible_by b1 & b4 * b11,5 is_expressible_by b1 & b4 * b11,6 is_expressible_by b1 & b4 * b11,1 = INV_MOD (b3 * b11,1),b1 & b4 * b11,2 = NEG_MOD (b3 * b11,3),b1 & b4 * b11,3 = NEG_MOD (b3 * b11,2),b1 & b4 * b11,4 = INV_MOD (b3 * b11,4),b1 & b3 * b11,5 = b4 * b11,5 & b3 * b11,6 = b4 * b11,6 ) ) & b6 . 1 is_expressible_by b1 & b6 . 2 is_expressible_by b1 & b6 . 3 is_expressible_by b1 & b6 . 4 is_expressible_by b1 & b7 . 1 = INV_MOD (b6 . 1),b1 & b7 . 2 = NEG_MOD (b6 . 2),b1 & b7 . 3 = NEG_MOD (b6 . 3),b1 & b7 . 4 = INV_MOD (b6 . 4),b1 & b8 . 1 is_expressible_by b1 & b8 . 2 is_expressible_by b1 & b8 . 3 is_expressible_by b1 & b8 . 4 is_expressible_by b1 & b8 . 5 is_expressible_by b1 & b8 . 6 is_expressible_by b1 & b9 . 1 = INV_MOD (b8 . 1),b1 & b9 . 2 = NEG_MOD (b8 . 2),b1 & b9 . 3 = NEG_MOD (b8 . 3),b1 & b9 . 4 = INV_MOD (b8 . 4),b1 & b9 . 5 = b8 . 5 & b9 . 6 = b8 . 6 holds
((IDEA_QS b7,b1) * ((compose (IDEA_Q_F b4,b1,b5),MESSAGES ) * ((IDEA_QE b9,b1) * ((IDEA_PE b8,b1) * ((compose (IDEA_P_F b3,b1,b5),MESSAGES ) * (IDEA_PS b6,b1)))))) . b10 = b10
proof end;