:: RFINSEQ semantic presentation

definition
let c1, c2 be Relation;
pred c1,c2 are_fiberwise_equipotent means :Def1: :: RFINSEQ:def 1
for b1 being set holds Card (a1 " {b1}) = Card (a2 " {b1});
reflexivity
for b1 being Relation
for b2 being set holds Card (b1 " {b2}) = Card (b1 " {b2})
;
symmetry
for b1, b2 being Relation st ( for b3 being set holds Card (b1 " {b3}) = Card (b2 " {b3}) ) holds
for b3 being set holds Card (b2 " {b3}) = Card (b1 " {b3})
;
end;

:: deftheorem Def1 defines are_fiberwise_equipotent RFINSEQ:def 1 :
for b1, b2 being Relation holds
( b1,b2 are_fiberwise_equipotent iff for b3 being set holds Card (b1 " {b3}) = Card (b2 " {b3}) );

Lemma2: for b1 being Function
for b2 being set st not b2 in rng b1 holds
b1 " {b2} = {}
proof end;

theorem Th1: :: RFINSEQ:1
for b1, b2 being Function st b1,b2 are_fiberwise_equipotent holds
rng b1 = rng b2
proof end;

theorem Th2: :: RFINSEQ:2
for b1, b2, b3 being Function st b1,b2 are_fiberwise_equipotent & b1,b3 are_fiberwise_equipotent holds
b2,b3 are_fiberwise_equipotent
proof end;

theorem Th3: :: RFINSEQ:3
for b1, b2 being Function holds
( b1,b2 are_fiberwise_equipotent iff ex b3 being Function st
( dom b3 = dom b1 & rng b3 = dom b2 & b3 is one-to-one & b1 = b2 * b3 ) )
proof end;

theorem Th4: :: RFINSEQ:4
for b1, b2 being Function holds
( b1,b2 are_fiberwise_equipotent iff for b3 being set holds Card (b1 " b3) = Card (b2 " b3) )
proof end;

theorem Th5: :: RFINSEQ:5
for b1 being non empty set
for b2, b3 being Function st rng b2 c= b1 & rng b3 c= b1 holds
( b2,b3 are_fiberwise_equipotent iff for b4 being Element of b1 holds Card (b2 " {b4}) = Card (b3 " {b4}) )
proof end;

theorem Th6: :: RFINSEQ:6
for b1, b2 being Function st dom b1 = dom b2 holds
( b1,b2 are_fiberwise_equipotent iff ex b3 being Permutation of dom b1 st b1 = b2 * b3 )
proof end;

theorem Th7: :: RFINSEQ:7
for b1, b2 being Function st b1,b2 are_fiberwise_equipotent holds
Card (dom b1) = Card (dom b2)
proof end;

theorem Th8: :: RFINSEQ:8
canceled;

theorem Th9: :: RFINSEQ:9
for b1, b2 being finite Function holds
( b1,b2 are_fiberwise_equipotent iff for b3 being set holds card (b1 " b3) = card (b2 " b3) ) by Th4;

theorem Th10: :: RFINSEQ:10
for b1, b2 being finite Function st b1,b2 are_fiberwise_equipotent holds
card (dom b1) = card (dom b2)
proof end;

theorem Th11: :: RFINSEQ:11
for b1 being non empty set
for b2, b3 being finite Function st rng b2 c= b1 & rng b3 c= b1 holds
( b2,b3 are_fiberwise_equipotent iff for b4 being Element of b1 holds card (b2 " {b4}) = card (b3 " {b4}) ) by Th5;

theorem Th12: :: RFINSEQ:12
canceled;

theorem Th13: :: RFINSEQ:13
for b1, b2 being FinSequence holds
( b1,b2 are_fiberwise_equipotent iff for b3 being set holds card (b1 " b3) = card (b2 " b3) ) by Th4;

theorem Th14: :: RFINSEQ:14
for b1, b2, b3 being FinSequence holds
( b1,b2 are_fiberwise_equipotent iff b1 ^ b3,b2 ^ b3 are_fiberwise_equipotent )
proof end;

theorem Th15: :: RFINSEQ:15
for b1, b2 being FinSequence holds b1 ^ b2,b2 ^ b1 are_fiberwise_equipotent
proof end;

theorem Th16: :: RFINSEQ:16
for b1, b2 being FinSequence st b1,b2 are_fiberwise_equipotent holds
( len b1 = len b2 & dom b1 = dom b2 )
proof end;

theorem Th17: :: RFINSEQ:17
for b1, b2 being FinSequence holds
( b1,b2 are_fiberwise_equipotent iff ex b3 being Permutation of dom b2 st b1 = b2 * b3 )
proof end;

registration
let c1 be Function;
let c2 be finite set ;
cluster a1 | a2 -> Function-like finite ;
coherence
( c1 | c2 is finite & c1 | c2 is Function-like )
proof end;
end;

