:: BINOM semantic presentation

definition
let c1 be non empty LoopStr ;
canceled;
canceled;
attr a1 is add-cancelable means :Def3: :: BINOM:def 3
for b1, b2, b3 being Element of a1 holds
( ( b1 + b2 = b1 + b3 implies b2 = b3 ) & ( b2 + b1 = b3 + b1 implies b2 = b3 ) );
end;

:: deftheorem Def1 BINOM:def 1 :
canceled;

:: deftheorem Def2 BINOM:def 2 :
canceled;

:: deftheorem Def3 defines add-cancelable BINOM:def 3 :
for b1 being non empty LoopStr holds
( b1 is add-cancelable iff for b2, b3, b4 being Element of b1 holds
( ( b2 + b3 = b2 + b4 implies b3 = b4 ) & ( b3 + b2 = b4 + b2 implies b3 = b4 ) ) );

registration
cluster non empty add-left-cancelable LoopStr ;
existence
ex b1 being non empty LoopStr st b1 is add-left-cancelable
proof end;
cluster non empty add-right-cancelable LoopStr ;
existence
ex b1 being non empty LoopStr st b1 is add-right-cancelable
proof end;
cluster non empty add-cancelable LoopStr ;
existence
ex b1 being non empty LoopStr st b1 is add-cancelable
proof end;
end;

registration
cluster non empty add-left-cancelable add-right-cancelable -> non empty add-cancelable LoopStr ;
coherence
for b1 being non empty LoopStr st b1 is add-left-cancelable & b1 is add-right-cancelable holds
b1 is add-cancelable
proof end;
cluster non empty add-cancelable -> non empty add-left-cancelable add-right-cancelable LoopStr ;
coherence
for b1 being non empty LoopStr st b1 is add-cancelable holds
( b1 is add-left-cancelable & b1 is add-right-cancelable )
proof end;
end;

registration
cluster non empty Abelian add-right-cancelable -> non empty add-left-cancelable LoopStr ;
coherence
for b1 being non empty LoopStr st b1 is Abelian & b1 is add-right-cancelable holds
b1 is add-left-cancelable
proof end;
cluster non empty Abelian add-left-cancelable -> non empty add-right-cancelable LoopStr ;
coherence
for b1 being non empty LoopStr st b1 is Abelian & b1 is add-left-cancelable holds
b1 is add-right-cancelable
proof end;
end;

registration
cluster non empty add-associative right_zeroed right_complementable -> non empty add-right-cancelable LoopStr ;
coherence
for b1 being non empty LoopStr st b1 is right_zeroed & b1 is right_complementable & b1 is add-associative holds
b1 is add-right-cancelable
proof end;
end;

registration
cluster non empty Abelian add-associative right_zeroed unital associative commutative distributive left_zeroed add-left-cancelable add-right-cancelable add-cancelable doubleLoopStr ;
existence
ex b1 being non empty doubleLoopStr st
( b1 is Abelian & b1 is add-associative & b1 is left_zeroed & b1 is right_zeroed & b1 is commutative & b1 is associative & b1 is add-cancelable & b1 is distributive & b1 is unital )
proof end;
end;

theorem Th1: :: BINOM:1
for b1 being non empty right_zeroed left-distributive add-left-cancelable doubleLoopStr
for b2 being Element of b1 holds (0. b1) * b2 = 0. b1
proof end;

theorem Th2: :: BINOM:2
for b1 being non empty right-distributive left_zeroed add-right-cancelable doubleLoopStr
for b2 being Element of b1 holds b2 * (0. b1) = 0. b1
proof end;

scheme :: BINOM:sch 1
s1{ F1() -> Nat, P1[ Nat] } :
for b1 being Nat st F1() <= b1 holds
P1[b1]
provided
E4: P1[F1()] and
E5: for b1 being Nat st F1() <= b1 & P1[b1] holds
P1[b1 + 1]
proof end;

scheme :: BINOM:sch 2
s2{ F1() -> non empty set , F2() -> non empty set , F3() -> Element of F2(), F4() -> Function of [:F1(),F2():],F2() } :
ex b1 being Function of [:NAT ,F1():],F2() st
for b2 being Element of F1() holds
( b1 . 0,b2 = F3() & ( for b3 being Nat holds b1 . (b3 + 1),b2 = F4() . b2,(b1 . b3,b2) ) )
proof end;

scheme :: BINOM:sch 3
s3{ F1() -> non empty set , F2() -> non empty set , F3() -> Element of F2(), F4() -> Function of [:F2(),F1():],F2() } :
ex b1 being Function of [:F1(),NAT :],F2() st
for b2 being Element of F1() holds
( b1 . b2,0 = F3() & ( for b3 being Nat holds b1 . b2,(b3 + 1) = F4() . (b1 . b2,b3),b2 ) )
proof end;

