let A be closed-interval Subset of REAL ; :: thesis: for D being Division of A holds Sum (lower_volume (chi A,A),D) = vol A
let D be Division of A; :: thesis: Sum (lower_volume (chi A,A),D) = vol A
deffunc H1( Nat) -> Real = vol (divset D,$1);
consider p being FinSequence of REAL such that
A1: ( len p = len D & ( for i being Nat st i in dom p holds
p . i = H1(i) ) ) from FINSEQ_2:sch 1();
A2: dom p = Seg (len D) by A1, FINSEQ_1:def 3;
A3: for i being Element of NAT st i in Seg (len D) holds
p . i = (upper_bound (divset D,i)) - (lower_bound (divset D,i))
proof
let i be Element of NAT ; :: thesis: ( i in Seg (len D) implies p . i = (upper_bound (divset D,i)) - (lower_bound (divset D,i)) )
A4: vol (divset D,i) = (upper_bound (divset D,i)) - (lower_bound (divset D,i)) ;
assume i in Seg (len D) ; :: thesis: p . i = (upper_bound (divset D,i)) - (lower_bound (divset D,i))
hence p . i = (upper_bound (divset D,i)) - (lower_bound (divset D,i)) by A1, A2, A4; :: thesis: verum
end;
(len D) - 1 in NAT
proof end;
then reconsider k = (len D) - 1 as Element of NAT ;
deffunc H2( Nat) -> Element of REAL = lower_bound (divset D,($1 + 1));
deffunc H3( Nat) -> Element of REAL = upper_bound (divset D,$1);
consider s1 being FinSequence of REAL such that
A5: ( len s1 = k & ( for i being Nat st i in dom s1 holds
s1 . i = H3(i) ) ) from FINSEQ_2:sch 1();
consider s2 being FinSequence of REAL such that
A6: ( len s2 = k & ( for i being Nat st i in dom s2 holds
s2 . i = H2(i) ) ) from FINSEQ_2:sch 1();
A7: dom s2 = Seg k by A6, FINSEQ_1:def 3;
( len (s1 ^ <*(upper_bound A)*>) = len (<*(lower_bound A)*> ^ s2) & len (s1 ^ <*(upper_bound A)*>) = len p & ( for i being Element of NAT st i in dom (s1 ^ <*(upper_bound A)*>) holds
p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) ) )
proof
dom <*(upper_bound A)*> = Seg 1 by FINSEQ_1:def 8;
then len <*(upper_bound A)*> = 1 by FINSEQ_1:def 3;
then A8: len (s1 ^ <*(upper_bound A)*>) = k + 1 by A5, FINSEQ_1:35;
dom <*(lower_bound A)*> = Seg 1 by FINSEQ_1:def 8;
then len <*(lower_bound A)*> = 1 by FINSEQ_1:def 3;
hence A9: len (s1 ^ <*(upper_bound A)*>) = len (<*(lower_bound A)*> ^ s2) by A6, A8, FINSEQ_1:35; :: thesis: ( len (s1 ^ <*(upper_bound A)*>) = len p & ( for i being Element of NAT st i in dom (s1 ^ <*(upper_bound A)*>) holds
p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) ) )

thus len (s1 ^ <*(upper_bound A)*>) = len p by A1, A8; :: thesis: for i being Element of NAT st i in dom (s1 ^ <*(upper_bound A)*>) holds
p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)