defpred S1[ Nat] means for b1 being finite set
for b2 being Function st card (dom (b2 | b1)) = a1 holds
ex b3 being FinSequence st b2 | b1,b3 are_fiberwise_equipotent ;

Lemma10: S1[0]
proof end;

Lemma11: for b1 being Nat st S1[b1] holds
S1[b1 + 1]
proof end;

theorem Th18: :: RFINSEQ:18
for b1 being Function
for b2 being finite set ex b3 being FinSequence st b1 | b2,b3 are_fiberwise_equipotent
proof end;

definition
let c1 be set ;
let c2 be FinSequence of c1;
let c3 be Nat;
func c2 /^ c3 -> FinSequence of a1 means :Def2: :: RFINSEQ:def 2
( len a4 = (len a2) - a3 & ( for b1 being Nat st b1 in dom a4 holds
a4 . b1 = a2 . (b1 + a3) ) ) if a3 <= len a2
otherwise a4 = <*> a1;
existence
( ( c3 <= len c2 implies ex b1 being FinSequence of c1 st
( len b1 = (len c2) - c3 & ( for b2 being Nat st b2 in dom b1 holds
b1 . b2 = c2 . (b2 + c3) ) ) ) & ( not c3 <= len c2 implies ex b1 being FinSequence of c1 st b1 = <*> c1 ) )
proof end;
uniqueness
for b1, b2 being FinSequence of c1 holds
( ( c3 <= len c2 & len b1 = (len c2) - c3 & ( for b3 being Nat st b3 in dom b1 holds
b1 . b3 = c2 . (b3 + c3) ) & len b2 = (len c2) - c3 & ( for b3 being Nat st b3 in dom b2 holds
b2 . b3 = c2 . (b3 + c3) ) implies b1 = b2 ) & ( not c3 <= len c2 & b1 = <*> c1 & b2 = <*> c1 implies b1 = b2 ) )
proof end;
consistency
for b1 being FinSequence of c1 holds verum
;
end;

:: deftheorem Def2 defines /^ RFINSEQ:def 2 :
for b1 being set
for b2 being FinSequence of b1
for b3 being Nat
for b4 being FinSequence of b1 holds
( ( b3 <= len b2 implies ( b4 = b2 /^ b3 iff ( len b4 = (len b2) - b3 & ( for b5 being Nat st b5 in dom b4 holds
b4 . b5 = b2 . (b5 + b3) ) ) ) ) & ( not b3 <= len b2 implies ( b4 = b2 /^ b3 iff b4 = <*> b1 ) ) );

Lemma13: for b1 being Nat
for b2 being non empty set
for b3 being FinSequence of b2 st len b3 <= b1 holds
b3 | b1 = b3
proof end;

theorem Th19: :: RFINSEQ:19
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st b3 in dom b2 & b4 in Seg b3 holds
( (b2 | b3) . b4 = b2 . b4 & b4 in dom b2 )
proof end;

theorem Th20: :: RFINSEQ:20
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat
for b4 being set st len b2 = b3 + 1 & b4 = b2 . (b3 + 1) holds
b2 = (b2 | b3) ^ <*b4*>
proof end;

theorem Th21: :: RFINSEQ:21
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat holds (b2 | b3) ^ (b2 /^ b3) = b2
proof end;

theorem Th22: :: RFINSEQ:22
for b1, b2 being FinSequence of REAL st b1,b2 are_fiberwise_equipotent holds
Sum b1 = Sum b2
proof end;