theorem Th3: :: BINOM:3
for b1 being non empty left_zeroed LoopStr
for b2 being Element of b1 holds Sum <*b2*> = b2
proof end;

theorem Th4: :: BINOM:4
for b1 being non empty right-distributive left_zeroed add-right-cancelable doubleLoopStr
for b2 being Element of b1
for b3 being FinSequence of the carrier of b1 holds Sum (b2 * b3) = b2 * (Sum b3)
proof end;

theorem Th5: :: BINOM:5
for b1 being non empty right_zeroed left-distributive add-left-cancelable doubleLoopStr
for b2 being Element of b1
for b3 being FinSequence of the carrier of b1 holds Sum (b3 * b2) = (Sum b3) * b2
proof end;

theorem Th6: :: BINOM:6
for b1 being non empty commutative doubleLoopStr
for b2 being Element of b1
for b3 being FinSequence of the carrier of b1 holds Sum (b3 * b2) = Sum (b2 * b3)
proof end;

definition
let c1 be non empty LoopStr ;
let c2, c3 be FinSequence of the carrier of c1;
assume dom c2 = dom c3 ;
func c2 + c3 -> FinSequence of the carrier of a1 means :Def4: :: BINOM:def 4
( dom a4 = dom a2 & ( for b1 being Nat st 1 <= b1 & b1 <= len a4 holds
a4 /. b1 = (a2 /. b1) + (a3 /. b1) ) );
existence
ex b1 being FinSequence of the carrier of c1 st
( dom b1 = dom c2 & ( for b2 being Nat st 1 <= b2 & b2 <= len b1 holds
b1 /. b2 = (c2 /. b2) + (c3 /. b2) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of the carrier of c1 st dom b1 = dom c2 & ( for b3 being Nat st 1 <= b3 & b3 <= len b1 holds
b1 /. b3 = (c2 /. b3) + (c3 /. b3) ) & dom b2 = dom c2 & ( for b3 being Nat st 1 <= b3 & b3 <= len b2 holds
b2 /. b3 = (c2 /. b3) + (c3 /. b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines + BINOM:def 4 :
for b1 being non empty LoopStr
for b2, b3 being FinSequence of the carrier of b1 st dom b2 = dom b3 holds
for b4 being FinSequence of the carrier of b1 holds
( b4 = b2 + b3 iff ( dom b4 = dom b2 & ( for b5 being Nat st 1 <= b5 & b5 <= len b4 holds
b4 /. b5 = (b2 /. b5) + (b3 /. b5) ) ) );

theorem Th7: :: BINOM:7
for b1 being non empty Abelian add-associative right_zeroed LoopStr
for b2, b3 being FinSequence of the carrier of b1 st dom b2 = dom b3 holds
Sum (b2 + b3) = (Sum b2) + (Sum b3)
proof end;

definition
let c1 be non empty unital HGrStr ;
let c2 be Element of c1;
let c3 be Nat;
func c2 |^ c3 -> Element of a1 equals :: BINOM:def 5
(power a1) . a2,a3;
coherence
(power c1) . c2,c3 is Element of c1
;
end;

:: deftheorem Def5 defines |^ BINOM:def 5 :
for b1 being non empty unital HGrStr
for b2 being Element of b1
for b3 being Nat holds b2 |^ b3 = (power b1) . b2,b3;

theorem Th8: :: BINOM:8
for b1 being non empty unital HGrStr
for b2 being Element of b1 holds
( b2 |^ 0 = 1. b1 & b2 |^ 1 = b2 )
proof end;

theorem Th9: :: BINOM:9
for b1 being non empty unital HGrStr
for b2 being Element of b1
for b3 being Nat holds b2 |^ (b3 + 1) = (b2 |^ b3) * b2 by GROUP_1:def 8;

theorem Th10: :: BINOM:10
for b1 being non empty unital associative commutative HGrStr
for b2, b3 being Element of b1
for b4 being Nat holds (b2 * b3) |^ b4 = (b2 |^ b4) * (b3 |^ b4)
proof end;

theorem Th11: :: BINOM:11
for b1 being non empty unital associative HGrStr
for b2 being Element of b1
for b3, b4 being Nat holds b2 |^ (b3 + b4) = (b2 |^ b3) * (b2 |^ b4)
proof end;

theorem Th12: :: BINOM:12
for b1 being non empty unital associative HGrStr
for b2 being Element of b1
for b3, b4 being Nat holds (b2 |^ b3) |^ b4 = b2 |^ (b3 * b4)
proof end;

definition
let c1 be non empty LoopStr ;
func Nat-mult-left c1 -> Function of [:NAT ,the carrier of a1:],the carrier of a1 means :Def6: :: BINOM:def 6
for b1 being Element of a1 holds
( a2 . 0,b1 = 0. a1 & ( for b2 being Nat holds a2 . (b2 + 1),b1 = b1 + (a2 . b2,b1) ) );
existence
ex b1 being Function of [:NAT ,the carrier of c1:],the carrier of c1 st
for b2 being Element of c1 holds
( b1 . 0,b2 = 0. c1 & ( for b3 being Nat holds b1 . (b3 + 1),b2 = b2 + (b1 . b3,b2) ) )
proof end;
uniqueness
for b1, b2 being Function of [:NAT ,the carrier of c1:],the carrier of c1 st ( for b3 being Element of c1 holds
( b1 . 0,b3 = 0. c1 & ( for b4 being Nat holds b1 . (b4 + 1),b3 = b3 + (b1 . b4,b3) ) ) ) & ( for b3 being Element of c1 holds
( b2 . 0,b3 = 0. c1 & ( for b4 being Nat holds b2 . (b4 + 1),b3 = b3 + (b2 . b4,b3) ) ) ) holds
b1 = b2
proof end;
func Nat-mult-right c1 -> Function of [:the carrier of a1,NAT :],the carrier of a1 means :Def7: :: BINOM:def 7
for b1 being Element of a1 holds
( a2 . b1,0 = 0. a1 & ( for b2 being Nat holds a2 . b1,(b2 + 1) = (a2 . b1,b2) + b1 ) );
existence
ex b1 being Function of [:the carrier of c1,NAT :],the carrier of c1 st
for b2 being Element of c1 holds
( b1 . b2,0 = 0. c1 & ( for b3 being Nat holds b1 . b2,(b3 + 1) = (b1 . b2,b3) + b2 ) )
proof end;
uniqueness
for b1, b2 being Function of [:the carrier of c1,NAT :],the carrier of c1 st ( for b3 being Element of c1 holds
( b1 . b3,0 = 0. c1 & ( for b4 being Nat holds b1 . b3,(b4 + 1) = (b1 . b3,b4) + b3 ) ) ) & ( for b3 being Element of c1 holds
( b2 . b3,0 = 0. c1 & ( for b4 being Nat holds b2 . b3,(b4 + 1) = (b2 . b3,b4) + b3 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines Nat-mult-left BINOM:def 6 :
for b1 being non empty LoopStr
for b2 being Function of [:NAT ,the carrier of b1:],the carrier of b1 holds
( b2 = Nat-mult-left b1 iff for b3 being Element of b1 holds
( b2 . 0,b3 = 0. b1 & ( for b4 being Nat holds b2 . (b4 + 1),b3 = b3 + (b2 . b4,b3) ) ) );

:: deftheorem Def7 defines Nat-mult-right BINOM:def 7 :
for b1 being non empty LoopStr
for b2 being Function of [:the carrier of b1,NAT :],the carrier of b1 holds
( b2 = Nat-mult-right b1 iff for b3 being Element of b1 holds
( b2 . b3,0 = 0. b1 & ( for b4 being Nat holds b2 . b3,(b4 + 1) = (b2 . b3,b4) + b3 ) ) );

definition
let c1 be non empty LoopStr ;
let c2 be Element of c1;
let c3 be Nat;
func c3 * c2 -> Element of a1 equals :: BINOM:def 8
(Nat-mult-left a1) . a3,a2;
coherence
(Nat-mult-left c1) . c3,c2 is Element of c1
;
func c2 * c3 -> Element of a1 equals :: BINOM:def 9
(Nat-mult-right a1) . a2,a3;
coherence
(Nat-mult-right c1) . c2,c3 is Element of c1
;
end;

:: deftheorem Def8 defines * BINOM:def 8 :
for b1 being non empty LoopStr
for b2 being Element of b1
for b3 being Nat holds b3 * b2 = (Nat-mult-left b1) . b3,b2;

:: deftheorem Def9 defines * BINOM:def 9 :
for b1 being non empty LoopStr
for b2 being Element of b1
for b3 being Nat holds b2 * b3 = (Nat-mult-right b1) . b2,b3;

theorem Th13: :: BINOM:13
for b1 being non empty LoopStr
for b2 being Element of b1 holds
( 0 * b2 = 0. b1 & b2 * 0 = 0. b1 ) by Def6, Def7;

theorem Th14: :: BINOM:14
for b1 being non empty right_zeroed LoopStr
for b2 being Element of b1 holds 1 * b2 = b2
proof end;

theorem Th15: :: BINOM:15
for b1 being non empty left_zeroed LoopStr
for b2 being Element of b1 holds b2 * 1 = b2
proof end;

Lemma16: for b1 being non empty LoopStr
for b2 being Element of b1
for b3 being Nat holds (b3 + 1) * b2 = b2 + (b3 * b2)
by Def6;

Lemma17: for b1 being non empty LoopStr
for b2 being Element of b1
for b3 being Nat holds b2 * (b3 + 1) = (b2 * b3) + b2
by Def7;

theorem Th16: :: BINOM:16
for b1 being non empty add-associative left_zeroed LoopStr
for b2 being Element of b1
for b3, b4 being Nat holds (b3 + b4) * b2 = (b3 * b2) + (b4 * b2)
proof end;

theorem Th17: :: BINOM:17
for b1 being non empty add-associative right_zeroed LoopStr
for b2 being Element of b1
for b3, b4 being Nat holds b2 * (b3 + b4) = (b2 * b3) + (b2 * b4)
proof end;

theorem Th18: :: BINOM:18
for b1 being non empty add-associative right_zeroed left_zeroed LoopStr
for b2 being Element of b1
for b3 being Nat holds b3 * b2 = b2 * b3
proof end;

theorem Th19: :: BINOM:19
for b1 being non empty Abelian LoopStr
for b2 being Element of b1
for b3 being Nat holds b3 * b2 = b2 * b3
proof end;

theorem Th20: :: BINOM:20
for b1 being non empty add-associative right_zeroed left-distributive left_zeroed add-left-cancelable doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds (b4 * b2) * b3 = b4 * (b2 * b3)
proof end;

theorem Th21: :: BINOM:21
for b1 being non empty add-associative right_zeroed distributive left_zeroed add-right-cancelable doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds b3 * (b4 * b2) = (b3 * b2) * b4
proof end;

theorem Th22: :: BINOM:22
for b1 being non empty add-associative right_zeroed distributive left_zeroed add-cancelable doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds (b2 * b4) * b3 = b2 * (b4 * b3)
proof end;

definition
let c1, c2 be Nat;
redefine func choose as c2 choose c1 -> Nat;
coherence
c2 choose c1 is Nat
by NEWTON:35;
end;

definition
let c1 be non empty unital doubleLoopStr ;
let c2, c3 be Element of c1;
let c4 be Nat;
func c2,c3 In_Power c4 -> FinSequence of the carrier of a1 means :Def10: :: BINOM:def 10
( len a5 = a4 + 1 & ( for b1, b2, b3 being Nat st b1 in dom a5 & b3 = b1 - 1 & b2 = a4 - b3 holds
a5 /. b1 = ((a4 choose b3) * (a2 |^ b2)) * (a3 |^ b3) ) );
existence
ex b1 being FinSequence of the carrier of c1 st
( len b1 = c4 + 1 & ( for b2, b3, b4 being Nat st b2 in dom b1 & b4 = b2 - 1 & b3 = c4 - b4 holds
b1 /. b2 = ((c4 choose b4) * (c2 |^ b3)) * (c3 |^ b4) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of the carrier of c1 st len b1 = c4 + 1 & ( for b3, b4, b5 being Nat st b3 in dom b1 & b5 = b3 - 1 & b4 = c4 - b5 holds
b1 /. b3 = ((c4 choose b5) * (c2 |^ b4)) * (c3 |^ b5) ) & len b2 = c4 + 1 & ( for b3, b4, b5 being Nat st b3 in dom b2 & b5 = b3 - 1 & b4 = c4 - b5 holds
b2 /. b3 = ((c4 choose b5) * (c2 |^ b4)) * (c3 |^ b5) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def10 defines In_Power BINOM:def 10 :
for b1 being non empty unital doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat
for b5 being FinSequence of the carrier of b1 holds
( b5 = b2,b3 In_Power b4 iff ( len b5 = b4 + 1 & ( for b6, b7, b8 being Nat st b6 in dom b5 & b8 = b6 - 1 & b7 = b4 - b8 holds
b5 /. b6 = ((b4 choose b8) * (b2 |^ b7)) * (b3 |^ b8) ) ) );

theorem Th23: :: BINOM:23
for b1 being non empty right_zeroed unital doubleLoopStr
for b2, b3 being Element of b1 holds b2,b3 In_Power 0 = <*(1. b1)*>
proof end;

theorem Th24: :: BINOM:24
for b1 being non empty right_zeroed unital doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds (b2,b3 In_Power b4) . 1 = b2 |^ b4
proof end;

theorem Th25: :: BINOM:25
for b1 being non empty right_zeroed unital doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds (b2,b3 In_Power b4) . (b4 + 1) = b3 |^ b4
proof end;

theorem Th26: :: BINOM:26
for b1 being non empty Abelian add-associative right_zeroed unital associative commutative distributive left_zeroed add-cancelable doubleLoopStr
for b2, b3 being Element of b1
for b4 being Nat holds (b2 + b3) |^ b4 = Sum (b2,b3 In_Power b4)
proof end;