let i be Element of NAT ; :: thesis: ( i in dom (s1 ^ <*(upper_bound A)*>) implies p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) )
assume A10: i in dom (s1 ^ <*(upper_bound A)*>) ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
then A11: (s1 ^ <*(upper_bound A)*>) /. i = (s1 ^ <*(upper_bound A)*>) . i by PARTFUN1:def 8;
i in Seg (len (s1 ^ <*(upper_bound A)*>)) by A10, FINSEQ_1:def 3;
then i in dom (<*(lower_bound A)*> ^ s2) by A9, FINSEQ_1:def 3;
then A12: (<*(lower_bound A)*> ^ s2) /. i = (<*(lower_bound A)*> ^ s2) . i by PARTFUN1:def 8;
A13: ( len D = 1 or not len D is trivial ) by NAT_2:def 1;
now
per cases ( len D = 1 or len D >= 2 ) by A13, NAT_2:31;
suppose A14: len D = 1 ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
end;
suppose A21: len D >= 2 ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
1 = 2 - 1 ;
then A22: k >= 1 by A21, XREAL_1:11;
now
per cases ( i = 1 or i = len D or ( i <> 1 & i <> len D ) ) ;
suppose A23: i = 1 ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
end;
suppose A31: i = len D ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
end;
suppose A40: ( i <> 1 & i <> len D ) ; :: thesis: p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i)
(len s1) + (len <*(upper_bound A)*>) = k + 1 by A5, FINSEQ_1:56;
then A41: i in Seg (len D) by A10, FINSEQ_1:def 7;
A42: ( i in dom s1 & i in Seg k & i - 1 in Seg k & (i - 1) + 1 = i & i - (len <*(lower_bound A)*>) in dom s2 )
proof end;
then A49: i - (len <*(lower_bound A)*>) in Seg (len s2) by FINSEQ_1:def 3;
then i - (len <*(lower_bound A)*>) <= len s2 by FINSEQ_1:3;
then A50: i <= (len <*(lower_bound A)*>) + (len s2) by XREAL_1:22;
1 <= i - (len <*(lower_bound A)*>) by A49, FINSEQ_1:3;
then (len <*(lower_bound A)*>) + 1 <= i by XREAL_1:21;
then (<*(lower_bound A)*> ^ s2) . i = s2 . (i - (len <*(lower_bound A)*>)) by A50, FINSEQ_1:36;
then (<*(lower_bound A)*> ^ s2) . i = s2 . (i - 1) by FINSEQ_1:56;
then A51: (<*(lower_bound A)*> ^ s2) . i = lower_bound (divset D,i) by A6, A7, A42;
(s1 ^ <*(upper_bound A)*>) . i = s1 . i by A42, FINSEQ_1:def 7;
then (s1 ^ <*(upper_bound A)*>) . i = upper_bound (divset D,i) by A5, A42;
hence p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) by A3, A11, A12, A41, A51; :: thesis: verum
end;
end;
end;
hence p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) ; :: thesis: verum
end;
end;
end;
hence p . i = ((s1 ^ <*(upper_bound A)*>) /. i) - ((<*(lower_bound A)*> ^ s2) /. i) ; :: thesis: verum
end;
then Sum p = (Sum (s1 ^ <*(upper_bound A)*>)) - (Sum (<*(lower_bound A)*> ^ s2)) by Th24;
then Sum p = ((Sum s1) + (upper_bound A)) - (Sum (<*(lower_bound A)*> ^ s2)) by RVSUM_1:104;
then A52: Sum p = ((Sum s1) + (upper_bound A)) - ((lower_bound A) + (Sum s2)) by RVSUM_1:106;
A53: dom s1 = Seg k by A5, FINSEQ_1:def 3;
A54: for i being Element of NAT st i in Seg k holds
upper_bound (divset D,i) = lower_bound (divset D,(i + 1))
proof end;
for i being Nat st i in dom s1 holds
s1 . i = s2 . i
proof
let i be Nat; :: thesis: ( i in dom s1 implies s1 . i = s2 . i )
assume A63: i in dom s1 ; :: thesis: s1 . i = s2 . i
then s1 . i = upper_bound (divset D,i) by A5;
then s1 . i = lower_bound (divset D,(i + 1)) by A54, A53, A63;
hence s1 . i = s2 . i by A6, A7, A53, A63; :: thesis: verum
end;
then A64: s1 = s2 by A5, A6, FINSEQ_2:10;
A65: len (lower_volume (chi A,A),D) = len D by Def8;
then A66: dom (lower_volume (chi A,A),D) = Seg (len D) by FINSEQ_1:def 3;
for i being Nat st i in dom (lower_volume (chi A,A),D) holds
(lower_volume (chi A,A),D) . i = p . i
proof
let i be Nat; :: thesis: ( i in dom (lower_volume (chi A,A),D) implies (lower_volume (chi A,A),D) . i = p . i )
assume A67: i in dom (lower_volume (chi A,A),D) ; :: thesis: (lower_volume (chi A,A),D) . i = p . i
then i in dom D by A65, FINSEQ_3:31;
then (lower_volume (chi A,A),D) . i = vol (divset D,i) by Th21;
hence (lower_volume (chi A,A),D) . i = p . i by A1, A2, A66, A67; :: thesis: verum
end;
hence Sum (lower_volume (chi A,A),D) = vol A by A1, A64, A52, A65, FINSEQ_2:10; :: thesis: verum