:: More About Polynomials: Monomials and Constant Polynomials
:: by Christoph Schwarzweller
::
:: Copyright (c) 2001-2021 Association of Mizar Users

registration
existence
ex b1 being non trivial doubleLoopStr st
( b1 is Abelian & b1 is left_zeroed & b1 is right_zeroed & b1 is add-associative & b1 is right_complementable & b1 is well-unital & b1 is associative & b1 is commutative & b1 is distributive & b1 is domRing-like )
proof end;
end;

definition
let X be set ;
let R be non empty ZeroStr ;
let p be Series of X,R;
attr p is non-zero means :: POLYNOM7:def 1
p <> 0_ (X,R);
end;

:: deftheorem defines non-zero POLYNOM7:def 1 :
for X being set
for R being non empty ZeroStr
for p being Series of X,R holds
( p is non-zero iff p <> 0_ (X,R) );

registration
let X be set ;
let R be non trivial ZeroStr ;
cluster Relation-like Bags X -defined the carrier of R -valued Function-like quasi_total non-zero for Element of bool [:(Bags X), the carrier of R:];
existence
ex b1 being Series of X,R st b1 is non-zero
proof end;
end;

registration
let n be Ordinal;
let R be non trivial ZeroStr ;
existence
ex b1 being Polynomial of n,R st b1 is non-zero
proof end;
end;

theorem Th1: :: POLYNOM7:1
for X being set
for R being non empty ZeroStr
for s being Series of X,R holds
( s = 0_ (X,R) iff Support s = {} )
proof end;

theorem :: POLYNOM7:2
for X being set
for R being non empty ZeroStr holds
( not R is trivial iff ex s being Series of X,R st Support s <> {} )
proof end;

definition
let X be set ;
let b be bag of X;
attr b is univariate means :: POLYNOM7:def 2
ex u being Element of X st support b = {u};
end;

:: deftheorem defines univariate POLYNOM7:def 2 :
for X being set
for b being bag of X holds
( b is univariate iff ex u being Element of X st support b = {u} );

registration
let X be non empty set ;
existence
ex b1 being bag of X st b1 is univariate
proof end;
end;

registration
let X be non empty set ;
coherence
for b1 being bag of X st b1 is univariate holds
not b1 is V3()
proof end;
end;

theorem :: POLYNOM7:3
for b being bag of {} holds b = EmptyBag {}
proof end;

Lm1: for L being non empty doubleLoopStr
for p being Polynomial of {},L ex a being Element of L st p = {()} --> a

proof end;

theorem :: POLYNOM7:4
for L being non trivial right_complementable add-associative right_zeroed well-unital distributive doubleLoopStr
for p being Polynomial of {},L
for x being Function of {},L holds eval (p,x) = p . ()
proof end;

theorem :: POLYNOM7:5
proof end;

definition
let X be set ;
let L be non empty ZeroStr ;
let p be Series of X,L;
attr p is monomial-like means :Def3: :: POLYNOM7:def 3
ex b being bag of X st
for b9 being bag of X st b9 <> b holds
p . b9 = 0. L;
end;

:: deftheorem Def3 defines monomial-like POLYNOM7:def 3 :
for X being set
for L being non empty ZeroStr
for p being Series of X,L holds
( p is monomial-like iff ex b being bag of X st
for b9 being bag of X st b9 <> b holds
p . b9 = 0. L );

registration
let X be set ;
let L be non empty ZeroStr ;
cluster Relation-like Bags X -defined the carrier of L -valued Function-like quasi_total monomial-like for Element of bool [:(Bags X), the carrier of L:];
existence
ex b1 being Series of X,L st b1 is monomial-like
proof end;
end;

definition
let X be set ;
let L be non empty ZeroStr ;
mode Monomial of X,L is monomial-like Series of X,L;
end;

registration
let X be set ;
let L be non empty ZeroStr ;
cluster Function-like quasi_total monomial-like -> finite-Support for Element of bool [:(Bags X), the carrier of L:];
coherence
for b1 being Series of X,L st b1 is monomial-like holds
b1 is finite-Support
proof end;
end;

theorem Th6: :: POLYNOM7:6
for X being set
for L being non empty ZeroStr
for p being Series of X,L holds
( p is Monomial of X,L iff ( Support p = {} or ex b being bag of X st Support p = {b} ) )
proof end;

