:: INTEGRA1 semantic presentation

definition
let c1 be Subset of REAL ;
attr a1 is closed-interval means :Def1: :: INTEGRA1:def 1
ex b1, b2 being Real st
( b1 <= b2 & a1 = [.b1,b2.] );
end;

:: deftheorem Def1 defines closed-interval INTEGRA1:def 1 :
for b1 being Subset of REAL holds
( b1 is closed-interval iff ex b2, b3 being Real st
( b2 <= b3 & b1 = [.b2,b3.] ) );

registration
cluster closed-interval Element of bool REAL ;
existence
ex b1 being Subset of REAL st b1 is closed-interval
proof end;
end;

theorem Th1: :: INTEGRA1:1
for b1 being closed-interval Subset of REAL holds b1 is compact
proof end;

theorem Th2: :: INTEGRA1:2
for b1 being closed-interval Subset of REAL holds not b1 is empty
proof end;

registration
cluster closed-interval -> non empty compact Element of bool REAL ;
coherence
for b1 being Subset of REAL st b1 is closed-interval holds
( not b1 is empty & b1 is compact )
by Th1, Th2;
end;

theorem Th3: :: INTEGRA1:3
for b1 being closed-interval Subset of REAL holds
( b1 is bounded_below & b1 is bounded_above )
proof end;

registration
cluster closed-interval -> bounded Element of bool REAL ;
coherence
for b1 being Subset of REAL st b1 is closed-interval holds
b1 is bounded
proof end;
end;

registration
cluster non empty bounded compact closed-interval Element of bool REAL ;
existence
ex b1 being Subset of REAL st b1 is closed-interval
proof end;
end;

theorem Th4: :: INTEGRA1:4
for b1 being closed-interval Subset of REAL ex b2, b3 being Real st
( b2 <= b3 & b2 = inf b1 & b3 = sup b1 )
proof end;

theorem Th5: :: INTEGRA1:5
for b1 being closed-interval Subset of REAL holds b1 = [.(inf b1),(sup b1).]
proof end;

theorem Th6: :: INTEGRA1:6
for b1 being closed-interval Subset of REAL
for b2, b3, b4, b5 being real number st b1 = [.b2,b4.] & b1 = [.b3,b5.] holds
( b2 = b3 & b4 = b5 )
proof end;

definition
let c1 be non empty compact Subset of REAL ;
mode DivisionPoint of c1 -> non empty increasing FinSequence of REAL means :Def2: :: INTEGRA1:def 2
( rng a2 c= a1 & a2 . (len a2) = sup a1 );
existence
ex b1 being non empty increasing FinSequence of REAL st
( rng b1 c= c1 & b1 . (len b1) = sup c1 )
proof end;
end;

:: deftheorem Def2 defines DivisionPoint INTEGRA1:def 2 :
for b1 being non empty compact Subset of REAL
for b2 being non empty increasing FinSequence of REAL holds
( b2 is DivisionPoint of b1 iff ( rng b2 c= b1 & b2 . (len b2) = sup b1 ) );

