:: UPROOTS semantic presentation

theorem Th1: :: UPROOTS:1
for b1 being natural number holds
( ( b1 = 1 or b1 > 1 ) iff not b1 is empty )
proof end;

theorem Th2: :: UPROOTS:2
for b1 being FinSequence of NAT st ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 <> 0 ) holds
( Sum b1 = len b1 iff b1 = (len b1) |-> 1 )
proof end;

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

theorem Th3: :: UPROOTS:3
for b1 being non empty add-associative right_zeroed right_complementable LoopStr
for b2 being FinSequence of b1 st len b2 >= 2 & ( for b3 being Nat st 2 < b3 & b3 in dom b2 holds
b2 . b3 = 0. b1 ) holds
Sum b2 = (b2 /. 1) + (b2 /. 2)
proof end;

definition
let c1 be finite set ;
func canFS c1 -> FinSequence of a1 means :Def1: :: UPROOTS:def 1
( len a2 = card a1 & ex b1 being FinSequence st
( len b1 = card a1 & ( b1 . 1 = [(choose a1),(a1 \ {(choose a1)})] or card a1 = 0 ) & ( for b2 being Nat st 1 <= b2 & b2 < card a1 holds
for b3 being set st b1 . b2 = b3 holds
b1 . (b2 + 1) = [(choose (b3 `2 )),((b3 `2 ) \ {(choose (b3 `2 ))})] ) & ( for b2 being Nat st b2 in dom a2 holds
a2 . b2 = (b1 . b2) `1 ) ) );
existence
ex b1 being FinSequence of c1 st
( len b1 = card c1 & ex b2 being FinSequence st
( len b2 = card c1 & ( b2 . 1 = [(choose c1),(c1 \ {(choose c1)})] or card c1 = 0 ) & ( for b3 being Nat st 1 <= b3 & b3 < card c1 holds
for b4 being set st b2 . b3 = b4 holds
b2 . (b3 + 1) = [(choose (b4 `2 )),((b4 `2 ) \ {(choose (b4 `2 ))})] ) & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = (b2 . b3) `1 ) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of c1 st len b1 = card c1 & ex b3 being FinSequence st
( len b3 = card c1 & ( b3 . 1 = [(choose c1),(c1 \ {(choose c1)})] or card c1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < card c1 holds
for b5 being set st b3 . b4 = b5 holds
b3 . (b4 + 1) = [(choose (b5 `2 )),((b5 `2 ) \ {(choose (b5 `2 ))})] ) & ( for b4 being Nat st b4 in dom b1 holds
b1 . b4 = (b3 . b4) `1 ) ) & len b2 = card c1 & ex b3 being FinSequence st
( len b3 = card c1 & ( b3 . 1 = [(choose c1),(c1 \ {(choose c1)})] or card c1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < card c1 holds
for b5 being set st b3 . b4 = b5 holds
b3 . (b4 + 1) = [(choose (b5 `2 )),((b5 `2 ) \ {(choose (b5 `2 ))})] ) & ( for b4 being Nat st b4 in dom b2 holds
b2 . b4 = (b3 . b4) `1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines canFS UPROOTS:def 1 :
for b1 being finite set
for b2 being FinSequence of b1 holds
( b2 = canFS b1 iff ( len b2 = card b1 & ex b3 being FinSequence st
( len b3 = card b1 & ( b3 . 1 = [(choose b1),(b1 \ {(choose b1)})] or card b1 = 0 ) & ( for b4 being Nat st 1 <= b4 & b4 < card b1 holds
for b5 being set st b3 . b4 = b5 holds
b3 . (b4 + 1) = [(choose (b5 `2 )),((b5 `2 ) \ {(choose (b5 `2 ))})] ) & ( for b4 being Nat st b4 in dom b2 holds
b2 . b4 = (b3 . b4) `1 ) ) ) );

theorem Th4: :: UPROOTS:4
for b1 being finite set holds canFS b1 is one-to-one
proof end;

theorem Th5: :: UPROOTS:5
for b1 being finite set holds rng (canFS b1) = b1
proof end;

theorem Th6: :: UPROOTS:6
for b1 being set holds canFS {b1} = <*b1*>
proof end;

theorem Th7: :: UPROOTS:7
for b1 being finite set holds (canFS b1) " is Function of b1, Seg (card b1)
proof end;

definition
let c1 be set ;
let c2 be finite Subset of c1;
let c3 be Nat;
func c2,c3 -bag -> Element of Bags a1 equals :: UPROOTS:def 2
(EmptyBag a1) +* (a2 --> a3);
correctness
coherence
(EmptyBag c1) +* (c2 --> c3) is Element of Bags c1
;
proof end;
end;

:: deftheorem Def2 defines -bag UPROOTS:def 2 :
for b1 being set
for b2 being finite Subset of b1
for b3 being Nat holds b2,b3 -bag = (EmptyBag b1) +* (b2 --> b3);

theorem Th8: :: UPROOTS:8
for b1 being set
for b2 being finite Subset of b1
for b3 being Nat
for b4 being set st not b4 in b2 holds
(b2,b3 -bag ) . b4 = 0
proof end;

theorem Th9: :: UPROOTS:9
for b1 being set
for b2 being finite Subset of b1
for b3 being Nat
for b4 being set st b4 in b2 holds
(b2,b3 -bag ) . b4 = b3
proof end;

theorem Th10: :: UPROOTS:10
for b1 being set
for b2 being finite Subset of b1
for b3 being Nat st b3 <> 0 holds
support (b2,b3 -bag ) = b2
proof end;

theorem Th11: :: UPROOTS:11
for b1 being set
for b2 being finite Subset of b1
for b3 being Nat st ( b2 is empty or b3 = 0 ) holds
b2,b3 -bag = EmptyBag b1
proof end;

theorem Th12: :: UPROOTS:12
for b1 being set
for b2, b3 being finite Subset of b1
for b4 being Nat st b2 misses b3 holds
(b2 \/ b3),b4 -bag = (b2,b4 -bag ) + (b3,b4 -bag )
proof end;

definition
let c1 be set ;
mode Rbag of a1 is real-yielding finite-support ManySortedSet of a1;
end;

definition
let c1 be set ;
let c2 be Rbag of c1;
func Sum c2 -> real number means :Def3: :: UPROOTS:def 3
ex b1 being FinSequence of REAL st
( a3 = Sum b1 & b1 = a2 * (canFS (support a2)) );
existence
ex b1 being real number ex b2 being FinSequence of REAL st
( b1 = Sum b2 & b2 = c2 * (canFS (support c2)) )
proof end;
uniqueness
for b1, b2 being real number st ex b3 being FinSequence of REAL st
( b1 = Sum b3 & b3 = c2 * (canFS (support c2)) ) & ex b3 being FinSequence of REAL st
( b2 = Sum b3 & b3 = c2 * (canFS (support c2)) ) holds
b1 = b2
;
end;

:: deftheorem Def3 defines Sum UPROOTS:def 3 :
for b1 being set
for b2 being Rbag of b1
for b3 being real number holds
( b3 = Sum b2 iff ex b4 being FinSequence of REAL st
( b3 = Sum b4 & b4 = b2 * (canFS (support b2)) ) );

notation
let c1 be set ;
let c2 be bag of c1;
synonym degree c2 for Sum c2;
end;

definition
let c1 be set ;
let c2 be bag of c1;
redefine func Sum as degree c2 -> Nat means :Def4: :: UPROOTS:def 4
ex b1 being FinSequence of NAT st
( a3 = Sum b1 & b1 = a2 * (canFS (support a2)) );
coherence
Sum c2 is Nat
proof end;
compatibility
for b1 being Nat holds
( b1 = Sum c2 iff ex b2 being FinSequence of NAT st
( b1 = Sum b2 & b2 = c2 * (canFS (support c2)) ) )
proof end;
end;

:: deftheorem Def4 defines degree UPROOTS:def 4 :
for b1 being set
for b2 being bag of b1
for b3 being Nat holds
( b3 = degree b2 iff ex b4 being FinSequence of NAT st
( b3 = Sum b4 & b4 = b2 * (canFS (support b2)) ) );

theorem Th13: :: UPROOTS:13
for b1 being set
for b2 being Rbag of b1 st b2 = EmptyBag b1 holds
Sum b2 = 0
proof end;

theorem Th14: :: UPROOTS:14
for b1 being set
for b2 being bag of b1 st Sum b2 = 0 holds
b2 = EmptyBag b1
proof end;

theorem Th15: :: UPROOTS:15
for b1 being set
for b2 being finite Subset of b1
for b3 being bag of b1 holds
( ( b2 = support b3 & degree b3 = card b2 ) iff b3 = b2,1 -bag )
proof end;

theorem Th16: :: UPROOTS:16
for b1 being set
for b2 being finite Subset of b1
for b3 being Rbag of b1 st support b3 c= b2 holds
ex b4 being FinSequence of REAL st
( b4 = b3 * (canFS b2) & Sum b3 = Sum b4 )
proof end;

theorem Th17: :: UPROOTS:17
for b1 being set
for b2, b3, b4 being Rbag of b1 st b2 = b3 + b4 holds
Sum b2 = (Sum b3) + (Sum b4)
proof end;

theorem Th18: :: UPROOTS:18
for b1 being non empty unital associative commutative HGrStr
for b2, b3 being FinSequence of b1
for b4 being Permutation of dom b2 st b3 = b2 * b4 holds
Product b3 = Product b2
proof end;

definition
let c1 be non empty ZeroStr ;
let c2 be Polynomial of c1;
attr a2 is non-zero means :Def5: :: UPROOTS:def 5
a2 <> 0_. a1;
end;

:: deftheorem Def5 defines non-zero UPROOTS:def 5 :
for b1 being non empty ZeroStr
for b2 being Polynomial of b1 holds
( b2 is non-zero iff b2 <> 0_. b1 );

theorem Th19: :: UPROOTS:19
for b1 being non empty ZeroStr
for b2 being Polynomial of b1 holds
( b2 is non-zero iff len b2 > 0 )
proof end;

registration
let c1 be non empty non trivial ZeroStr ;
cluster non-zero M5( NAT ,the carrier of a1);
existence
ex b1 being Polynomial of c1 st b1 is non-zero
proof end;
end;

registration
let c1 be non empty non degenerated multLoopStr_0 ;
let c2 be Element of c1;
cluster <%a2,(1. a1)%> -> non-zero ;
correctness
coherence
<%c2,(1. c1)%> is non-zero
;
proof end;
end;

theorem Th20: :: UPROOTS:20
for b1 being non empty ZeroStr
for b2 being Polynomial of b1 st len b2 > 0 holds
b2 . ((len b2) -' 1) <> 0. b1
proof end;

theorem Th21: :: UPROOTS:21
for b1 being non empty ZeroStr
for b2 being AlgSequence of b1 st len b2 = 1 holds
( b2 = <%(b2 . 0)%> & b2 . 0 <> 0. b1 )
proof end;

theorem Th22: :: UPROOTS:22
for b1 being non empty add-associative right_zeroed right_complementable right-distributive doubleLoopStr
for b2 being Polynomial of b1 holds b2 *' (0_. b1) = 0_. b1
proof end;

registration
cluster non empty unital associative commutative Abelian add-associative right_zeroed right_complementable distributive non degenerated domRing-like algebraic-closed doubleLoopStr ;
existence
ex b1 being non empty unital doubleLoopStr st
( b1 is algebraic-closed & b1 is add-associative & b1 is right_zeroed & b1 is right_complementable & b1 is Abelian & b1 is commutative & b1 is associative & b1 is distributive & b1 is domRing-like & not b1 is degenerated )
proof end;
end;

theorem Th23: :: UPROOTS:23
for b1 being non empty add-associative right_zeroed right_complementable distributive domRing-like doubleLoopStr
for b2, b3 being Polynomial of b1 holds
( not b2 *' b3 = 0_. b1 or b2 = 0_. b1 or b3 = 0_. b1 )
proof end;

registration
let c1 be non empty add-associative right_zeroed right_complementable distributive domRing-like doubleLoopStr ;
cluster Polynom-Ring a1 -> domRing-like ;
correctness
coherence
Polynom-Ring c1 is domRing-like
;
proof end;
end;

registration
let c1 be domRing;
let c2, c3 be non-zero Polynomial of c1;
cluster a2 *' a3 -> non-zero ;
correctness
coherence
c2 *' c3 is non-zero
;
proof end;
end;

theorem Th24: :: UPROOTS:24
for b1 being non degenerated comRing
for b2, b3 being Polynomial of b1 holds (Roots b2) \/ (Roots b3) c= Roots (b2 *' b3)
proof end;

theorem Th25: :: UPROOTS:25
for b1 being domRing
for b2, b3 being Polynomial of b1 holds Roots (b2 *' b3) = (Roots b2) \/ (Roots b3)
proof end;

theorem Th26: :: UPROOTS:26
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being Polynomial of b1
for b3 being Element of (Polynom-Ring b1) st b2 = b3 holds
- b2 = - b3
proof end;

theorem Th27: :: UPROOTS:27
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2, b3 being Polynomial of b1
for b4, b5 being Element of (Polynom-Ring b1) st b2 = b4 & b3 = b5 holds
b2 - b3 = b4 - b5
proof end;

theorem Th28: :: UPROOTS:28
for b1 being non empty Abelian add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2, b3, b4 being Polynomial of b1 holds (b2 *' b3) - (b2 *' b4) = b2 *' (b3 - b4)
proof end;

theorem Th29: :: UPROOTS:29
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2, b3 being Polynomial of b1 st b2 - b3 = 0_. b1 holds
b2 = b3
proof end;

theorem Th30: :: UPROOTS:30
for b1 being non empty Abelian add-associative right_zeroed right_complementable distributive domRing-like doubleLoopStr
for b2, b3, b4 being Polynomial of b1 st b2 <> 0_. b1 & b2 *' b3 = b2 *' b4 holds
b3 = b4
proof end;

theorem Th31: :: UPROOTS:31
for b1 being domRing
for b2 being Nat
for b3 being Polynomial of b1 st b3 <> 0_. b1 holds
b3 `^ b2 <> 0_. b1
proof end;

theorem Th32: :: UPROOTS:32
for b1 being comRing
for b2, b3 being Nat
for b4 being Polynomial of b1 holds (b4 `^ b2) *' (b4 `^ b3) = b4 `^ (b2 + b3)
proof end;

theorem Th33: :: UPROOTS:33
for b1 being non empty multLoopStr_0 holds 1_. b1 = <%(1. b1)%>
proof end;

theorem Th34: :: UPROOTS:34
for b1 being non empty add-associative right_zeroed right_complementable right-distributive right_unital doubleLoopStr
for b2 being Polynomial of b1 holds b2 *' <%(1. b1)%> = b2
proof end;

theorem Th35: :: UPROOTS:35
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2, b3 being Polynomial of b1 st ( len b2 = 0 or len b3 = 0 ) holds
len (b2 *' b3) = 0
proof end;

theorem Th36: :: UPROOTS:36
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2, b3 being Polynomial of b1 st b2 *' b3 is non-zero holds
( b2 is non-zero & b3 is non-zero )
proof end;

theorem Th37: :: UPROOTS:37
for b1 being non empty associative commutative add-associative right_zeroed right_complementable distributive left_unital doubleLoopStr
for b2, b3 being Polynomial of b1 st (b2 . ((len b2) -' 1)) * (b3 . ((len b3) -' 1)) <> 0. b1 holds
0 < len (b2 *' b3)
proof end;

theorem Th38: :: UPROOTS:38
for b1 being non empty associative commutative add-associative right_zeroed right_complementable distributive left_unital domRing-like doubleLoopStr
for b2, b3 being Polynomial of b1 st 1 < len b2 & 1 < len b3 holds
len b2 < len (b2 *' b3)
proof end;

theorem Th39: :: UPROOTS:39
for b1 being non empty add-associative right_zeroed right_complementable left-distributive doubleLoopStr
for b2, b3 being Element of b1
for b4 being Polynomial of b1 holds
( (<%b2,b3%> *' b4) . 0 = b2 * (b4 . 0) & ( for b5 being Nat holds (<%b2,b3%> *' b4) . (b5 + 1) = (b2 * (b4 . (b5 + 1))) + (b3 * (b4 . b5)) ) )
proof end;

theorem Th40: :: UPROOTS:40
for b1 being non empty unital associative commutative add-associative right_zeroed right_complementable distributive non degenerated doubleLoopStr
for b2 being Element of b1
for b3 being non-zero Polynomial of b1 holds len (<%b2,(1. b1)%> *' b3) = (len b3) + 1
proof end;

theorem Th41: :: UPROOTS:41
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being Nat holds len (<%b2,(1. b1)%> `^ b3) = b3 + 1
proof end;

registration
let c1 be non degenerated comRing;
let c2 be Element of c1;
let c3 be Nat;
cluster <%a2,(1. a1)%> `^ a3 -> non-zero ;
correctness
coherence
<%c2,(1. c1)%> `^ c3 is non-zero
;
proof end;
end;

theorem Th42: :: UPROOTS:42
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being non-zero Polynomial of b1
for b4 being Nat holds len ((<%b2,(1. b1)%> `^ b4) *' b3) = b4 + (len b3)
proof end;

theorem Th43: :: UPROOTS:43
for b1 being non empty unital associative commutative add-associative right_zeroed right_complementable distributive non degenerated doubleLoopStr
for b2 being Element of b1
for b3, b4 being Polynomial of b1 st b3 = <%b2,(1. b1)%> *' b4 & b3 . ((len b3) -' 1) = 1. b1 holds
b4 . ((len b4) -' 1) = 1. b1
proof end;

definition
let c1 be non empty ZeroStr ;
let c2 be Polynomial of c1;
let c3 be Nat;
func poly_shift c2,c3 -> Polynomial of a1 means :Def6: :: UPROOTS:def 6
for b1 being Nat holds a4 . b1 = a2 . (a3 + b1);
existence
ex b1 being Polynomial of c1 st
for b2 being Nat holds b1 . b2 = c2 . (c3 + b2)
proof end;
uniqueness
for b1, b2 being Polynomial of c1 st ( for b3 being Nat holds b1 . b3 = c2 . (c3 + b3) ) & ( for b3 being Nat holds b2 . b3 = c2 . (c3 + b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines poly_shift UPROOTS:def 6 :
for b1 being non empty ZeroStr
for b2 being Polynomial of b1
for b3 being Nat
for b4 being Polynomial of b1 holds
( b4 = poly_shift b2,b3 iff for b5 being Nat holds b4 . b5 = b2 . (b3 + b5) );

theorem Th44: :: UPROOTS:44
for b1 being non empty ZeroStr
for b2 being Polynomial of b1 holds poly_shift b2,0 = b2
proof end;

theorem Th45: :: UPROOTS:45
for b1 being non empty ZeroStr
for b2 being Nat
for b3 being Polynomial of b1 st b2 >= len b3 holds
poly_shift b3,b2 = 0_. b1
proof end;

theorem Th46: :: UPROOTS:46
for b1 being non empty non degenerated multLoopStr_0
for b2 being Nat
for b3 being Polynomial of b1 st b2 <= len b3 holds
(len (poly_shift b3,b2)) + b2 = len b3
proof end;

theorem Th47: :: UPROOTS:47
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being Nat
for b4 being Polynomial of b1 st b3 < len b4 holds
eval (poly_shift b4,b3),b2 = (b2 * (eval (poly_shift b4,(b3 + 1)),b2)) + (b4 . b3)
proof end;

theorem Th48: :: UPROOTS:48
for b1 being non degenerated comRing
for b2 being Polynomial of b1 st len b2 = 1 holds
Roots b2 = {}
proof end;

definition
let c1 be non degenerated comRing;
let c2 be Element of c1;
let c3 be Polynomial of c1;
assume E50: c2 is_a_root_of c3 ;
func poly_quotient c3,c2 -> Polynomial of a1 means :Def7: :: UPROOTS:def 7
( (len a4) + 1 = len a3 & ( for b1 being Nat holds a4 . b1 = eval (poly_shift a3,(b1 + 1)),a2 ) ) if len a3 > 0
otherwise a4 = 0_. a1;
existence
( ( len c3 > 0 implies ex b1 being Polynomial of c1 st
( (len b1) + 1 = len c3 & ( for b2 being Nat holds b1 . b2 = eval (poly_shift c3,(b2 + 1)),c2 ) ) ) & ( not len c3 > 0 implies ex b1 being Polynomial of c1 st b1 = 0_. c1 ) )
proof end;
uniqueness
for b1, b2 being Polynomial of c1 holds
( ( len c3 > 0 & (len b1) + 1 = len c3 & ( for b3 being Nat holds b1 . b3 = eval (poly_shift c3,(b3 + 1)),c2 ) & (len b2) + 1 = len c3 & ( for b3 being Nat holds b2 . b3 = eval (poly_shift c3,(b3 + 1)),c2 ) implies b1 = b2 ) & ( not len c3 > 0 & b1 = 0_. c1 & b2 = 0_. c1 implies b1 = b2 ) )
proof end;
consistency
for b1 being Polynomial of c1 holds verum
;
end;

:: deftheorem Def7 defines poly_quotient UPROOTS:def 7 :
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being Polynomial of b1 st b2 is_a_root_of b3 holds
for b4 being Polynomial of b1 holds
( ( len b3 > 0 implies ( b4 = poly_quotient b3,b2 iff ( (len b4) + 1 = len b3 & ( for b5 being Nat holds b4 . b5 = eval (poly_shift b3,(b5 + 1)),b2 ) ) ) ) & ( not len b3 > 0 implies ( b4 = poly_quotient b3,b2 iff b4 = 0_. b1 ) ) );

theorem Th49: :: UPROOTS:49
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being non-zero Polynomial of b1 st b2 is_a_root_of b3 holds
len (poly_quotient b3,b2) > 0
proof end;

theorem Th50: :: UPROOTS:50
for b1 being non empty unital add-associative right_zeroed right_complementable left-distributive doubleLoopStr
for b2 being Element of b1 holds Roots <%(- b2),(1. b1)%> = {b2}
proof end;

theorem Th51: :: UPROOTS:51
for b1 being non trivial comRing
for b2 being Element of b1
for b3, b4 being Polynomial of b1 st b3 = <%(- b2),(1. b1)%> *' b4 holds
b2 is_a_root_of b3
proof end;

theorem Th52: :: UPROOTS:52
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being Polynomial of b1 st b2 is_a_root_of b3 holds
b3 = <%(- b2),(1. b1)%> *' (poly_quotient b3,b2)
proof end;

theorem Th53: :: UPROOTS:53
for b1 being non degenerated comRing
for b2 being Element of b1
for b3, b4 being Polynomial of b1 st b3 = <%(- b2),(1. b1)%> *' b4 holds
b2 is_a_root_of b3
proof end;

E55: now
let c1 be domRing;
let c2 be non-zero Polynomial of c1;
c2 <> 0_. c1 by Def5;
then len c2 <> 0 by POLYNOM4:8;
then len c2 > 0 ;
then E56: len c2 >= 0 + 1 by NAT_1:38;
defpred S1[ Nat] means for b1 being Polynomial of c1 st len b1 = a1 holds
( Roots b1 is finite & ex b2 being Nat st
( b2 = Card (Roots b1) & b2 < len b1 ) );
E57: S1[1]
proof
let c3 be Polynomial of c1;
assume E58: len c3 = 1 ;
hence Roots c3 is finite by Th48;
take 0 ;
thus 0 = Card (Roots c3) by E58, Th48, CARD_1:78;
thus 0 < len c3 by E58;
end;
E58: for b1 being Nat st b1 >= 1 & S1[b1] holds
S1[b1 + 1]
proof
let c3 be Nat;
assume that
E59: c3 >= 1 and
E60: S1[c3] ;
let c4 be Polynomial of c1;
assume E61: len c4 = c3 + 1 ;
then E62: len c4 > 1 by E59, NAT_1:38;
per cases ( c4 is with_roots or not c4 is with_roots ) ;
suppose c4 is with_roots ;
then consider c5 being Element of c1 such that
E63: c5 is_a_root_of c4 by POLYNOM5:def 7;
E64: len c4 > 0 by E62;
E65: c4 = <%(- c5),(1. c1)%> *' (poly_quotient c4,c5) by E63, Th52;
set c6 = <%(- c5),(1. c1)%>;
set c7 = poly_quotient c4,c5;
E66: (len (poly_quotient c4,c5)) + 1 = len c4 by E63, E64, Def7;
then E67: len (poly_quotient c4,c5) = c3 by E61;
then E68: Roots (poly_quotient c4,c5) is finite by E60;
E69: Roots <%(- c5),(1. c1)%> = {c5} by Th50;
Roots c4 = (Roots <%(- c5),(1. c1)%>) \/ (Roots (poly_quotient c4,c5)) by E65, Th25;
hence Roots c4 is finite by E68, E69, FINSET_1:14;
consider c8 being Nat such that
E70: c8 = Card (Roots (poly_quotient c4,c5)) and
E71: c8 < len (poly_quotient c4,c5) by E60, E67;
reconsider c9 = Roots (poly_quotient c4,c5) as finite set by E60, E67;
reconsider c10 = Roots <%(- c5),(1. c1)%> as finite set by E69;
reconsider c11 = c9 \/ c10 as finite set ;
take c12 = card c11;
thus c12 = Card (Roots c4) by E65, Th25;
card c10 = 1 by E69, CARD_1:79;
then E72: card c11 <= c8 + 1 by E70, CARD_2:62;
c8 + 1 < c3 + 1 by E61, E66, E71, XREAL_1:10;
hence c12 < len c4 by E61, E72, XREAL_1:2;
end;
suppose E63: not c4 is with_roots ;
E64: now
assume Roots c4 <> {} ;
then consider c5 being set such that
E65: c5 in Roots c4 by XBOOLE_0:def 1;
reconsider c6 = c5 as Element of c1 by E65;
c6 is_a_root_of c4 by E65, POLYNOM5:def 9;
hence contradiction by E63, POLYNOM5:def 7;
end;
hence Roots c4 is finite ;
take 0 ;
thus 0 = Card (Roots c4) by E64, CARD_1:78;
thus 0 < len c4 by E62;
end;
end;
end;
for b1 being Nat st b1 >= 1 holds
S1[b1] from INT_2:sch 1(E57, E58);
hence ( Roots c2 is finite & ex b1 being Nat st
( b1 = Card (Roots c2) & b1 < len c2 ) ) by E56;
end;

registration
let c1 be domRing;
let c2 be non-zero Polynomial of c1;
cluster Roots a2 -> finite ;
correctness
coherence
Roots c2 is finite
;
by Lemma55;
end;

definition
let c1 be non degenerated comRing;
let c2 be Element of c1;
let c3 be non-zero Polynomial of c1;
func multiplicity c3,c2 -> Nat means :Def8: :: UPROOTS:def 8
ex b1 being non empty finite Subset of NAT st
( b1 = { b2 where B is Nat : ex b1 being Polynomial of a1 st a3 = (<%(- a2),(1. a1)%> `^ b2) *' b3 } & a4 = max b1 );
existence
ex b1 being Natex b2 being non empty finite Subset of NAT st
( b2 = { b3 where B is Nat : ex b1 being Polynomial of c1 st c3 = (<%(- c2),(1. c1)%> `^ b3) *' b4 } & b1 = max b2 )
proof end;
uniqueness
for b1, b2 being Nat st ex b3 being non empty finite Subset of NAT st
( b3 = { b4 where B is Nat : ex b1 being Polynomial of c1 st c3 = (<%(- c2),(1. c1)%> `^ b4) *' b5 } & b1 = max b3 ) & ex b3 being non empty finite Subset of NAT st
( b3 = { b4 where B is Nat : ex b1 being Polynomial of c1 st c3 = (<%(- c2),(1. c1)%> `^ b4) *' b5 } & b2 = max b3 ) holds
b1 = b2
;
end;

:: deftheorem Def8 defines multiplicity UPROOTS:def 8 :
for b1 being non degenerated comRing
for b2 being Element of b1
for b3 being non-zero Polynomial of b1
for b4 being Nat holds
( b4 = multiplicity b3,b2 iff ex b5 being non empty finite Subset of NAT st
( b5 = { b6 where B is Nat : ex b1 being Polynomial of b1 st b3 = (<%(- b2),(1. b1)%> `^ b6) *' b7 } & b4 = max b5 ) );

theorem Th54: :: UPROOTS:54
for b1 being non degenerated comRing
for b2 being non-zero Polynomial of b1
for b3 being Element of b1 holds
( b3 is_a_root_of b2 iff multiplicity b2,b3 >= 1 )
proof end;

theorem Th55: :: UPROOTS:55
for b1 being non degenerated comRing
for b2 being Element of b1 holds multiplicity <%(- b2),(1. b1)%>,b2 = 1
proof end;

definition
let c1 be domRing;
let c2 be non-zero Polynomial of c1;
func BRoots c2 -> bag of the carrier of a1 means :Def9: :: UPROOTS:def 9
( support a3 = Roots a2 & ( for b1 being Element of a1 holds a3 . b1 = multiplicity a2,b1 ) );
existence
ex b1 being bag of the carrier of c1 st
( support b1 = Roots c2 & ( for b2 being Element of c1 holds b1 . b2 = multiplicity c2,b2 ) )
proof end;
uniqueness
for b1, b2 being bag of the carrier of c1 st support b1 = Roots c2 & ( for b3 being Element of c1 holds b1 . b3 = multiplicity c2,b3 ) & support b2 = Roots c2 & ( for b3 being Element of c1 holds b2 . b3 = multiplicity c2,b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def9 defines BRoots UPROOTS:def 9 :
for b1 being domRing
for b2 being non-zero Polynomial of b1
for b3 being bag of the carrier of b1 holds
( b3 = BRoots b2 iff ( support b3 = Roots b2 & ( for b4 being Element of b1 holds b3 . b4 = multiplicity b2,b4 ) ) );

theorem Th56: :: UPROOTS:56
for b1 being domRing
for b2 being Element of b1 holds BRoots <%(- b2),(1. b1)%> = {b2},1 -bag
proof end;

theorem Th57: :: UPROOTS:57
for b1 being domRing
for b2 being Element of b1
for b3, b4 being non-zero Polynomial of b1 holds multiplicity (b3 *' b4),b2 = (multiplicity b3,b2) + (multiplicity b4,b2)
proof end;

theorem Th58: :: UPROOTS:58
for b1 being domRing
for b2, b3 being non-zero Polynomial of b1 holds BRoots (b2 *' b3) = (BRoots b2) + (BRoots b3)
proof end;

E63: now
let c1 be domRing;
let c2, c3 be non-zero Polynomial of c1;
BRoots (c2 *' c3) = (BRoots c2) + (BRoots c3) by Th58;
hence degree (BRoots (c2 *' c3)) = (degree (BRoots c2)) + (degree (BRoots c3)) by Th17;
end;

theorem Th59: :: UPROOTS:59
for b1 being domRing
for b2 being non-zero Polynomial of b1 st len b2 = 1 holds
degree (BRoots b2) = 0
proof end;

theorem Th60: :: UPROOTS:60
for b1 being domRing
for b2 being Element of b1
for b3 being Nat holds degree (BRoots (<%(- b2),(1. b1)%> `^ b3)) = b3
proof end;

theorem Th61: :: UPROOTS:61
for b1 being algebraic-closed domRing
for b2 being non-zero Polynomial of b1 holds degree (BRoots b2) = (len b2) -' 1
proof end;

definition
let c1 be non empty add-associative right_zeroed right_complementable distributive doubleLoopStr ;
let c2 be Element of c1;
let c3 be Nat;
func fpoly_mult_root c2,c3 -> FinSequence of (Polynom-Ring a1) means :Def10: :: UPROOTS:def 10
( len a4 = a3 & ( for b1 being Nat st b1 in dom a4 holds
a4 . b1 = <%(- a2),(1. a1)%> ) );
existence
ex b1 being FinSequence of (Polynom-Ring c1) st
( len b1 = c3 & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = <%(- c2),(1. c1)%> ) )
proof end;
uniqueness
for b1, b2 being FinSequence of (Polynom-Ring c1) st len b1 = c3 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = <%(- c2),(1. c1)%> ) & len b2 = c3 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = <%(- c2),(1. c1)%> ) holds
b1 = b2
proof end;
end;

:: deftheorem Def10 defines fpoly_mult_root UPROOTS:def 10 :
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being Element of b1
for b3 being Nat
for b4 being FinSequence of (Polynom-Ring b1) holds
( b4 = fpoly_mult_root b2,b3 iff ( len b4 = b3 & ( for b5 being Nat st b5 in dom b4 holds
b4 . b5 = <%(- b2),(1. b1)%> ) ) );

definition
let c1 be non empty add-associative right_zeroed right_complementable distributive doubleLoopStr ;
let c2 be bag of the carrier of c1;
func poly_with_roots c2 -> Polynomial of a1 means :Def11: :: UPROOTS:def 11
ex b1 being FinSequence of the carrier of (Polynom-Ring a1) * ex b2 being FinSequence of a1 st
( len b1 = card (support a2) & b2 = canFS (support a2) & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = fpoly_mult_root (b2 /. b3),(a2 . (b2 /. b3)) ) & a3 = Product (FlattenSeq b1) );
existence
ex b1 being Polynomial of c1ex b2 being FinSequence of the carrier of (Polynom-Ring c1) * ex b3 being FinSequence of c1 st
( len b2 = card (support c2) & b3 = canFS (support c2) & ( for b4 being Nat st b4 in dom b2 holds
b2 . b4 = fpoly_mult_root (b3 /. b4),(c2 . (b3 /. b4)) ) & b1 = Product (FlattenSeq b2) )
proof end;
uniqueness
for b1, b2 being Polynomial of c1 st ex b3 being FinSequence of the carrier of (Polynom-Ring c1) * ex b4 being FinSequence of c1 st
( len b3 = card (support c2) & b4 = canFS (support c2) & ( for b5 being Nat st b5 in dom b3 holds
b3 . b5 = fpoly_mult_root (b4 /. b5),(c2 . (b4 /. b5)) ) & b1 = Product (FlattenSeq b3) ) & ex b3 being FinSequence of the carrier of (Polynom-Ring c1) * ex b4 being FinSequence of c1 st
( len b3 = card (support c2) & b4 = canFS (support c2) & ( for b5 being Nat st b5 in dom b3 holds
b3 . b5 = fpoly_mult_root (b4 /. b5),(c2 . (b4 /. b5)) ) & b2 = Product (FlattenSeq b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines poly_with_roots UPROOTS:def 11 :
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being bag of the carrier of b1
for b3 being Polynomial of b1 holds
( b3 = poly_with_roots b2 iff ex b4 being FinSequence of the carrier of (Polynom-Ring b1) * ex b5 being FinSequence of b1 st
( len b4 = card (support b2) & b5 = canFS (support b2) & ( for b6 being Nat st b6 in dom b4 holds
b4 . b6 = fpoly_mult_root (b5 /. b6),(b2 . (b5 /. b6)) ) & b3 = Product (FlattenSeq b4) ) );

theorem Th62: :: UPROOTS:62
for b1 being non empty commutative Abelian add-associative right_zeroed right_complementable right_unital distributive doubleLoopStr holds poly_with_roots (EmptyBag the carrier of b1) = <%(1. b1)%>
proof end;

theorem Th63: :: UPROOTS:63
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being Element of b1 holds poly_with_roots ({b2},1 -bag ) = <%(- b2),(1. b1)%>
proof end;

theorem Th64: :: UPROOTS:64
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being bag of the carrier of b1
for b3 being FinSequence of the carrier of (Polynom-Ring b1) *
for b4 being FinSequence of b1 st len b3 = card (support b2) & b4 = canFS (support b2) & ( for b5 being Nat st b5 in dom b3 holds
b3 . b5 = fpoly_mult_root (b4 /. b5),(b2 . (b4 /. b5)) ) holds
len (FlattenSeq b3) = degree b2
proof end;

theorem Th65: :: UPROOTS:65
for b1 being non empty add-associative right_zeroed right_complementable distributive doubleLoopStr
for b2 being bag of the carrier of b1
for b3 being FinSequence of the carrier of (Polynom-Ring b1) *
for b4 being FinSequence of b1
for b5 being Element of b1 st len b3 = card (support b2) & b4 = canFS (support b2) & ( for b6 being Nat st b6 in dom b3 holds
b3 . b6 = fpoly_mult_root (b4 /. b6),(b2 . (b4 /. b6)) ) holds
( ( b5 in support b2 implies card ((FlattenSeq b3) " {<%(- b5),(1. b1)%>}) = b2 . b5 ) & ( not b5 in support b2 implies card ((FlattenSeq b3) " {<%(- b5),(1. b1)%>}) = 0 ) )
proof end;

theorem Th66: :: UPROOTS:66
for b1 being comRing
for b2, b3 being bag of the carrier of b1 holds poly_with_roots (b2 + b3) = (poly_with_roots b2) *' (poly_with_roots b3)
proof end;

theorem Th67: :: UPROOTS:67
for b1 being algebraic-closed domRing
for b2 being non-zero Polynomial of b1 st b2 . ((len b2) -' 1) = 1. b1 holds
b2 = poly_with_roots (BRoots b2)
proof end;

theorem Th68: :: UPROOTS:68
for b1 being comRing
for b2 being non empty finite Subset of b1
for b3 being FinSequence of (Polynom-Ring b1) st len b3 = card b2 & ( for b4 being Nat
for b5 being Element of b1 st b4 in dom b3 & b5 = (canFS b2) . b4 holds
b3 . b4 = <%(- b5),(1. b1)%> ) holds
poly_with_roots (b2,1 -bag ) = Product b3
proof end;

theorem Th69: :: UPROOTS:69
for b1 being non trivial comRing
for b2 being non empty finite Subset of b1
for b3 being Element of b1
for b4 being FinSequence of b1 st len b4 = card b2 & ( for b5 being Nat
for b6 being Element of b1 st b5 in dom b4 & b6 = (canFS b2) . b5 holds
b4 . b5 = eval <%(- b6),(1. b1)%>,b3 ) holds
eval (poly_with_roots (b2,1 -bag )),b3 = Product b4
proof end;