definition
let X be set ;
let L be non empty ZeroStr ;
let a be Element of L;
let b be bag of X;
func Monom (a,b) -> Monomial of X,L equals :: POLYNOM7:def 4
(0_ (X,L)) +* (b,a);
coherence
(0_ (X,L)) +* (b,a) is Monomial of X,L
proof end;
end;

:: deftheorem defines Monom POLYNOM7:def 4 :
for X being set
for L being non empty ZeroStr
for a being Element of L
for b being bag of X holds Monom (a,b) = (0_ (X,L)) +* (b,a);

definition
let X be set ;
let L be non empty ZeroStr ;
let m be Monomial of X,L;
func term m -> bag of X means :Def5: :: POLYNOM7:def 5
( m . it <> 0. L or ( Support m = {} & it = EmptyBag X ) );
existence
ex b1 being bag of X st
( m . b1 <> 0. L or ( Support m = {} & b1 = EmptyBag X ) )
proof end;
uniqueness
for b1, b2 being bag of X st ( m . b1 <> 0. L or ( Support m = {} & b1 = EmptyBag X ) ) & ( m . b2 <> 0. L or ( Support m = {} & b2 = EmptyBag X ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines term POLYNOM7:def 5 :
for X being set
for L being non empty ZeroStr
for m being Monomial of X,L
for b4 being bag of X holds
( b4 = term m iff ( m . b4 <> 0. L or ( Support m = {} & b4 = EmptyBag X ) ) );

definition
let X be set ;
let L be non empty ZeroStr ;
let m be Monomial of X,L;
func coefficient m -> Element of L equals :: POLYNOM7:def 6
m . (term m);
coherence
m . (term m) is Element of L
;
end;

:: deftheorem defines coefficient POLYNOM7:def 6 :
for X being set
for L being non empty ZeroStr
for m being Monomial of X,L holds coefficient m = m . (term m);

theorem Th7: :: POLYNOM7:7
for X being set
for L being non empty ZeroStr
for m being Monomial of X,L holds
( Support m = {} or Support m = {(term m)} )
proof end;

theorem Th8: :: POLYNOM7:8
for X being set
for L being non empty ZeroStr
for b being bag of X holds
( coefficient (Monom ((0. L),b)) = 0. L & term (Monom ((0. L),b)) = EmptyBag X )
proof end;

theorem Th9: :: POLYNOM7:9
for X being set
for L being non empty ZeroStr
for a being Element of L
for b being bag of X holds coefficient (Monom (a,b)) = a
proof end;

theorem Th10: :: POLYNOM7:10
for X being set
for L being non trivial ZeroStr
for a being non zero Element of L
for b being bag of X holds term (Monom (a,b)) = b
proof end;

theorem :: POLYNOM7:11
for X being set
for L being non empty ZeroStr
for m being Monomial of X,L holds Monom ((),(term m)) = m
proof end;

theorem Th12: :: POLYNOM7:12
for n being Ordinal
for L being non trivial right_complementable add-associative right_zeroed well-unital distributive doubleLoopStr
for m being Monomial of n,L
for x being Function of n,L holds eval (m,x) = () * (eval ((term m),x))
proof end;

theorem :: POLYNOM7:13
for n being Ordinal
for L being non trivial right_complementable add-associative right_zeroed well-unital distributive doubleLoopStr
for a being Element of L
for b being bag of n
for x being Function of n,L holds eval ((Monom (a,b)),x) = a * (eval (b,x))
proof end;

definition
let X be set ;
let L be non empty ZeroStr ;
let p be Series of X,L;
attr p is Constant means :Def7: :: POLYNOM7:def 7
for b being bag of X st b <> EmptyBag X holds
p . b = 0. L;
end;

:: deftheorem Def7 defines Constant POLYNOM7:def 7 :
for X being set
for L being non empty ZeroStr
for p being Series of X,L holds
( p is Constant iff for b being bag of X st b <> EmptyBag X holds
p . b = 0. L );

registration
let X be set ;
let L be non empty ZeroStr ;
cluster Relation-like Bags X -defined the carrier of L -valued Function-like quasi_total Constant for Element of bool [:(Bags X), the carrier of L:];
existence
ex b1 being Series of X,L st b1 is Constant
proof end;
end;

definition
let X be set ;
let L be non empty ZeroStr ;
mode ConstPoly of X,L is Constant Series of X,L;
end;

registration
let X be set ;
let L be non empty ZeroStr ;
cluster Function-like quasi_total Constant -> monomial-like for Element of bool [:(Bags X), the carrier of L:];
coherence
for b1 being Series of X,L st b1 is Constant holds
b1 is monomial-like
;
end;

theorem Th14: :: POLYNOM7:14
for X being set
for L being non empty ZeroStr
for p being Series of X,L holds
( p is ConstPoly of X,L iff ( p = 0_ (X,L) or Support p = {()} ) )
proof end;

registration
let X be set ;
let L be non empty ZeroStr ;
cluster 0_ (X,L) -> Constant ;
coherence
0_ (X,L) is Constant
by POLYNOM1:22;
end;

registration
let X be set ;
let L be non empty well-unital doubleLoopStr ;
cluster 1_ (X,L) -> Constant ;
coherence
1_ (X,L) is Constant
by POLYNOM1:25;
end;

Lm2: for X being set
for L being non empty ZeroStr
for c being ConstPoly of X,L holds
( term c = EmptyBag X & coefficient c = c . () )

proof end;

theorem Th15: :: POLYNOM7:15
for X being set
for L being non empty ZeroStr
for c being ConstPoly of X,L holds
( Support c = {} or Support c = {()} )
proof end;

theorem :: POLYNOM7:16
for X being set
for L being non empty ZeroStr
for c being ConstPoly of X,L holds
( term c = EmptyBag X & coefficient c = c . () ) by Lm2;

definition
let X be set ;
let L be non empty ZeroStr ;
let a be Element of L;
func a | (X,L) -> Series of X,L equals :: POLYNOM7:def 8
(0_ (X,L)) +* ((),a);
coherence
(0_ (X,L)) +* ((),a) is Series of X,L
;
end;

:: deftheorem defines | POLYNOM7:def 8 :
for X being set
for L being non empty ZeroStr
for a being Element of L holds a | (X,L) = (0_ (X,L)) +* ((),a);

registration
let X be set ;
let L be non empty ZeroStr ;
let a be Element of L;
cluster a | (X,L) -> Constant ;
coherence
a | (X,L) is Constant
proof end;
end;

Lm3: for X being set
for L being non empty ZeroStr holds (0. L) | (X,L) = 0_ (X,L)

proof end;

theorem :: POLYNOM7:17
for X being set
for L being non empty ZeroStr
for p being Series of X,L holds
( p is ConstPoly of X,L iff ex a being Element of L st p = a | (X,L) )
proof end;

theorem Th18: :: POLYNOM7:18
for X being set
for L being non empty multLoopStr_0
for a being Element of L holds
( (a | (X,L)) . () = a & ( for b being bag of X st b <> EmptyBag X holds
(a | (X,L)) . b = 0. L ) )
proof end;

theorem :: POLYNOM7:19
for X being set
for L being non empty ZeroStr holds (0. L) | (X,L) = 0_ (X,L) by Lm3;

theorem :: POLYNOM7:20
for X being set
for L being non empty well-unital multLoopStr_0 holds (1. L) | (X,L) = 1_ (X,L)
proof end;

theorem :: POLYNOM7:21
for X being set
for L being non empty ZeroStr
for a, b being Element of L holds
( a | (X,L) = b | (X,L) iff a = b )
proof end;

theorem :: POLYNOM7:22
for X being set
for L being non empty ZeroStr
for a being Element of L holds
( Support (a | (X,L)) = {} or Support (a | (X,L)) = {()} ) by Th15;

theorem Th23: :: POLYNOM7:23
for X being set
for L being non empty ZeroStr
for a being Element of L holds
( term (a | (X,L)) = EmptyBag X & coefficient (a | (X,L)) = a )
proof end;

theorem Th24: :: POLYNOM7:24
for n being Ordinal
for L being non trivial right_complementable add-associative right_zeroed well-unital distributive doubleLoopStr
for c being ConstPoly of n,L
for x being Function of n,L holds eval (c,x) = coefficient c
proof end;

theorem Th25: :: POLYNOM7:25
for n being Ordinal
for L being non trivial right_complementable add-associative right_zeroed well-unital distributive doubleLoopStr
for a being Element of L
for x being Function of n,L holds eval ((a | (n,L)),x) = a
proof end;

definition
let X be set ;
let L be non empty multLoopStr_0 ;
let p be Series of X,L;
let a be Element of L;
func a * p -> Series of X,L means :Def9: :: POLYNOM7:def 9
for b being bag of X holds it . b = a * (p . b);
existence
ex b1 being Series of X,L st
for b being bag of X holds b1 . b = a * (p . b)
proof end;
uniqueness
for b1, b2 being Series of X,L st ( for b being bag of X holds b1 . b = a * (p . b) ) & ( for b being bag of X holds b2 . b = a * (p . b) ) holds
b1 = b2
proof end;
func p * a -> Series of X,L means :Def10: :: POLYNOM7:def 10
for b being bag of X holds it . b = (p . b) * a;
existence
ex b1 being Series of X,L st
for b being bag of X holds b1 . b = (p . b) * a
proof end;
uniqueness
for b1, b2 being Series of X,L st ( for b being bag of X holds b1 . b = (p . b) * a ) & ( for b being bag of X holds b2 . b = (p . b) * a ) holds
b1 = b2
proof end;
end;

:: deftheorem Def9 defines * POLYNOM7:def 9 :
for X being set
for L being non empty multLoopStr_0
for p being Series of X,L
for a being Element of L
for b5 being Series of X,L holds
( b5 = a * p iff for b being bag of X holds b5 . b = a * (p . b) );

:: deftheorem Def10 defines * POLYNOM7:def 10 :
for X being set
for L being non empty multLoopStr_0
for p being Series of X,L
for a being Element of L
for b5 being Series of X,L holds
( b5 = p * a iff for b being bag of X holds b5 . b = (p . b) * a );

registration
let X be set ;
let L be non empty add-cancelable right_zeroed distributive left_zeroed doubleLoopStr ;
let p be finite-Support Series of X,L;
let a be Element of L;
coherence
a * p is finite-Support
proof end;
coherence
p * a is finite-Support
proof end;
end;

theorem :: POLYNOM7:26
for X being set
for L being non empty commutative multLoopStr_0
for p being Series of X,L
for a being Element of L holds a * p = p * a
proof end;

theorem Th27: :: POLYNOM7:27
for n being Ordinal
for L being non empty right_complementable add-associative right_zeroed left-distributive doubleLoopStr
for p being Series of n,L
for a being Element of L holds a * p = (a | (n,L)) *' p
proof end;

theorem Th28: :: POLYNOM7:28
for n being Ordinal
for L being non empty right_complementable add-associative right_zeroed right-distributive doubleLoopStr
for p being Series of n,L
for a being Element of L holds p * a = p *' (a | (n,L))
proof end;

Lm4: for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval (((a | (n,L)) *' p),x) = a * (eval (p,x))

proof end;

Lm5: for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((p *' (a | (n,L))),x) = (eval (p,x)) * a

proof end;

theorem :: POLYNOM7:29
for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((a * p),x) = a * (eval (p,x))
proof end;

theorem :: POLYNOM7:30
for n being Ordinal
for L being non trivial left_add-cancelable right_complementable add-associative right_zeroed well-unital distributive associative domRing-like left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((a * p),x) = a * (eval (p,x))
proof end;

theorem :: POLYNOM7:31
for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((p * a),x) = (eval (p,x)) * a
proof end;

theorem :: POLYNOM7:32
for n being Ordinal
for L being non trivial left_add-cancelable right_complementable add-associative right_zeroed well-unital distributive associative commutative domRing-like left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((p * a),x) = (eval (p,x)) * a
proof end;

theorem :: POLYNOM7:33
for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval (((a | (n,L)) *' p),x) = a * (eval (p,x)) by Lm4;

theorem :: POLYNOM7:34
for n being Ordinal
for L being non trivial right_complementable Abelian add-associative right_zeroed well-unital distributive associative commutative left_zeroed doubleLoopStr
for p being Polynomial of n,L
for a being Element of L
for x being Function of n,L holds eval ((p *' (a | (n,L))),x) = (eval (p,x)) * a
proof end;