:: ALGSTR_3 semantic presentation

definition
attr a1 is strict;
struct TernaryFieldStr -> ZeroStr ;
aggr TernaryFieldStr(# carrier, Zero, unity, ternary #) -> TernaryFieldStr ;
sel unity a1 -> Element of the carrier of a1;
sel ternary a1 -> TriOp of the carrier of a1;
end;

registration
cluster non empty TernaryFieldStr ;
existence
not for b1 being TernaryFieldStr holds b1 is empty
proof
consider c1 being non empty set , c2, c3 being Element of c1, c4 being TriOp of c1;
take TernaryFieldStr c1,c2,c3,c4 ;
thus not the carrier of (TernaryFieldStr c1,c2,c3,c4) is empty ; :: uses STRUCT_0:def 1
end;
end;

definition
let c1 be non empty TernaryFieldStr ;
mode Scalar is Element of a1;
end;

definition
let c1 be non empty TernaryFieldStr ;
let c2, c3, c4 be Scalar of c1;
func Tern a2,a3,a4 -> Scalar of a1 equals :: ALGSTR_3:def 1
the ternary of a1 . a2,a3,a4;
correctness
coherence
the ternary of c1 . c2,c3,c4 is Scalar of c1
;
;
end;

:: deftheorem defines Tern ALGSTR_3:def 1 :
for b1 being non empty TernaryFieldStr
for b2, b3, b4 being Scalar of b1 holds Tern b2,b3,b4 = the ternary of b1 . b2,b3,b4;

definition
let c1 be non empty TernaryFieldStr ;
canceled;
func 1_ a1 -> Scalar of a1 equals :: ALGSTR_3:def 3
the unity of a1;
correctness
coherence
the unity of c1 is Scalar of c1
;
;
end;

:: deftheorem ALGSTR_3:def 2 :
canceled;

:: deftheorem defines 1_ ALGSTR_3:def 3 :
for b1 being non empty TernaryFieldStr holds 1_ b1 = the unity of b1;

definition
func ternaryreal -> TriOp of REAL means :E1: :: ALGSTR_3:def 4
for b1, b2, b3 being Real holds a1 . b1,b2,b3 = (b1 * b2) + b3;
existence
ex b1 being TriOp of REAL st
for b2, b3, b4 being Real holds b1 . b2,b3,b4 = (b2 * b3) + b4
proof
deffunc H1( Real, Real, Real) -> Element of REAL = (a1 * a2) + a3;
ex b1 being TriOp of REAL st
for b2, b3, b4 being Real holds b1 . b2,b3,b4 = H1(b2,b3,b4) from MULTOP_1:sch 4();
hence ex b1 being TriOp of REAL st
for b2, b3, b4 being Real holds b1 . b2,b3,b4 = (b2 * b3) + b4 ;
end;
uniqueness
for b1, b2 being TriOp of REAL holds
( ( for b3, b4, b5 being Real holds b1 . b3,b4,b5 = (b3 * b4) + b5 & for b3, b4, b5 being Real holds b2 . b3,b4,b5 = (b3 * b4) + b5 ) implies ( b1 = b2 ) )
proof
let c1, c2 be TriOp of REAL ;
assume that E1: for b1, b2, b3 being Real holds c1 . b1,b2,b3 = (b1 * b2) + b3
and E2: for b1, b2, b3 being Real holds c2 . b1,b2,b3 = (b1 * b2) + b3 ;
for b1, b2, b3 being Real holds c1 . b1,b2,b3 = c2 . b1,b2,b3
proof
let c3, c4, c5 be Real;
thus c1 . c3,c4,c5 = (c3 * c4) + c5 by E1
.= c2 . c3,c4,c5 by E2 ;
end;
hence c1 = c2 by MULTOP_1:4;
end;
end;

:: deftheorem E1 defines ternaryreal ALGSTR_3:def 4 :
for b1 being TriOp of REAL holds
( b1 = ternaryreal iff for b2, b3, b4 being Real holds b1 . b2,b3,b4 = (b2 * b3) + b4 );

definition
func TernaryFieldEx -> strict TernaryFieldStr equals :: ALGSTR_3:def 5
TernaryFieldStr REAL ,0,1,ternaryreal ;
correctness
coherence
TernaryFieldStr REAL ,0,1,ternaryreal is strict TernaryFieldStr
;
;
end;

:: deftheorem defines TernaryFieldEx ALGSTR_3:def 5 :
TernaryFieldEx = TernaryFieldStr REAL ,0,1,ternaryreal ;

registration
cluster TernaryFieldEx -> non empty strict ;
coherence
not TernaryFieldEx is empty
proof
thus not the carrier of TernaryFieldEx is empty ; :: uses STRUCT_0:def 1
end;
end;

definition
let c1, c2, c3 be Scalar of TernaryFieldEx ;
func tern a1,a2,a3 -> Scalar of TernaryFieldEx equals :: ALGSTR_3:def 6
the ternary of TernaryFieldEx . a1,a2,a3;
correctness
coherence
the ternary of TernaryFieldEx . c1,c2,c3 is Scalar of TernaryFieldEx
;
;
end;

:: deftheorem defines tern ALGSTR_3:def 6 :
for b1, b2, b3 being Scalar of TernaryFieldEx holds tern b1,b2,b3 = the ternary of TernaryFieldEx . b1,b2,b3;

theorem :: ALGSTR_3:1
canceled;

theorem :: ALGSTR_3:2
canceled;

theorem E2: :: ALGSTR_3:3
for b1, b2, b3, b4 being Real holds
not ( b1 <> b2 & for b5 being Real holds
not (b1 * b5) + b3 = (b2 * b5) + b4 )
proof
let c1, c2, c3, c4 be Real;
assume E3: c1 <> c2 ;
set c5 = (c4 - c3) / (c1 - c2);
c1 - c2 <> 0 by E3;
then E4: (c1 - c2) * ((c4 - c3) / (c1 - c2)) = c4 - c3 by XCMPLX_1:88;
reconsider c6 = (c4 - c3) / (c1 - c2) as Real ;
(c1 * c6) - (c2 * c6) = c4 - c3 by E4;
then (c1 * c6) + (- (c2 * c6)) = c4 - c3 ;
then E5: c1 * c6 = (c4 - c3) - (- (c2 * c6))
.= ((c2 * c6) + c4) + (- c3) ;
take c6 ;
thus (c1 * c6) + c3 = (c2 * c6) + c4 by E5;
end;

theorem :: ALGSTR_3:4
canceled;

theorem E3: :: ALGSTR_3:5
for b1, b2, b3 being Scalar of TernaryFieldEx
for b4, b5, b6 being Real holds
( ( b1 = b4 & b2 = b5 & b3 = b6 ) implies ( Tern b1,b2,b3 = (b4 * b5) + b6 ) )
proof
let c1, c2, c3 be Scalar of TernaryFieldEx ;
let c4, c5, c6 be Real;
assume ( c1 = c4 & c2 = c5 & c3 = c6 ) ;
hence Tern c1,c2,c3 = ternaryreal . c4,c5,c6
.= (c4 * c5) + c6 by E1 ;

end;

theorem E4: :: ALGSTR_3:6
0 = 0. TernaryFieldEx by RLVECT_1:def 2;

theorem :: ALGSTR_3:7
1 = 1_ TernaryFieldEx ;

E5: for b1 being Scalar of TernaryFieldEx holds Tern b1,(1_ TernaryFieldEx ),(0. TernaryFieldEx ) = b1
proof
let c1 be Scalar of TernaryFieldEx ;
reconsider c2 = c1 as Real ;
thus Tern c1,(1_ TernaryFieldEx ),(0. TernaryFieldEx ) = ternaryreal . c2,1,0 by E4
.= (c2 * 1) + 0 by E1
.= c1 ;
end;

E6: for b1 being Scalar of TernaryFieldEx holds Tern (1_ TernaryFieldEx ),b1,(0. TernaryFieldEx ) = b1
proof
let c1 be Scalar of TernaryFieldEx ;
reconsider c2 = c1 as Real ;
thus Tern (1_ TernaryFieldEx ),c1,(0. TernaryFieldEx ) = ternaryreal . 1,c2,0 by E4
.= (c2 * 1) + 0 by E1
.= c1 ;
end;

E7: for b1, b2 being Scalar of TernaryFieldEx holds Tern b1,(0. TernaryFieldEx ),b2 = b2
proof
let c1, c2 be Scalar of TernaryFieldEx ;
reconsider c3 = c1, c4 = c2 as Real ;
thus Tern c1,(0. TernaryFieldEx ),c2 = ternaryreal . c3,0,c4 by E4
.= (c3 * 0) + c4 by E1
.= c2 ;
end;

E8: for b1, b2 being Scalar of TernaryFieldEx holds Tern (0. TernaryFieldEx ),b1,b2 = b2
proof
let c1, c2 be Scalar of TernaryFieldEx ;
reconsider c3 = c1, c4 = c2 as Real ;
thus Tern (0. TernaryFieldEx ),c1,c2 = ternaryreal . 0,c3,c4 by E4
.= (0 * c3) + c4 by E1
.= c2 ;
end;

E9: for b1, b2, b3 being Scalar of TernaryFieldEx holds
ex b4 being Scalar of TernaryFieldEx st Tern b1,b2,b4 = b3
proof
let c1, c2, c3 be Scalar of TernaryFieldEx ;
reconsider c4 = c1, c5 = c2, c6 = c3 as Real ;
reconsider c7 = c6 - (c4 * c5) as Real ;
E10: c6 = (c4 * c5) + c7 ;
reconsider c8 = c7 as Scalar of TernaryFieldEx ;
take c8 ;
thus Tern c1,c2,c8 = ternaryreal . c4,c5,c7
.= c3 by E10, E1 ;
end;

E10: for b1, b2, b3, b4 being Scalar of TernaryFieldEx holds
( Tern b1,b2,b3 = Tern b1,b2,b4 implies b3 = b4 )
proof
let c1, c2, c3, c4 be Scalar of TernaryFieldEx ;
reconsider c5 = c1, c6 = c2, c7 = c3, c8 = c4 as Real ;
E11: Tern c1,c2,c3 = (c5 * c6) + c7 by E3;
Tern c1,c2,c4 = (c5 * c6) + c8 by E3;
hence ( Tern c1,c2,c3 = Tern c1,c2,c4 implies c3 = c4 ) by E11, XCMPLX_1:2;
end;

E11: for b1, b2 being Scalar of TernaryFieldEx holds
( b1 <> b2 implies for b3, b4 being Scalar of TernaryFieldEx holds
ex b5, b6 being Scalar of TernaryFieldEx st
( Tern b5,b1,b6 = b3 & Tern b5,b2,b6 = b4 ) )
proof
let c1, c2 be Scalar of TernaryFieldEx ;
assume E12: c1 <> c2 ;
let c3, c4 be Scalar of TernaryFieldEx ;
reconsider c5 = c1, c6 = c2, c7 = c3, c8 = c4 as Real ;
set c9 = (c8 - c7) / (c6 - c5);
set c10 = c7 - (c5 * ((c8 - c7) / (c6 - c5)));
reconsider c11 = (c8 - c7) / (c6 - c5), c12 = c7 - (c5 * ((c8 - c7) / (c6 - c5))) as Scalar of TernaryFieldEx ;
take c11 ;
take c12 ;
thus Tern c11,c1,c12 = ternaryreal . ((c8 - c7) / (c6 - c5)),c5,(c7 - (c5 * ((c8 - c7) / (c6 - c5))))
.= (((c8 - c7) / (c6 - c5)) * c5) + ((- (((c8 - c7) / (c6 - c5)) * c5)) + c7) by E1
.= c7 + 0
.= c3 ;
E13: c6 - c5 <> 0 by E12;
thus Tern c11,c2,c12 = ternaryreal . ((c8 - c7) / (c6 - c5)),c6,(c7 - (c5 * ((c8 - c7) / (c6 - c5))))
.= (((c8 - c7) / (c6 - c5)) * c6) + ((- (c5 * ((c8 - c7) / (c6 - c5)))) + c7) by E1
.= (((c8 - c7) / (c6 - c5)) * (c6 - c5)) + c7
.= (c8 - c7) + c7 by E13, XCMPLX_1:88
.= c4 ;
end;

E12: for b1, b2 being Scalar of TernaryFieldEx holds
( b1 <> b2 implies for b3, b4 being Scalar of TernaryFieldEx holds
ex b5 being Scalar of TernaryFieldEx st Tern b1,b5,b3 = Tern b2,b5,b4 )
proof
let c1, c2 be Scalar of TernaryFieldEx ;
assume E13: c1 <> c2 ;
let c3, c4 be Scalar of TernaryFieldEx ;
reconsider c5 = c1, c6 = c2, c7 = c3, c8 = c4 as Real ;
consider c9 being Real such that
E14: (c5 * c9) + c7 = (c6 * c9) + c8 by E13, E2;
reconsider c10 = c9 as Scalar of TernaryFieldEx ;
( Tern c1,c10,c3 = (c5 * c9) + c7 & Tern c2,c10,c4 = (c6 * c9) + c8 ) by E3;
hence ex b1 being Scalar of TernaryFieldEx st Tern c1,b1,c3 = Tern c2,b1,c4 by E14;
end;

E13: for b1, b2, b3, b4, b5, b6 being Scalar of TernaryFieldEx holds
not ( Tern b3,b1,b5 = Tern b4,b1,b6 & Tern b3,b2,b5 = Tern b4,b2,b6 & not b1 = b2 & not b3 = b4 )
proof
let c1, c2, c3, c4, c5, c6 be Scalar of TernaryFieldEx ;
assume that E14: Tern c3,c1,c5 = Tern c4,c1,c6
and E15: Tern c3,c2,c5 = Tern c4,c2,c6 ;
reconsider c7 = c1, c8 = c2, c9 = c3, c10 = c4, c11 = c5, c12 = c6 as Real ;
( Tern c3,c1,c5 = (c9 * c7) + c11 & Tern c4,c1,c6 = (c10 * c7) + c12 & Tern c3,c2,c5 = (c9 * c8) + c11 & Tern c4,c2,c6 = (c10 * c8) + c12 ) by E3;
then (c9 * c7) + (c11 - ((c9 * c8) + c11)) = ((c10 * c7) + c12) - ((c10 * c8) + c12) by E14, E15, XCMPLX_1:29;
then (c9 * c7) + (- (c9 * c8)) = (c10 * c7) + (- (c10 * c8)) ;
then (c9 * c7) - (c9 * c8) = (c10 * c7) - (c10 * c8) ;
then c9 * (c7 - c8) = c10 * (c7 - c8) ;
then ( c9 = c10 or c7 - c8 = 0 ) by XCMPLX_1:5;
hence not ( not c1 = c2 & not c3 = c4 ) ;
end;

definition
let c1 be non empty TernaryFieldStr ;
attr a1 is Ternary-Field-like means :E14: :: ALGSTR_3:def 7
( 0. a1 <> 1_ a1 & for b1 being Scalar of a1 holds Tern b1,(1_ a1),(0. a1) = b1 & for b1 being Scalar of a1 holds Tern (1_ a1),b1,(0. a1) = b1 & for b1, b2 being Scalar of a1 holds Tern b1,(0. a1),b2 = b2 & for b1, b2 being Scalar of a1 holds Tern (0. a1),b1,b2 = b2 & for b1, b2, b3 being Scalar of a1 holds
ex b4 being Scalar of a1 st Tern b1,b2,b4 = b3 & for b1, b2, b3, b4 being Scalar of a1 holds
( Tern b1,b2,b3 = Tern b1,b2,b4 implies b3 = b4 ) & for b1, b2 being Scalar of a1 holds
( b1 <> b2 implies for b3, b4 being Scalar of a1 holds
ex b5, b6 being Scalar of a1 st
( Tern b5,b1,b6 = b3 & Tern b5,b2,b6 = b4 ) ) & for b1, b2 being Scalar of a1 holds
( b1 <> b2 implies for b3, b4 being Scalar of a1 holds
ex b5 being Scalar of a1 st Tern b1,b5,b3 = Tern b2,b5,b4 ) & for b1, b2, b3, b4, b5, b6 being Scalar of a1 holds
not ( Tern b3,b1,b5 = Tern b4,b1,b6 & Tern b3,b2,b5 = Tern b4,b2,b6 & not b1 = b2 & not b3 = b4 ) );
end;

:: deftheorem E14 defines Ternary-Field-like ALGSTR_3:def 7 :
for b1 being non empty TernaryFieldStr holds
( b1 is Ternary-Field-like iff ( 0. b1 <> 1_ b1 & for b2 being Scalar of b1 holds Tern b2,(1_ b1),(0. b1) = b2 & for b2 being Scalar of b1 holds Tern (1_ b1),b2,(0. b1) = b2 & for b2, b3 being Scalar of b1 holds Tern b2,(0. b1),b3 = b3 & for b2, b3 being Scalar of b1 holds Tern (0. b1),b2,b3 = b3 & for b2, b3, b4 being Scalar of b1 holds
ex b5 being Scalar of b1 st Tern b2,b3,b5 = b4 & for b2, b3, b4, b5 being Scalar of b1 holds
( Tern b2,b3,b4 = Tern b2,b3,b5 implies b4 = b5 ) & for b2, b3 being Scalar of b1 holds
( b2 <> b3 implies for b4, b5 being Scalar of b1 holds
ex b6, b7 being Scalar of b1 st
( Tern b6,b2,b7 = b4 & Tern b6,b3,b7 = b5 ) ) & for b2, b3 being Scalar of b1 holds
( b2 <> b3 implies for b4, b5 being Scalar of b1 holds
ex b6 being Scalar of b1 st Tern b2,b6,b4 = Tern b3,b6,b5 ) & for b2, b3, b4, b5, b6, b7 being Scalar of b1 holds
not ( Tern b4,b2,b6 = Tern b5,b2,b7 & Tern b4,b3,b6 = Tern b5,b3,b7 & not b2 = b3 & not b4 = b5 ) ) );

registration
cluster non empty strict Ternary-Field-like TernaryFieldStr ;
existence
ex b1 being non empty TernaryFieldStr st
( b1 is strict & b1 is Ternary-Field-like )
proof
TernaryFieldEx is Ternary-Field-like by E14, E5, E6, E7, E8, E9, E10, E11, E12, E13, E4;
hence ex b1 being non empty TernaryFieldStr st
( b1 is strict & b1 is Ternary-Field-like ) ;
end;
end;

definition
mode Ternary-Field is non empty Ternary-Field-like TernaryFieldStr ;
end;

theorem :: ALGSTR_3:8
for b1 being Ternary-Field
for b2, b3, b4, b5, b6, b7 being Scalar of b1 holds
( ( Tern b4,b2,b5 = Tern b6,b2,b7 & Tern b4,b3,b5 = Tern b6,b3,b7 ) implies ( not b2 <> b3 or ( b4 = b6 & b5 = b7 ) ) )
proof
let c1 be Ternary-Field;
let c2, c3, c4, c5, c6, c7 be Scalar of c1;
assume that E15: c2 <> c3
and E16: Tern c4,c2,c5 = Tern c6,c2,c7
and E17: Tern c4,c3,c5 = Tern c6,c3,c7 ;
c4 = c6 by E15, E16, E17, E14;
hence ( c4 = c6 & c5 = c7 ) by E16, E14;
end;

theorem :: ALGSTR_3:9
canceled;

theorem :: ALGSTR_3:10
canceled;

theorem :: ALGSTR_3:11
for b1 being Ternary-Field
for b2 being Scalar of b1 holds
( b2 <> 0. b1 implies for b3, b4 being Scalar of b1 holds
ex b5 being Scalar of b1 st Tern b2,b5,b3 = b4 )
proof
let c1 be Ternary-Field;
let c2 be Scalar of c1;
assume E15: c2 <> 0. c1 ;
let c3, c4 be Scalar of c1;
consider c5 being Scalar of c1 such that
E16: Tern c2,c5,c3 = Tern (0. c1),c5,c4 by E15, E14;
take c5 ;
thus Tern c2,c5,c3 = c4 by E16, E14;
end;

theorem :: ALGSTR_3:12
for b1 being Ternary-Field
for b2, b3, b4, b5 being Scalar of b1 holds
( ( Tern b2,b3,b4 = Tern b2,b5,b4 ) implies ( not b2 <> 0. b1 or b3 = b5 ) )
proof
let c1 be Ternary-Field;
let c2, c3, c4, c5 be Scalar of c1;
assume that E15: c2 <> 0. c1
and E16: Tern c2,c3,c4 = Tern c2,c5,c4 ;
set c6 = Tern c2,c3,c4;
( Tern c2,c3,c4 = Tern (0. c1),c3,(Tern c2,c3,c4) & Tern c2,c5,c4 = Tern (0. c1),c5,(Tern c2,c3,c4) ) by E16, E14;
hence c3 = c5 by E15, E14;
end;

theorem :: ALGSTR_3:13
for b1 being Ternary-Field
for b2 being Scalar of b1 holds
( b2 <> 0. b1 implies for b3, b4 being Scalar of b1 holds
ex b5 being Scalar of b1 st Tern b5,b2,b3 = b4 )
proof
let c1 be Ternary-Field;
let c2 be Scalar of c1;
assume E15: c2 <> 0. c1 ;
let c3, c4 be Scalar of c1;
consider c5, c6 being Scalar of c1 such that
E16: ( Tern c5,c2,c6 = c4 & Tern c5,(0. c1),c6 = c3 ) by E15, E14;
take c5 ;
thus Tern c5,c2,c3 = c4 by E16, E14;
end;

theorem :: ALGSTR_3:14
for b1 being Ternary-Field
for b2, b3, b4, b5 being Scalar of b1 holds
( ( Tern b3,b2,b4 = Tern b5,b2,b4 ) implies ( not b2 <> 0. b1 or b3 = b5 ) )
proof
let c1 be Ternary-Field;
let c2, c3, c4, c5 be Scalar of c1;
assume E15: ( c2 <> 0. c1 & Tern c3,c2,c4 = Tern c5,c2,c4 ) ;
( Tern c3,(0. c1),c4 = c4 & Tern c5,(0. c1),c4 = c4 ) by E14;
hence c3 = c5 by E15, E14;
end;