definition
let c1 be non empty compact Subset of REAL ;
func divs c1 -> set means :Def3: :: INTEGRA1:def 3
for b1 being set holds
( b1 in a2 iff b1 is DivisionPoint of a1 );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff b2 is DivisionPoint of c1 )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff b3 is DivisionPoint of c1 ) ) & ( for b3 being set holds
( b3 in b2 iff b3 is DivisionPoint of c1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines divs INTEGRA1:def 3 :
for b1 being non empty compact Subset of REAL
for b2 being set holds
( b2 = divs b1 iff for b3 being set holds
( b3 in b2 iff b3 is DivisionPoint of b1 ) );

registration
let c1 be non empty compact Subset of REAL ;
cluster divs a1 -> non empty ;
coherence
not divs c1 is empty
proof end;
end;

definition
let c1 be non empty compact Subset of REAL ;
mode Division of c1 -> non empty set means :Def4: :: INTEGRA1:def 4
for b1 being set holds
( b1 in a2 iff b1 is DivisionPoint of a1 );
existence
ex b1 being non empty set st
for b2 being set holds
( b2 in b1 iff b2 is DivisionPoint of c1 )
proof end;
end;

:: deftheorem Def4 defines Division INTEGRA1:def 4 :
for b1 being non empty compact Subset of REAL
for b2 being non empty set holds
( b2 is Division of b1 iff for b3 being set holds
( b3 in b2 iff b3 is DivisionPoint of b1 ) );

registration
let c1 be non empty compact Subset of REAL ;
cluster non empty Division of a1;
existence
not for b1 being Division of c1 holds b1 is empty
proof end;
end;

definition
let c1 be non empty compact Subset of REAL ;
let c2 be non empty Division of c1;
redefine mode Element as Element of c2 -> DivisionPoint of a1;
coherence
for b1 being Element of c2 holds b1 is DivisionPoint of c1
by Def4;
end;

theorem Th7: :: INTEGRA1:7
canceled;

theorem Th8: :: INTEGRA1:8
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in dom b4 holds
b4 . b1 in b2
proof end;

theorem Th9: :: INTEGRA1:9
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in dom b4 & b1 <> 1 holds
( b1 - 1 in dom b4 & b4 . (b1 - 1) in b2 & b1 - 1 in NAT )
proof end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be non empty Division of c1;
let c3 be Element of c2;
let c4 be Nat;
assume E13: c4 in dom c3 ;
func divset c3,c4 -> closed-interval Subset of REAL means :Def5: :: INTEGRA1:def 5
( inf a5 = inf a1 & sup a5 = a3 . a4 ) if a4 = 1
otherwise ( inf a5 = a3 . (a4 - 1) & sup a5 = a3 . a4 );
existence
( ( c4 = 1 implies ex b1 being closed-interval Subset of REAL st
( inf b1 = inf c1 & sup b1 = c3 . c4 ) ) & ( not c4 = 1 implies ex b1 being closed-interval Subset of REAL st
( inf b1 = c3 . (c4 - 1) & sup b1 = c3 . c4 ) ) )
proof end;
uniqueness
for b1, b2 being closed-interval Subset of REAL holds
( ( c4 = 1 & inf b1 = inf c1 & sup b1 = c3 . c4 & inf b2 = inf c1 & sup b2 = c3 . c4 implies b1 = b2 ) & ( not c4 = 1 & inf b1 = c3 . (c4 - 1) & sup b1 = c3 . c4 & inf b2 = c3 . (c4 - 1) & sup b2 = c3 . c4 implies b1 = b2 ) )
proof end;
correctness
consistency
for b1 being closed-interval Subset of REAL holds verum
;
;
end;

:: deftheorem Def5 defines divset INTEGRA1:def 5 :
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3 being Element of b2
for b4 being Nat st b4 in dom b3 holds
for b5 being closed-interval Subset of REAL holds
( ( b4 = 1 implies ( b5 = divset b3,b4 iff ( inf b5 = inf b1 & sup b5 = b3 . b4 ) ) ) & ( not b4 = 1 implies ( b5 = divset b3,b4 iff ( inf b5 = b3 . (b4 - 1) & sup b5 = b3 . b4 ) ) ) );

theorem Th10: :: INTEGRA1:10
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in dom b4 holds
divset b4,b1 c= b2
proof end;

definition
let c1 be Subset of REAL ;
func vol c1 -> Real equals :: INTEGRA1:def 6
(sup a1) - (inf a1);
correctness
coherence
(sup c1) - (inf c1) is Real
;
;
end;

:: deftheorem Def6 defines vol INTEGRA1:def 6 :
for b1 being Subset of REAL holds vol b1 = (sup b1) - (inf b1);

theorem Th11: :: INTEGRA1:11
for b1 being non empty bounded Subset of REAL holds 0 <= vol b1
proof end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
let c3 be non empty Division of c1;
let c4 be Element of c3;
func upper_volume c2,c4 -> FinSequence of REAL means :Def7: :: INTEGRA1:def 7
( len a5 = len a4 & ( for b1 being Nat st b1 in Seg (len a4) holds
a5 . b1 = (sup (rng (a2 | (divset a4,b1)))) * (vol (divset a4,b1)) ) );
existence
ex b1 being FinSequence of REAL st
( len b1 = len c4 & ( for b2 being Nat st b2 in Seg (len c4) holds
b1 . b2 = (sup (rng (c2 | (divset c4,b2)))) * (vol (divset c4,b2)) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of REAL st len b1 = len c4 & ( for b3 being Nat st b3 in Seg (len c4) holds
b1 . b3 = (sup (rng (c2 | (divset c4,b3)))) * (vol (divset c4,b3)) ) & len b2 = len c4 & ( for b3 being Nat st b3 in Seg (len c4) holds
b2 . b3 = (sup (rng (c2 | (divset c4,b3)))) * (vol (divset c4,b3)) ) holds
b1 = b2
proof end;
func lower_volume c2,c4 -> FinSequence of REAL means :Def8: :: INTEGRA1:def 8
( len a5 = len a4 & ( for b1 being Nat st b1 in Seg (len a4) holds
a5 . b1 = (inf (rng (a2 | (divset a4,b1)))) * (vol (divset a4,b1)) ) );
existence
ex b1 being FinSequence of REAL st
( len b1 = len c4 & ( for b2 being Nat st b2 in Seg (len c4) holds
b1 . b2 = (inf (rng (c2 | (divset c4,b2)))) * (vol (divset c4,b2)) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of REAL st len b1 = len c4 & ( for b3 being Nat st b3 in Seg (len c4) holds
b1 . b3 = (inf (rng (c2 | (divset c4,b3)))) * (vol (divset c4,b3)) ) & len b2 = len c4 & ( for b3 being Nat st b3 in Seg (len c4) holds
b2 . b3 = (inf (rng (c2 | (divset c4,b3)))) * (vol (divset c4,b3)) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def7 defines upper_volume INTEGRA1:def 7 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3
for b5 being FinSequence of REAL holds
( b5 = upper_volume b2,b4 iff ( len b5 = len b4 & ( for b6 being Nat st b6 in Seg (len b4) holds
b5 . b6 = (sup (rng (b2 | (divset b4,b6)))) * (vol (divset b4,b6)) ) ) );

:: deftheorem Def8 defines lower_volume INTEGRA1:def 8 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3
for b5 being FinSequence of REAL holds
( b5 = lower_volume b2,b4 iff ( len b5 = len b4 & ( for b6 being Nat st b6 in Seg (len b4) holds
b5 . b6 = (inf (rng (b2 | (divset b4,b6)))) * (vol (divset b4,b6)) ) ) );

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
let c3 be non empty Division of c1;
let c4 be Element of c3;
func upper_sum c2,c4 -> Real equals :: INTEGRA1:def 9
Sum (upper_volume a2,a4);
correctness
coherence
Sum (upper_volume c2,c4) is Real
;
;
func lower_sum c2,c4 -> Real equals :: INTEGRA1:def 10
Sum (lower_volume a2,a4);
correctness
coherence
Sum (lower_volume c2,c4) is Real
;
;
end;

:: deftheorem Def9 defines upper_sum INTEGRA1:def 9 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 holds upper_sum b2,b4 = Sum (upper_volume b2,b4);

:: deftheorem Def10 defines lower_sum INTEGRA1:def 10 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 holds lower_sum b2,b4 = Sum (lower_volume b2,b4);

definition
let c1 be closed-interval Subset of REAL ;
redefine func divs as divs c1 -> Division of a1;
coherence
divs c1 is Division of c1
proof end;
end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
func upper_sum_set c2 -> PartFunc of divs a1, REAL means :Def11: :: INTEGRA1:def 11
( dom a3 = divs a1 & ( for b1 being Element of divs a1 st b1 in dom a3 holds
a3 . b1 = upper_sum a2,b1 ) );
existence
ex b1 being PartFunc of divs c1, REAL st
( dom b1 = divs c1 & ( for b2 being Element of divs c1 st b2 in dom b1 holds
b1 . b2 = upper_sum c2,b2 ) )
proof end;
uniqueness
for b1, b2 being PartFunc of divs c1, REAL st dom b1 = divs c1 & ( for b3 being Element of divs c1 st b3 in dom b1 holds
b1 . b3 = upper_sum c2,b3 ) & dom b2 = divs c1 & ( for b3 being Element of divs c1 st b3 in dom b2 holds
b2 . b3 = upper_sum c2,b3 ) holds
b1 = b2
proof end;
func lower_sum_set c2 -> PartFunc of divs a1, REAL means :Def12: :: INTEGRA1:def 12
( dom a3 = divs a1 & ( for b1 being Element of divs a1 st b1 in dom a3 holds
a3 . b1 = lower_sum a2,b1 ) );
existence
ex b1 being PartFunc of divs c1, REAL st
( dom b1 = divs c1 & ( for b2 being Element of divs c1 st b2 in dom b1 holds
b1 . b2 = lower_sum c2,b2 ) )
proof end;
uniqueness
for b1, b2 being PartFunc of divs c1, REAL st dom b1 = divs c1 & ( for b3 being Element of divs c1 st b3 in dom b1 holds
b1 . b3 = lower_sum c2,b3 ) & dom b2 = divs c1 & ( for b3 being Element of divs c1 st b3 in dom b2 holds
b2 . b3 = lower_sum c2,b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines upper_sum_set INTEGRA1:def 11 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being PartFunc of divs b1, REAL holds
( b3 = upper_sum_set b2 iff ( dom b3 = divs b1 & ( for b4 being Element of divs b1 st b4 in dom b3 holds
b3 . b4 = upper_sum b2,b4 ) ) );

:: deftheorem Def12 defines lower_sum_set INTEGRA1:def 12 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being PartFunc of divs b1, REAL holds
( b3 = lower_sum_set b2 iff ( dom b3 = divs b1 & ( for b4 being Element of divs b1 st b4 in dom b3 holds
b3 . b4 = lower_sum b2,b4 ) ) );

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
pred c2 is_upper_integrable_on c1 means :Def13: :: INTEGRA1:def 13
rng (upper_sum_set a2) is bounded_below;
pred c2 is_lower_integrable_on c1 means :Def14: :: INTEGRA1:def 14
rng (lower_sum_set a2) is bounded_above;
end;

:: deftheorem Def13 defines is_upper_integrable_on INTEGRA1:def 13 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds
( b2 is_upper_integrable_on b1 iff rng (upper_sum_set b2) is bounded_below );

:: deftheorem Def14 defines is_lower_integrable_on INTEGRA1:def 14 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds
( b2 is_lower_integrable_on b1 iff rng (lower_sum_set b2) is bounded_above );

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
func upper_integral c2 -> Real equals :: INTEGRA1:def 15
inf (rng (upper_sum_set a2));
correctness
coherence
inf (rng (upper_sum_set c2)) is Real
;
;
end;

:: deftheorem Def15 defines upper_integral INTEGRA1:def 15 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds upper_integral b2 = inf (rng (upper_sum_set b2));

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
func lower_integral c2 -> Real equals :: INTEGRA1:def 16
sup (rng (lower_sum_set a2));
correctness
coherence
sup (rng (lower_sum_set c2)) is Real
;
;
end;

:: deftheorem Def16 defines lower_integral INTEGRA1:def 16 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds lower_integral b2 = sup (rng (lower_sum_set b2));

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
pred c2 is_integrable_on c1 means :Def17: :: INTEGRA1:def 17
( a2 is_upper_integrable_on a1 & a2 is_lower_integrable_on a1 & upper_integral a2 = lower_integral a2 );
end;

:: deftheorem Def17 defines is_integrable_on INTEGRA1:def 17 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds
( b2 is_integrable_on b1 iff ( b2 is_upper_integrable_on b1 & b2 is_lower_integrable_on b1 & upper_integral b2 = lower_integral b2 ) );

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
func integral c2 -> Real equals :: INTEGRA1:def 18
upper_integral a2;
correctness
coherence
upper_integral c2 is Real
;
;
end;

:: deftheorem Def18 defines integral INTEGRA1:def 18 :
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL holds integral b2 = upper_integral b2;

theorem Th12: :: INTEGRA1:12
for b1 being non empty set
for b2, b3 being PartFunc of b1, REAL holds rng (b2 + b3) c= (rng b2) + (rng b3)
proof end;

theorem Th13: :: INTEGRA1:13
for b1 being non empty set
for b2 being PartFunc of b1, REAL st b2 is_bounded_below_on b1 holds
rng b2 is bounded_below
proof end;

theorem Th14: :: INTEGRA1:14
for b1 being non empty set
for b2 being PartFunc of b1, REAL st rng b2 is bounded_below holds
b2 is_bounded_below_on b1
proof end;

theorem Th15: :: INTEGRA1:15
for b1 being non empty set
for b2 being PartFunc of b1, REAL st b2 is_bounded_above_on b1 holds
rng b2 is bounded_above
proof end;

theorem Th16: :: INTEGRA1:16
for b1 being non empty set
for b2 being PartFunc of b1, REAL st rng b2 is bounded_above holds
b2 is_bounded_above_on b1
proof end;

theorem Th17: :: INTEGRA1:17
for b1 being non empty set
for b2 being PartFunc of b1, REAL st b2 is_bounded_on b1 holds
rng b2 is bounded
proof end;

theorem Th18: :: INTEGRA1:18
for b1 being non empty set holds chi b1,b1 is_constant_on b1
proof end;

theorem Th19: :: INTEGRA1:19
for b1 being non empty set
for b2 being non empty Subset of b1 holds rng (chi b2,b2) = {1}
proof end;

theorem Th20: :: INTEGRA1:20
for b1 being non empty set
for b2 being non empty Subset of b1
for b3 being set st b3 meets dom (chi b2,b2) holds
rng ((chi b2,b2) | b3) = {1}
proof end;

theorem Th21: :: INTEGRA1:21
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in Seg (len b4) holds
vol (divset b4,b1) = (lower_volume (chi b2,b2),b4) . b1
proof end;

theorem Th22: :: INTEGRA1:22
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in Seg (len b4) holds
vol (divset b4,b1) = (upper_volume (chi b2,b2),b4) . b1
proof end;

theorem Th23: :: INTEGRA1:23
for b1, b2, b3 being FinSequence of REAL st len b1 = len b2 & len b1 = len b3 & ( for b4 being Nat st b4 in dom b1 holds
b3 . b4 = (b1 /. b4) + (b2 /. b4) ) holds
Sum b3 = (Sum b1) + (Sum b2)
proof end;

theorem Th24: :: INTEGRA1:24
for b1, b2, b3 being FinSequence of REAL st len b1 = len b2 & len b1 = len b3 & ( for b4 being Nat st b4 in dom b1 holds
b3 . b4 = (b1 /. b4) - (b2 /. b4) ) holds
Sum b3 = (Sum b1) - (Sum b2)
proof end;

theorem Th25: :: INTEGRA1:25
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3 being Element of b2 holds Sum (lower_volume (chi b1,b1),b3) = vol b1
proof end;

theorem Th26: :: INTEGRA1:26
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3 being Element of b2 holds Sum (upper_volume (chi b1,b1),b3) = vol b1
proof end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
let c3 be non empty Division of c1;
let c4 be Element of c3;
redefine func upper_volume as upper_volume c2,c4 -> non empty FinSequence of REAL ;
coherence
upper_volume c2,c4 is non empty FinSequence of REAL
proof end;
end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be PartFunc of c1, REAL ;
let c3 be non empty Division of c1;
let c4 be Element of c3;
redefine func lower_volume as lower_volume c2,c4 -> non empty FinSequence of REAL ;
coherence
lower_volume c2,c4 is non empty FinSequence of REAL
proof end;
end;

theorem Th27: :: INTEGRA1:27
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 st b2 is_bounded_below_on b1 holds
(inf (rng b2)) * (vol b1) <= lower_sum b2,b4
proof end;

theorem Th28: :: INTEGRA1:28
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3
for b5 being Nat st b2 is_bounded_above_on b1 & b5 in Seg (len b4) holds
(sup (rng b2)) * (vol (divset b4,b5)) >= (sup (rng (b2 | (divset b4,b5)))) * (vol (divset b4,b5))
proof end;

theorem Th29: :: INTEGRA1:29
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 st b2 is_bounded_above_on b1 holds
upper_sum b2,b4 <= (sup (rng b2)) * (vol b1)
proof end;

theorem Th30: :: INTEGRA1:30
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 st b2 is_bounded_on b1 holds
lower_sum b2,b4 <= upper_sum b2,b4
proof end;

definition
let c1 be non empty FinSequence of REAL ;
redefine func rng as rng c1 -> non empty finite Subset of REAL ;
coherence
rng c1 is non empty finite Subset of REAL
proof end;
end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be Element of divs c1;
func delta c2 -> Real equals :: INTEGRA1:def 19
max (rng (upper_volume (chi a1,a1),a2));
correctness
coherence
max (rng (upper_volume (chi c1,c1),c2)) is Real
;
by XREAL_0:def 1;
end;

:: deftheorem Def19 defines delta INTEGRA1:def 19 :
for b1 being closed-interval Subset of REAL
for b2 being Element of divs b1 holds delta b2 = max (rng (upper_volume (chi b1,b1),b2));

definition
let c1 be closed-interval Subset of REAL ;
let c2 be non empty Division of c1;
let c3, c4 be Element of c2;
pred c3 <= c4 means :Def20: :: INTEGRA1:def 20
( len a3 <= len a4 & rng a3 c= rng a4 );
end;

:: deftheorem Def20 defines <= INTEGRA1:def 20 :
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3, b4 being Element of b2 holds
( b3 <= b4 iff ( len b3 <= len b4 & rng b3 c= rng b4 ) );

notation
let c1 be closed-interval Subset of REAL ;
let c2 be non empty Division of c1;
let c3, c4 be Element of c2;
synonym c4 >= c3 for c3 <= c4;
end;

theorem Th31: :: INTEGRA1:31
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3, b4 being Element of b2 st len b3 = 1 holds
b3 <= b4
proof end;

theorem Th32: :: INTEGRA1:32
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b2 is_bounded_above_on b1 & len b4 = 1 holds
upper_sum b2,b4 >= upper_sum b2,b5
proof end;

theorem Th33: :: INTEGRA1:33
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b2 is_bounded_below_on b1 & len b4 = 1 holds
lower_sum b2,b4 <= lower_sum b2,b5
proof end;

theorem Th34: :: INTEGRA1:34
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4 being Element of b3 st b1 in dom b4 holds
ex b5, b6 being closed-interval Subset of REAL st
( b5 = [.(inf b2),(b4 . b1).] & b6 = [.(b4 . b1),(sup b2).] & b2 = b5 \/ b6 )
proof end;

theorem Th35: :: INTEGRA1:35
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3 being non empty Division of b2
for b4, b5 being Element of b3 st b1 in dom b4 & b4 <= b5 holds
ex b6 being Nat st
( b6 in dom b5 & b4 . b1 = b5 . b6 )
proof end;

definition
let c1 be closed-interval Subset of REAL ;
let c2 be non empty Division of c1;
let c3, c4 be Element of c2;
let c5 be Nat;
assume E42: c3 <= c4 ;
func indx c4,c3,c5 -> Nat means :Def21: :: INTEGRA1:def 21
( a6 in dom a4 & a3 . a5 = a4 . a6 ) if a5 in dom a3
otherwise a6 = 0;
existence
( ( c5 in dom c3 implies ex b1 being Nat st
( b1 in dom c4 & c3 . c5 = c4 . b1 ) ) & ( not c5 in dom c3 implies ex b1 being Nat st b1 = 0 ) )
by E42, Th35;
uniqueness
for b1, b2 being Nat holds
( ( c5 in dom c3 & b1 in dom c4 & c3 . c5 = c4 . b1 & b2 in dom c4 & c3 . c5 = c4 . b2 implies b1 = b2 ) & ( not c5 in dom c3 & b1 = 0 & b2 = 0 implies b1 = b2 ) )
proof end;
correctness
consistency
for b1 being Nat holds verum
;
;
end;

:: deftheorem Def21 defines indx INTEGRA1:def 21 :
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3, b4 being Element of b2
for b5 being Nat st b3 <= b4 holds
for b6 being Nat holds
( ( b5 in dom b3 implies ( b6 = indx b4,b3,b5 iff ( b6 in dom b4 & b3 . b5 = b4 . b6 ) ) ) & ( not b5 in dom b3 implies ( b6 = indx b4,b3,b5 iff b6 = 0 ) ) );

theorem Th36: :: INTEGRA1:36
for b1 being increasing FinSequence of REAL
for b2 being Nat st b2 <= len b1 holds
b1 /^ b2 is increasing FinSequence of REAL
proof end;

theorem Th37: :: INTEGRA1:37
for b1 being increasing FinSequence of REAL
for b2, b3 being Nat st b3 in dom b1 & b2 <= b3 holds
mid b1,b2,b3 is increasing FinSequence of REAL
proof end;

theorem Th38: :: INTEGRA1:38
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3 being Element of b2
for b4, b5 being Nat st b4 in dom b3 & b5 in dom b3 & b4 <= b5 holds
ex b6 being closed-interval Subset of REAL st
( inf b6 = (mid b3,b4,b5) . 1 & sup b6 = (mid b3,b4,b5) . (len (mid b3,b4,b5)) & len (mid b3,b4,b5) = (b5 - b4) + 1 & mid b3,b4,b5 is DivisionPoint of b6 )
proof end;

theorem Th39: :: INTEGRA1:39
for b1, b2 being closed-interval Subset of REAL
for b3 being non empty Division of b1
for b4 being non empty Division of b2
for b5 being Element of b3
for b6, b7 being Nat st b6 in dom b5 & b7 in dom b5 & b6 <= b7 & b5 . b6 >= inf b2 & b5 . b7 = sup b2 holds
mid b5,b6,b7 is Element of b4
proof end;

definition
let c1 be FinSequence of REAL ;
func PartSums c1 -> FinSequence of REAL means :Def22: :: INTEGRA1:def 22
( len a2 = len a1 & ( for b1 being Nat st b1 in Seg (len a1) holds
a2 . b1 = Sum (a1 | b1) ) );
existence
ex b1 being FinSequence of REAL st
( len b1 = len c1 & ( for b2 being Nat st b2 in Seg (len c1) holds
b1 . b2 = Sum (c1 | b2) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of REAL st len b1 = len c1 & ( for b3 being Nat st b3 in Seg (len c1) holds
b1 . b3 = Sum (c1 | b3) ) & len b2 = len c1 & ( for b3 being Nat st b3 in Seg (len c1) holds
b2 . b3 = Sum (c1 | b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def22 defines PartSums INTEGRA1:def 22 :
for b1, b2 being FinSequence of REAL holds
( b2 = PartSums b1 iff ( len b2 = len b1 & ( for b3 being Nat st b3 in Seg (len b1) holds
b2 . b3 = Sum (b1 | b3) ) ) );

theorem Th40: :: INTEGRA1:40
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b4 <= b5 & b2 is_bounded_above_on b1 holds
for b6 being non empty Nat st b6 in dom b4 holds
Sum ((upper_volume b2,b4) | b6) >= Sum ((upper_volume b2,b5) | (indx b5,b4,b6))
proof end;

theorem Th41: :: INTEGRA1:41
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b4 <= b5 & b2 is_bounded_below_on b1 holds
for b6 being non empty Nat st b6 in dom b4 holds
Sum ((lower_volume b2,b4) | b6) <= Sum ((lower_volume b2,b5) | (indx b5,b4,b6))
proof end;

theorem Th42: :: INTEGRA1:42
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3
for b6 being Nat st b4 <= b5 & b6 in dom b4 & b2 is_bounded_above_on b1 holds
(PartSums (upper_volume b2,b4)) . b6 >= (PartSums (upper_volume b2,b5)) . (indx b5,b4,b6)
proof end;

theorem Th43: :: INTEGRA1:43
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3
for b6 being Nat st b4 <= b5 & b6 in dom b4 & b2 is_bounded_below_on b1 holds
(PartSums (lower_volume b2,b4)) . b6 <= (PartSums (lower_volume b2,b5)) . (indx b5,b4,b6)
proof end;

theorem Th44: :: INTEGRA1:44
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 holds (PartSums (upper_volume b2,b4)) . (len b4) = upper_sum b2,b4
proof end;

theorem Th45: :: INTEGRA1:45
for b1 being closed-interval Subset of REAL
for b2 being PartFunc of b1, REAL
for b3 being non empty Division of b1
for b4 being Element of b3 holds (PartSums (lower_volume b2,b4)) . (len b4) = lower_sum b2,b4
proof end;

theorem Th46: :: INTEGRA1:46
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3, b4 being Element of b2 st b3 <= b4 holds
indx b4,b3,(len b3) = len b4
proof end;

theorem Th47: :: INTEGRA1:47
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b4 <= b5 & b2 is_bounded_above_on b1 holds
upper_sum b2,b5 <= upper_sum b2,b4
proof end;

theorem Th48: :: INTEGRA1:48
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b4 <= b5 & b2 is_bounded_below_on b1 holds
lower_sum b2,b5 >= lower_sum b2,b4
proof end;

theorem Th49: :: INTEGRA1:49
for b1 being closed-interval Subset of REAL
for b2 being non empty Division of b1
for b3, b4 being Element of b2 ex b5 being Element of b2 st
( b3 <= b5 & b4 <= b5 )
proof end;

theorem Th50: :: INTEGRA1:50
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL
for b3 being non empty Division of b1
for b4, b5 being Element of b3 st b2 is_bounded_on b1 holds
lower_sum b2,b4 <= upper_sum b2,b5
proof end;

theorem Th51: :: INTEGRA1:51
for b1 being closed-interval Subset of REAL
for b2 being Function of b1, REAL st b2 is_bounded_on b1 holds
upper_integral b2 >= lower_integral b2
proof end;

theorem Th52: :: INTEGRA1:52
for b1, b2 being Subset of REAL holds (- b1) + (- b2) = - (b1 + b2)
proof end;

theorem Th53: :: INTEGRA1:53
for b1, b2 being Subset of REAL st b1 is bounded_above & b2 is bounded_above holds
b1 + b2 is bounded_above
proof end;

theorem Th54: :: INTEGRA1:54
for b1, b2 being non empty Subset of REAL st b1 is bounded_above & b2 is bounded_above holds
sup (b1 + b2) = (sup b1) + (sup b2)
proof end;

theorem Th55: :: INTEGRA1:55
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3, b4 being Function of b2, REAL
for b5 being non empty Division of b2
for b6 being Element of b5 st b1 in Seg (len b6) & b3 is_bounded_above_on b2 & b4 is_bounded_above_on b2 holds
(upper_volume (b3 + b4),b6) . b1 <= ((upper_volume b3,b6) . b1) + ((upper_volume b4,b6) . b1)
proof end;

theorem Th56: :: INTEGRA1:56
for b1 being Nat
for b2 being closed-interval Subset of REAL
for b3, b4 being Function of b2, REAL
for b5 being non empty Division of b2
for b6 being Element of b5 st b1 in Seg (len b6) & b3 is_bounded_below_on b2 & b4 is_bounded_below_on b2 holds
((lower_volume b3,b6) . b1) + ((lower_volume b4,b6) . b1) <= (lower_volume (b3 + b4),b6) . b1
proof end;

theorem Th57: :: INTEGRA1:57
for b1 being closed-interval Subset of REAL
for b2, b3 being Function of b1, REAL
for b4 being non empty Division of b1
for b5 being Element of b4 st b2 is_bounded_above_on b1 & b3 is_bounded_above_on b1 holds
upper_sum (b2 + b3),b5 <= (upper_sum b2,b5) + (upper_sum b3,b5)
proof end;

theorem Th58: :: INTEGRA1:58
for b1 being closed-interval Subset of REAL
for b2, b3 being Function of b1, REAL
for b4 being non empty Division of b1
for b5 being Element of b4 st b2 is_bounded_below_on b1 & b3 is_bounded_below_on b1 holds
(lower_sum b2,b5) + (lower_sum b3,b5) <= lower_sum (b2 + b3),b5
proof end;

theorem Th59: :: INTEGRA1:59
for b1 being closed-interval Subset of REAL
for b2, b3 being Function of b1, REAL st b2 is_bounded_on b1 & b3 is_bounded_on b1 & b2 is_integrable_on b1 & b3 is_integrable_on b1 holds
( b2 + b3 is_integrable_on b1 & integral (b2 + b3) = (integral b2) + (integral b3) )
proof end;