:: REARRAN1 semantic presentation

definition
let c1 be non empty set ;
let c2 be real-membered set ;
let c3 be PartFunc of c1,c2;
let c4 be Real;
redefine func (#) as c4 (#) c3 -> Element of PFuncs a1,REAL ;
coherence
c4 (#) c3 is Element of PFuncs c1,REAL
proof end;
end;

Lemma1: for b1 being Function
for b2 being set holds
( not b2 in rng b1 implies b1 " {b2} = {} )
proof end;

definition
let c1 be FinSequence;
attr a1 is terms've_same_card_as_number means :Def1: :: REARRAN1:def 1
for b1 being Nat holds
( 1 <= b1 & b1 <= len a1 implies for b2 being finite set holds
( b2 = a1 . b1 implies card b2 = b1 ) );
attr a1 is ascending means :Def2: :: REARRAN1:def 2
for b1 being Nat holds
( 1 <= b1 & b1 <= (len a1) - 1 implies a1 . b1 c= a1 . (b1 + 1) );
end;

:: deftheorem Def1 defines terms've_same_card_as_number REARRAN1:def 1 :
for b1 being FinSequence holds
( b1 is terms've_same_card_as_number iff for b2 being Nat holds
( 1 <= b2 & b2 <= len b1 implies for b3 being finite set holds
( b3 = b1 . b2 implies card b3 = b2 ) ) );

:: deftheorem Def2 defines ascending REARRAN1:def 2 :
for b1 being FinSequence holds
( b1 is ascending iff for b2 being Nat holds
( 1 <= b2 & b2 <= (len b1) - 1 implies b1 . b2 c= b1 . (b2 + 1) ) );

Lemma4: for b1 being non empty finite set
for b2 being FinSequence of bool b1
for b3 being Nat holds
( 1 <= b3 & b3 <= len b2 implies b2 . b3 is finite )
proof end;

Lemma5: for b1 being non empty finite set
for b2 being FinSequence of bool b1 holds
( len b2 = card b1 & b2 is terms've_same_card_as_number implies for b3 being finite set holds
( b3 = b2 . (len b2) implies b3 = b1 ) )
proof end;

Lemma6: for b1 being non empty finite set holds
ex b2 being FinSequence of bool b1 st
( len b2 = card b1 & b2 is ascending & b2 is terms've_same_card_as_number )
proof end;

definition
let c1 be set ;
let c2 be FinSequence of c1;
attr a2 is lenght_equal_card_of_set means :Def3: :: REARRAN1:def 3
ex b1 being finite set st
( b1 = union a1 & len a2 = card b1 );
end;

:: deftheorem Def3 defines lenght_equal_card_of_set REARRAN1:def 3 :
for b1 being set
for b2 being FinSequence of b1 holds
( b2 is lenght_equal_card_of_set iff ex b3 being finite set st
( b3 = union b1 & len b2 = card b3 ) );

registration
let c1 be non empty finite set ;
cluster terms've_same_card_as_number ascending lenght_equal_card_of_set FinSequence of bool a1;
existence
ex b1 being FinSequence of bool c1 st
( b1 is terms've_same_card_as_number & b1 is ascending & b1 is lenght_equal_card_of_set )
proof end;
end;

definition
let c1 be non empty finite set ;
mode RearrangmentGen is terms've_same_card_as_number ascending lenght_equal_card_of_set FinSequence of bool a1;
end;

theorem Th1: :: REARRAN1:1
for b1 being non empty finite set
for b2 being FinSequence of bool b1 holds
( b2 is lenght_equal_card_of_set iff len b2 = card b1 )
proof end;

theorem Th2: :: REARRAN1:2
for b1 being FinSequence holds
( b1 is ascending iff for b2, b3 being Nat holds
( b2 <= b3 & b2 in dom b1 & b3 in dom b1 implies b1 . b2 c= b1 . b3 ) )
proof end;

theorem Th3: :: REARRAN1:3
for b1 being non empty finite set
for b2 being terms've_same_card_as_number lenght_equal_card_of_set FinSequence of bool b1 holds b2 . (len b2) = b1
proof end;

theorem Th4: :: REARRAN1:4
for b1 being non empty finite set
for b2 being lenght_equal_card_of_set FinSequence of bool b1 holds
len b2 <> 0
proof end;

theorem Th5: :: REARRAN1:5
for b1 being non empty finite set
for b2 being terms've_same_card_as_number ascending FinSequence of bool b1
for b3, b4 being Nat holds
not ( b3 in dom b2 & b4 in dom b2 & b3 <> b4 & not b2 . b3 <> b2 . b4 )
proof end;

theorem Th6: :: REARRAN1:6
for b1 being non empty finite set
for b2 being terms've_same_card_as_number ascending FinSequence of bool b1
for b3 being Nat holds
not ( 1 <= b3 & b3 <= (len b2) - 1 & not b2 . b3 <> b2 . (b3 + 1) )
proof end;

Lemma14: for b1 being Nat
for b2 being non empty finite set
for b3 being FinSequence of bool b2 holds
( b1 in dom b3 implies b3 . b1 c= b2 )
proof end;

theorem Th7: :: REARRAN1:7
for b1 being Nat
for b2 being non empty finite set
for b3 being terms've_same_card_as_number FinSequence of bool b2 holds
not ( b1 in dom b3 & not b3 . b1 <> {} )
proof end;

theorem Th8: :: REARRAN1:8
for b1 being Nat
for b2 being non empty finite set
for b3 being terms've_same_card_as_number FinSequence of bool b2 holds
not ( 1 <= b1 & b1 <= (len b3) - 1 & not (b3 . (b1 + 1)) \ (b3 . b1) <> {} )
proof end;

theorem Th9: :: REARRAN1:9
for b1 being non empty finite set
for b2 being terms've_same_card_as_number lenght_equal_card_of_set FinSequence of bool b1 holds
ex b3 being Element of b1 st b2 . 1 = {b3}
proof end;

theorem Th10: :: REARRAN1:10
for b1 being Nat
for b2 being non empty finite set
for b3 being terms've_same_card_as_number ascending FinSequence of bool b2 holds
not ( 1 <= b1 & b1 <= (len b3) - 1 & ( for b4 being Element of b2 holds
not ( (b3 . (b1 + 1)) \ (b3 . b1) = {b4} & b3 . (b1 + 1) = (b3 . b1) \/ {b4} & (b3 . (b1 + 1)) \ {b4} = b3 . b1 ) ) )
proof end;

definition
let c1 be non empty finite set ;
let c2 be RearrangmentGen of c1;
func Co_Gen c2 -> RearrangmentGen of a1 means :Def4: :: REARRAN1:def 4
for b1 being Nat holds
( 1 <= b1 & b1 <= (len a3) - 1 implies a3 . b1 = a1 \ (a2 . ((len a2) - b1)) );
existence
ex b1 being RearrangmentGen of c1 st
for b2 being Nat holds
( 1 <= b2 & b2 <= (len b1) - 1 implies b1 . b2 = c1 \ (c2 . ((len c2) - b2)) )
proof end;
uniqueness
for b1, b2 being RearrangmentGen of c1 holds
( ( for b3 being Nat holds
( 1 <= b3 & b3 <= (len b1) - 1 implies b1 . b3 = c1 \ (c2 . ((len c2) - b3)) ) ) & ( for b3 being Nat holds
( 1 <= b3 & b3 <= (len b2) - 1 implies b2 . b3 = c1 \ (c2 . ((len c2) - b3)) ) ) implies b1 = b2 )
proof end;
end;

:: deftheorem Def4 defines Co_Gen REARRAN1:def 4 :
for b1 being non empty finite set
for b2, b3 being RearrangmentGen of b1 holds
( b3 = Co_Gen b2 iff for b4 being Nat holds
( 1 <= b4 & b4 <= (len b3) - 1 implies b3 . b4 = b1 \ (b2 . ((len b2) - b4)) ) );

theorem Th11: :: REARRAN1:11
for b1 being non empty finite set
for b2 being RearrangmentGen of b1 holds Co_Gen (Co_Gen b2) = b2
proof end;

theorem Th12: :: REARRAN1:12
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies len (MIM (FinS b3,b1)) = len (CHI b4,b2) )
proof end;

definition
let c1, c2 be non empty finite set ;
let c3 be RearrangmentGen of c2;
let c4 be PartFunc of c1, REAL ;
func Rland c4,c3 -> PartFunc of a2, REAL equals :: REARRAN1:def 5
Sum ((MIM (FinS a4,a1)) (#) (CHI a3,a2));
correctness
coherence
Sum ((MIM (FinS c4,c1)) (#) (CHI c3,c2)) is PartFunc of c2, REAL
;
;
func Rlor c4,c3 -> PartFunc of a2, REAL equals :: REARRAN1:def 6
Sum ((MIM (FinS a4,a1)) (#) (CHI (Co_Gen a3),a2));
correctness
coherence
Sum ((MIM (FinS c4,c1)) (#) (CHI (Co_Gen c3),c2)) is PartFunc of c2, REAL
;
;
end;

:: deftheorem Def5 defines Rland REARRAN1:def 5 :
for b1, b2 being non empty finite set
for b3 being RearrangmentGen of b2
for b4 being PartFunc of b1, REAL holds Rland b4,b3 = Sum ((MIM (FinS b4,b1)) (#) (CHI b3,b2));

:: deftheorem Def6 defines Rlor REARRAN1:def 6 :
for b1, b2 being non empty finite set
for b3 being RearrangmentGen of b2
for b4 being PartFunc of b1, REAL holds Rlor b4,b3 = Sum ((MIM (FinS b4,b1)) (#) (CHI (Co_Gen b3),b2));

theorem Th13: :: REARRAN1:13
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies dom (Rland b3,b4) = b2 )
proof end;

theorem Th14: :: REARRAN1:14
for b1, b2 being non empty finite set
for b3 being Element of b1
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b1 holds
( b4 is total & card b1 = card b2 implies ( ( b3 in b5 . 1 implies ((MIM (FinS b4,b2)) (#) (CHI b5,b1)) # b3 = MIM (FinS b4,b2) ) & ( for b6 being Nat holds
( 1 <= b6 & b6 < len b5 & b3 in (b5 . (b6 + 1)) \ (b5 . b6) implies ((MIM (FinS b4,b2)) (#) (CHI b5,b1)) # b3 = (b6 |-> 0) ^ (MIM ((FinS b4,b2) /^ b6)) ) ) ) )
proof end;

theorem Th15: :: REARRAN1:15
for b1, b2 being non empty finite set
for b3 being Element of b1
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b1 holds
( b4 is total & card b1 = card b2 implies ( ( b3 in b5 . 1 implies (Rland b4,b5) . b3 = (FinS b4,b2) . 1 ) & ( for b6 being Nat holds
( 1 <= b6 & b6 < len b5 & b3 in (b5 . (b6 + 1)) \ (b5 . b6) implies (Rland b4,b5) . b3 = (FinS b4,b2) . (b6 + 1) ) ) ) )
proof end;

theorem Th16: :: REARRAN1:16
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies rng (Rland b3,b4) = rng (FinS b3,b1) )
proof end;

theorem Th17: :: REARRAN1:17
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies Rland b3,b4, FinS b3,b1 are_fiberwise_equipotent )
proof end;

theorem Th18: :: REARRAN1:18
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies FinS (Rland b3,b4),b2 = FinS b3,b1 )
proof end;

theorem Th19: :: REARRAN1:19
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies Sum (Rland b3,b4),b2 = Sum b3,b1 )
proof end;

theorem Th20: :: REARRAN1:20
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( FinS ((Rland b4,b5) - b1),b3 = FinS (b4 - b1),b2 & Sum ((Rland b4,b5) - b1),b3 = Sum (b4 - b1),b2 ) )
proof end;

theorem Th21: :: REARRAN1:21
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies dom (Rlor b3,b4) = b2 )
proof end;

theorem Th22: :: REARRAN1:22
for b1, b2 being non empty finite set
for b3 being Element of b1
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b1 holds
( b4 is total & card b1 = card b2 implies ( ( b3 in (Co_Gen b5) . 1 implies (Rlor b4,b5) . b3 = (FinS b4,b2) . 1 ) & ( for b6 being Nat holds
( 1 <= b6 & b6 < len (Co_Gen b5) & b3 in ((Co_Gen b5) . (b6 + 1)) \ ((Co_Gen b5) . b6) implies (Rlor b4,b5) . b3 = (FinS b4,b2) . (b6 + 1) ) ) ) )
proof end;

theorem Th23: :: REARRAN1:23
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies rng (Rlor b3,b4) = rng (FinS b3,b1) )
proof end;

theorem Th24: :: REARRAN1:24
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies Rlor b3,b4, FinS b3,b1 are_fiberwise_equipotent )
proof end;

theorem Th25: :: REARRAN1:25
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies FinS (Rlor b3,b4),b2 = FinS b3,b1 )
proof end;

theorem Th26: :: REARRAN1:26
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies Sum (Rlor b3,b4),b2 = Sum b3,b1 )
proof end;

theorem Th27: :: REARRAN1:27
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( FinS ((Rlor b4,b5) - b1),b3 = FinS (b4 - b1),b2 & Sum ((Rlor b4,b5) - b1),b3 = Sum (b4 - b1),b2 ) )
proof end;

theorem Th28: :: REARRAN1:28
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b2 = card b1 implies ( Rlor b3,b4, Rland b3,b4 are_fiberwise_equipotent & FinS (Rlor b3,b4),b2 = FinS (Rland b3,b4),b2 & Sum (Rlor b3,b4),b2 = Sum (Rland b3,b4),b2 ) )
proof end;

theorem Th29: :: REARRAN1:29
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( max+ ((Rland b4,b5) - b1), max+ (b4 - b1) are_fiberwise_equipotent & FinS (max+ ((Rland b4,b5) - b1)),b3 = FinS (max+ (b4 - b1)),b2 & Sum (max+ ((Rland b4,b5) - b1)),b3 = Sum (max+ (b4 - b1)),b2 ) )
proof end;

theorem Th30: :: REARRAN1:30
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( max- ((Rland b4,b5) - b1), max- (b4 - b1) are_fiberwise_equipotent & FinS (max- ((Rland b4,b5) - b1)),b3 = FinS (max- (b4 - b1)),b2 & Sum (max- ((Rland b4,b5) - b1)),b3 = Sum (max- (b4 - b1)),b2 ) )
proof end;

theorem Th31: :: REARRAN1:31
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b1 = card b2 implies ( len (FinS (Rland b3,b4),b2) = card b2 & 1 <= len (FinS (Rland b3,b4),b2) ) )
proof end;

theorem Th32: :: REARRAN1:32
for b1 being Nat
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b2 = card b3 & b1 in dom b5 implies (FinS (Rland b4,b5),b3) | b1 = FinS (Rland b4,b5),(b5 . b1) )
proof end;

theorem Th33: :: REARRAN1:33
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b2 = card b3 implies Rland (b4 - b1),b5 = (Rland b4,b5) - b1 )
proof end;

theorem Th34: :: REARRAN1:34
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( max+ ((Rlor b4,b5) - b1), max+ (b4 - b1) are_fiberwise_equipotent & FinS (max+ ((Rlor b4,b5) - b1)),b3 = FinS (max+ (b4 - b1)),b2 & Sum (max+ ((Rlor b4,b5) - b1)),b3 = Sum (max+ (b4 - b1)),b2 ) )
proof end;

theorem Th35: :: REARRAN1:35
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b3 = card b2 implies ( max- ((Rlor b4,b5) - b1), max- (b4 - b1) are_fiberwise_equipotent & FinS (max- ((Rlor b4,b5) - b1)),b3 = FinS (max- (b4 - b1)),b2 & Sum (max- ((Rlor b4,b5) - b1)),b3 = Sum (max- (b4 - b1)),b2 ) )
proof end;

theorem Th36: :: REARRAN1:36
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b1 = card b2 implies ( len (FinS (Rlor b3,b4),b2) = card b2 & 1 <= len (FinS (Rlor b3,b4),b2) ) )
proof end;

theorem Th37: :: REARRAN1:37
for b1 being Nat
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b2 = card b3 & b1 in dom b5 implies (FinS (Rlor b4,b5),b3) | b1 = FinS (Rlor b4,b5),((Co_Gen b5) . b1) )
proof end;

theorem Th38: :: REARRAN1:38
for b1 being Real
for b2, b3 being non empty finite set
for b4 being PartFunc of b2, REAL
for b5 being RearrangmentGen of b3 holds
( b4 is total & card b2 = card b3 implies Rlor (b4 - b1),b5 = (Rlor b4,b5) - b1 )
proof end;

theorem Th39: :: REARRAN1:39
for b1, b2 being non empty finite set
for b3 being PartFunc of b1, REAL
for b4 being RearrangmentGen of b2 holds
( b3 is total & card b1 = card b2 implies ( Rland b3,b4,b3 are_fiberwise_equipotent & Rlor b3,b4,b3 are_fiberwise_equipotent & rng (Rland b3,b4) = rng b3 & rng (Rlor b3,b4) = rng b3 ) )
proof end;