definition
let c1 be FinSequence of REAL ;
func MIM c1 -> FinSequence of REAL means :Def3: :: RFINSEQ:def 3
( len a2 = len a1 & a2 . (len a2) = a1 . (len a1) & ( for b1 being Nat st 1 <= b1 & b1 <= (len a2) - 1 holds
a2 . b1 = (a1 . b1) - (a1 . (b1 + 1)) ) );
existence
ex b1 being FinSequence of REAL st
( len b1 = len c1 & b1 . (len b1) = c1 . (len c1) & ( for b2 being Nat st 1 <= b2 & b2 <= (len b1) - 1 holds
b1 . b2 = (c1 . b2) - (c1 . (b2 + 1)) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of REAL st len b1 = len c1 & b1 . (len b1) = c1 . (len c1) & ( for b3 being Nat st 1 <= b3 & b3 <= (len b1) - 1 holds
b1 . b3 = (c1 . b3) - (c1 . (b3 + 1)) ) & len b2 = len c1 & b2 . (len b2) = c1 . (len c1) & ( for b3 being Nat st 1 <= b3 & b3 <= (len b2) - 1 holds
b2 . b3 = (c1 . b3) - (c1 . (b3 + 1)) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines MIM RFINSEQ:def 3 :
for b1, b2 being FinSequence of REAL holds
( b2 = MIM b1 iff ( len b2 = len b1 & b2 . (len b2) = b1 . (len b1) & ( for b3 being Nat st 1 <= b3 & b3 <= (len b2) - 1 holds
b2 . b3 = (b1 . b3) - (b1 . (b3 + 1)) ) ) );

theorem Th23: :: RFINSEQ:23
for b1 being FinSequence of REAL
for b2 being Real
for b3 being Nat st len b1 = b3 + 2 & b1 . (b3 + 1) = b2 holds
MIM (b1 | (b3 + 1)) = ((MIM b1) | b3) ^ <*b2*>
proof end;

theorem Th24: :: RFINSEQ:24
for b1 being FinSequence of REAL
for b2, b3 being Real
for b4 being Nat st len b1 = b4 + 2 & b1 . (b4 + 1) = b2 & b1 . (b4 + 2) = b3 holds
MIM b1 = ((MIM b1) | b4) ^ <*(b2 - b3),b3*>
proof end;

theorem Th25: :: RFINSEQ:25
MIM (<*> REAL ) = <*> REAL
proof end;

theorem Th26: :: RFINSEQ:26
for b1 being Real holds MIM <*b1*> = <*b1*>
proof end;

theorem Th27: :: RFINSEQ:27
for b1, b2 being Real holds MIM <*b1,b2*> = <*(b1 - b2),b2*>
proof end;

theorem Th28: :: RFINSEQ:28
for b1 being FinSequence of REAL
for b2 being Nat holds (MIM b1) /^ b2 = MIM (b1 /^ b2)
proof end;

theorem Th29: :: RFINSEQ:29
for b1 being FinSequence of REAL st len b1 <> 0 holds
Sum (MIM b1) = b1 . 1
proof end;

theorem Th30: :: RFINSEQ:30
for b1 being FinSequence of REAL
for b2 being Nat st 1 <= b2 & b2 < len b1 holds
Sum (MIM (b1 /^ b2)) = b1 . (b2 + 1)
proof end;

definition
let c1 be FinSequence of REAL ;
attr a1 is non-increasing means :Def4: :: RFINSEQ:def 4
for b1 being Nat st b1 in dom a1 & b1 + 1 in dom a1 holds
a1 . b1 >= a1 . (b1 + 1);
end;

:: deftheorem Def4 defines non-increasing RFINSEQ:def 4 :
for b1 being FinSequence of REAL holds
( b1 is non-increasing iff for b2 being Nat st b2 in dom b1 & b2 + 1 in dom b1 holds
b1 . b2 >= b1 . (b2 + 1) );

registration
cluster non-increasing FinSequence of REAL ;
existence
ex b1 being FinSequence of REAL st b1 is non-increasing
proof end;
end;

theorem Th31: :: RFINSEQ:31
for b1 being FinSequence of REAL st ( len b1 = 0 or len b1 = 1 ) holds
b1 is non-increasing
proof end;

theorem Th32: :: RFINSEQ:32
for b1 being FinSequence of REAL holds
( b1 is non-increasing iff for b2, b3 being Nat st b2 in dom b1 & b3 in dom b1 & b2 < b3 holds
b1 . b2 >= b1 . b3 )
proof end;

theorem Th33: :: RFINSEQ:33
for b1 being non-increasing FinSequence of REAL
for b2 being Nat holds b1 | b2 is non-increasing FinSequence of REAL
proof end;

theorem Th34: :: RFINSEQ:34
for b1 being non-increasing FinSequence of REAL
for b2 being Nat holds b1 /^ b2 is non-increasing FinSequence of REAL
proof end;

Lemma27: for b1, b2 being non-increasing FinSequence of REAL
for b3 being Nat st len b1 = b3 + 1 & len b1 = len b2 & b1,b2 are_fiberwise_equipotent holds
( b1 . (len b1) = b2 . (len b2) & b1 | b3,b2 | b3 are_fiberwise_equipotent )
proof end;

defpred S2[ Nat] means for b1 being FinSequence of REAL st a1 = len b1 holds
ex b2 being non-increasing FinSequence of REAL st b1,b2 are_fiberwise_equipotent ;

Lemma28: S2[0]
proof end;

Lemma29: for b1 being Nat st S2[b1] holds
S2[b1 + 1]
proof end;

theorem Th35: :: RFINSEQ:35
for b1 being FinSequence of REAL ex b2 being non-increasing FinSequence of REAL st b1,b2 are_fiberwise_equipotent
proof end;

Lemma30: for b1 being Nat
for b2, b3 being non-increasing FinSequence of REAL st b1 = len b2 & b2,b3 are_fiberwise_equipotent holds
b2 = b3
proof end;

theorem Th36: :: RFINSEQ:36
for b1, b2 being non-increasing FinSequence of REAL st b1,b2 are_fiberwise_equipotent holds
b1 = b2
proof end;

theorem Th37: :: RFINSEQ:37
for b1 being FinSequence of REAL
for b2, b3 being Real st b2 <> 0 holds
b1 " {(b3 / b2)} = (b2 * b1) " {b3}
proof end;

theorem Th38: :: RFINSEQ:38
for b1 being FinSequence of REAL holds (0 * b1) " {0} = dom b1
proof end;