:: FUNCT_5 semantic presentation

scheme :: FUNCT_5:sch 1
s1{ F1() -> set , F2( set ) -> set } :
ex b1 being Function st
( dom b1 = F1() & ( for b2 being Function st b2 in F1() holds
b1 . b2 = F2(b2) ) )
proof end;

theorem Th1: :: FUNCT_5:1
~ {} = {}
proof end;

definition
let c1 be set ;
func proj1 c1 -> set means :Def1: :: FUNCT_5:def 1
for b1 being set holds
( b1 in a2 iff ex b2 being set st [b1,b2] in a1 );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ex b3 being set st [b2,b3] in c1 )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ex b4 being set st [b3,b4] in c1 ) ) & ( for b3 being set holds
( b3 in b2 iff ex b4 being set st [b3,b4] in c1 ) ) holds
b1 = b2
proof end;
func proj2 c1 -> set means :Def2: :: FUNCT_5:def 2
for b1 being set holds
( b1 in a2 iff ex b2 being set st [b2,b1] in a1 );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff ex b3 being set st [b3,b2] in c1 )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff ex b4 being set st [b4,b3] in c1 ) ) & ( for b3 being set holds
( b3 in b2 iff ex b4 being set st [b4,b3] in c1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines proj1 FUNCT_5:def 1 :
for b1, b2 being set holds
( b2 = proj1 b1 iff for b3 being set holds
( b3 in b2 iff ex b4 being set st [b3,b4] in b1 ) );

:: deftheorem Def2 defines proj2 FUNCT_5:def 2 :
for b1, b2 being set holds
( b2 = proj2 b1 iff for b3 being set holds
( b3 in b2 iff ex b4 being set st [b4,b3] in b1 ) );

theorem Th2: :: FUNCT_5:2
canceled;

theorem Th3: :: FUNCT_5:3
canceled;

theorem Th4: :: FUNCT_5:4
for b1, b2, b3 being set st [b1,b2] in b3 holds
( b1 in proj1 b3 & b2 in proj2 b3 ) by Def1, Def2;

theorem Th5: :: FUNCT_5:5
for b1, b2 being set st b1 c= b2 holds
( proj1 b1 c= proj1 b2 & proj2 b1 c= proj2 b2 )
proof end;

theorem Th6: :: FUNCT_5:6
for b1, b2 being set holds
( proj1 (b1 \/ b2) = (proj1 b1) \/ (proj1 b2) & proj2 (b1 \/ b2) = (proj2 b1) \/ (proj2 b2) )
proof end;

theorem Th7: :: FUNCT_5:7
for b1, b2 being set holds
( proj1 (b1 /\ b2) c= (proj1 b1) /\ (proj1 b2) & proj2 (b1 /\ b2) c= (proj2 b1) /\ (proj2 b2) )
proof end;

theorem Th8: :: FUNCT_5:8
for b1, b2 being set holds
( (proj1 b1) \ (proj1 b2) c= proj1 (b1 \ b2) & (proj2 b1) \ (proj2 b2) c= proj2 (b1 \ b2) )
proof end;

theorem Th9: :: FUNCT_5:9
for b1, b2 being set holds
( (proj1 b1) \+\ (proj1 b2) c= proj1 (b1 \+\ b2) & (proj2 b1) \+\ (proj2 b2) c= proj2 (b1 \+\ b2) )
proof end;

theorem Th10: :: FUNCT_5:10
( proj1 {} = {} & proj2 {} = {} )
proof end;

theorem Th11: :: FUNCT_5:11
for b1, b2 being set st ( b1 <> {} or [:b2,b1:] <> {} or [:b1,b2:] <> {} ) holds
( proj1 [:b2,b1:] = b2 & proj2 [:b1,b2:] = b2 )
proof end;

theorem Th12: :: FUNCT_5:12
for b1, b2 being set holds
( proj1 [:b1,b2:] c= b1 & proj2 [:b1,b2:] c= b2 )
proof end;

theorem Th13: :: FUNCT_5:13
for b1, b2, b3 being set st b1 c= [:b2,b3:] holds
( proj1 b1 c= b2 & proj2 b1 c= b3 )
proof end;

theorem Th14: :: FUNCT_5:14
canceled;

theorem Th15: :: FUNCT_5:15
for b1, b2 being set holds
( proj1 {[b1,b2]} = {b1} & proj2 {[b1,b2]} = {b2} )
proof end;

theorem Th16: :: FUNCT_5:16
for b1, b2, b3, b4 being set holds
( proj1 {[b1,b2],[b3,b4]} = {b1,b3} & proj2 {[b1,b2],[b3,b4]} = {b2,b4} )
proof end;

theorem Th17: :: FUNCT_5:17
for b1 being set st ( for b2, b3 being set holds not [b2,b3] in b1 ) holds
( proj1 b1 = {} & proj2 b1 = {} )
proof end;

theorem Th18: :: FUNCT_5:18
for b1 being set st ( proj1 b1 = {} or proj2 b1 = {} ) holds
for b2, b3 being set holds not [b2,b3] in b1 by Def1, Def2;

theorem Th19: :: FUNCT_5:19
for b1 being set holds
( proj1 b1 = {} iff proj2 b1 = {} )
proof end;

theorem Th20: :: FUNCT_5:20
for b1 being Function holds
( proj1 (dom b1) = proj2 (dom (~ b1)) & proj2 (dom b1) = proj1 (dom (~ b1)) )
proof end;

theorem Th21: :: FUNCT_5:21
for b1 being Relation holds
( proj1 b1 = dom b1 & proj2 b1 = rng b1 )
proof end;

definition
let c1 be Function;
func curry c1 -> Function means :Def3: :: FUNCT_5:def 3
( dom a2 = proj1 (dom a1) & ( for b1 being set st b1 in proj1 (dom a1) holds
ex b2 being Function st
( a2 . b1 = b2 & dom b2 = proj2 ((dom a1) /\ [:{b1},(proj2 (dom a1)):]) & ( for b3 being set st b3 in dom b2 holds
b2 . b3 = a1 . [b1,b3] ) ) ) );
existence
ex b1 being Function st
( dom b1 = proj1 (dom c1) & ( for b2 being set st b2 in proj1 (dom c1) holds
ex b3 being Function st
( b1 . b2 = b3 & dom b3 = proj2 ((dom c1) /\ [:{b2},(proj2 (dom c1)):]) & ( for b4 being set st b4 in dom b3 holds
b3 . b4 = c1 . [b2,b4] ) ) ) )
proof end;
uniqueness
for b1, b2 being Function st dom b1 = proj1 (dom c1) & ( for b3 being set st b3 in proj1 (dom c1) holds
ex b4 being Function st
( b1 . b3 = b4 & dom b4 = proj2 ((dom c1) /\ [:{b3},(proj2 (dom c1)):]) & ( for b5 being set st b5 in dom b4 holds
b4 . b5 = c1 . [b3,b5] ) ) ) & dom b2 = proj1 (dom c1) & ( for b3 being set st b3 in proj1 (dom c1) holds
ex b4 being Function st
( b2 . b3 = b4 & dom b4 = proj2 ((dom c1) /\ [:{b3},(proj2 (dom c1)):]) & ( for b5 being set st b5 in dom b4 holds
b4 . b5 = c1 . [b3,b5] ) ) ) holds
b1 = b2
proof end;
func uncurry c1 -> Function means :Def4: :: FUNCT_5:def 4
( ( for b1 being set holds
( b1 in dom a2 iff ex b2 being set ex b3 being Functionex b4 being set st
( b1 = [b2,b4] & b2 in dom a1 & b3 = a1 . b2 & b4 in dom b3 ) ) ) & ( for b1 being set
for b2 being Function st b1 in dom a2 & b2 = a1 . (b1 `1 ) holds
a2 . b1 = b2 . (b1 `2 ) ) );
existence
ex b1 being Function st
( ( for b2 being set holds
( b2 in dom b1 iff ex b3 being set ex b4 being Functionex b5 being set st
( b2 = [b3,b5] & b3 in dom c1 & b4 = c1 . b3 & b5 in dom b4 ) ) ) & ( for b2 being set
for b3 being Function st b2 in dom b1 & b3 = c1 . (b2 `1 ) holds
b1 . b2 = b3 . (b2 `2 ) ) )
proof end;
uniqueness
for b1, b2 being Function st ( for b3 being set holds
( b3 in dom b1 iff ex b4 being set ex b5 being Functionex b6 being set st
( b3 = [b4,b6] & b4 in dom c1 & b5 = c1 . b4 & b6 in dom b5 ) ) ) & ( for b3 being set
for b4 being Function st b3 in dom b1 & b4 = c1 . (b3 `1 ) holds
b1 . b3 = b4 . (b3 `2 ) ) & ( for b3 being set holds
( b3 in dom b2 iff ex b4 being set ex b5 being Functionex b6 being set st
( b3 = [b4,b6] & b4 in dom c1 & b5 = c1 . b4 & b6 in dom b5 ) ) ) & ( for b3 being set
for b4 being Function st b3 in dom b2 & b4 = c1 . (b3 `1 ) holds
b2 . b3 = b4 . (b3 `2 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines curry FUNCT_5:def 3 :
for b1, b2 being Function holds
( b2 = curry b1 iff ( dom b2 = proj1 (dom b1) & ( for b3 being set st b3 in proj1 (dom b1) holds
ex b4 being Function st
( b2 . b3 = b4 & dom b4 = proj2 ((dom b1) /\ [:{b3},(proj2 (dom b1)):]) & ( for b5 being set st b5 in dom b4 holds
b4 . b5 = b1 . [b3,b5] ) ) ) ) );

:: deftheorem Def4 defines uncurry FUNCT_5:def 4 :
for b1, b2 being Function holds
( b2 = uncurry b1 iff ( ( for b3 being set holds
( b3 in dom b2 iff ex b4 being set ex b5 being Functionex b6 being set st
( b3 = [b4,b6] & b4 in dom b1 & b5 = b1 . b4 & b6 in dom b5 ) ) ) & ( for b3 being set
for b4 being Function st b3 in dom b2 & b4 = b1 . (b3 `1 ) holds
b2 . b3 = b4 . (b3 `2 ) ) ) );

definition
let c1 be Function;
func curry' c1 -> Function equals :: FUNCT_5:def 5
curry (~ a1);
correctness
coherence
curry (~ c1) is Function
;
;
func uncurry' c1 -> Function equals :: FUNCT_5:def 6
~ (uncurry a1);
correctness
coherence
~ (uncurry c1) is Function
;
;
end;

:: deftheorem Def5 defines curry' FUNCT_5:def 5 :
for b1 being Function holds curry' b1 = curry (~ b1);

:: deftheorem Def6 defines uncurry' FUNCT_5:def 6 :
for b1 being Function holds uncurry' b1 = ~ (uncurry b1);

theorem Th22: :: FUNCT_5:22
canceled;

theorem Th23: :: FUNCT_5:23
canceled;

theorem Th24: :: FUNCT_5:24
canceled;

theorem Th25: :: FUNCT_5:25
canceled;

theorem Th26: :: FUNCT_5:26
for b1, b2 being set
for b3 being Function st [b1,b2] in dom b3 holds
( b1 in dom (curry b3) & (curry b3) . b1 is Function )
proof end;

theorem Th27: :: FUNCT_5:27
for b1, b2 being set
for b3, b4 being Function st [b1,b2] in dom b3 & b4 = (curry b3) . b1 holds
( b2 in dom b4 & b4 . b2 = b3 . [b1,b2] )
proof end;

theorem Th28: :: FUNCT_5:28
for b1, b2 being set
for b3 being Function st [b1,b2] in dom b3 holds
( b2 in dom (curry' b3) & (curry' b3) . b2 is Function )
proof end;

theorem Th29: :: FUNCT_5:29
for b1, b2 being set
for b3, b4 being Function st [b1,b2] in dom b3 & b4 = (curry' b3) . b2 holds
( b1 in dom b4 & b4 . b1 = b3 . [b1,b2] )
proof end;

theorem Th30: :: FUNCT_5:30
for b1 being Function holds dom (curry' b1) = proj2 (dom b1)
proof end;

theorem Th31: :: FUNCT_5:31
for b1, b2 being set
for b3 being Function st [:b1,b2:] <> {} & dom b3 = [:b1,b2:] holds
( dom (curry b3) = b1 & dom (curry' b3) = b2 )
proof end;

theorem Th32: :: FUNCT_5:32
for b1, b2 being set
for b3 being Function st dom b3 c= [:b1,b2:] holds
( dom (curry b3) c= b1 & dom (curry' b3) c= b2 )
proof end;

theorem Th33: :: FUNCT_5:33
for b1, b2 being set
for b3 being Function st rng b3 c= Funcs b1,b2 holds
( dom (uncurry b3) = [:(dom b3),b1:] & dom (uncurry' b3) = [:b1,(dom b3):] )
proof end;

theorem Th34: :: FUNCT_5:34
for b1 being Function st ( for b2, b3 being set holds not [b2,b3] in dom b1 ) holds
( curry b1 = {} & curry' b1 = {} )
proof end;

theorem Th35: :: FUNCT_5:35
for b1 being Function st ( for b2 being set holds
( not b2 in dom b1 or not b1 . b2 is Function ) ) holds
( uncurry b1 = {} & uncurry' b1 = {} )
proof end;

theorem Th36: :: FUNCT_5:36
for b1, b2, b3 being set
for b4 being Function st [:b1,b2:] <> {} & dom b4 = [:b1,b2:] & b3 in b1 holds
ex b5 being Function st
( (curry b4) . b3 = b5 & dom b5 = b2 & rng b5 c= rng b4 & ( for b6 being set st b6 in b2 holds
b5 . b6 = b4 . [b3,b6] ) )
proof end;

theorem Th37: :: FUNCT_5:37
for b1 being set
for b2 being Function st b1 in dom (curry b2) holds
(curry b2) . b1 is Function
proof end;

theorem Th38: :: FUNCT_5:38
for b1 being set
for b2, b3 being Function st b1 in dom (curry b2) & b3 = (curry b2) . b1 holds
( dom b3 = proj2 ((dom b2) /\ [:{b1},(proj2 (dom b2)):]) & dom b3 c= proj2 (dom b2) & rng b3 c= rng b2 & ( for b4 being set st b4 in dom b3 holds
( b3 . b4 = b2 . [b1,b4] & [b1,b4] in dom b2 ) ) )
proof end;

theorem Th39: :: FUNCT_5:39
for b1, b2, b3 being set
for b4 being Function st [:b1,b2:] <> {} & dom b4 = [:b1,b2:] & b3 in b2 holds
ex b5 being Function st
( (curry' b4) . b3 = b5 & dom b5 = b1 & rng b5 c= rng b4 & ( for b6 being set st b6 in b1 holds
b5 . b6 = b4 . [b6,b3] ) )
proof end;

theorem Th40: :: FUNCT_5:40
for b1 being set
for b2 being Function st b1 in dom (curry' b2) holds
(curry' b2) . b1 is Function by Th37;

theorem Th41: :: FUNCT_5:41
for b1 being set
for b2, b3 being Function st b1 in dom (curry' b2) & b3 = (curry' b2) . b1 holds
( dom b3 = proj1 ((dom b2) /\ [:(proj1 (dom b2)),{b1}:]) & dom b3 c= proj1 (dom b2) & rng b3 c= rng b2 & ( for b4 being set st b4 in dom b3 holds
( b3 . b4 = b2 . [b4,b1] & [b4,b1] in dom b2 ) ) )
proof end;

theorem Th42: :: FUNCT_5:42
for b1, b2 being set
for b3 being Function st dom b3 = [:b1,b2:] holds
( rng (curry b3) c= Funcs b2,(rng b3) & rng (curry' b3) c= Funcs b1,(rng b3) )
proof end;

theorem Th43: :: FUNCT_5:43
for b1 being Function holds
( rng (curry b1) c= PFuncs (proj2 (dom b1)),(rng b1) & rng (curry' b1) c= PFuncs (proj1 (dom b1)),(rng b1) )
proof end;

theorem Th44: :: FUNCT_5:44
for b1, b2 being set
for b3 being Function st rng b3 c= PFuncs b1,b2 holds
( dom (uncurry b3) c= [:(dom b3),b1:] & dom (uncurry' b3) c= [:b1,(dom b3):] )
proof end;

theorem Th45: :: FUNCT_5:45
for b1, b2 being set
for b3, b4 being Function st b1 in dom b3 & b4 = b3 . b1 & b2 in dom b4 holds
( [b1,b2] in dom (uncurry b3) & (uncurry b3) . [b1,b2] = b4 . b2 & b4 . b2 in rng (uncurry b3) )
proof end;

theorem Th46: :: FUNCT_5:46
for b1, b2 being set
for b3, b4 being Function st b1 in dom b3 & b4 = b3 . b1 & b2 in dom b4 holds
( [b2,b1] in dom (uncurry' b3) & (uncurry' b3) . [b2,b1] = b4 . b2 & b4 . b2 in rng (uncurry' b3) )
proof end;

theorem Th47: :: FUNCT_5:47
for b1, b2 being set
for b3 being Function st rng b3 c= PFuncs b1,b2 holds
( rng (uncurry b3) c= b2 & rng (uncurry' b3) c= b2 )
proof end;

theorem Th48: :: FUNCT_5:48
for b1, b2 being set
for b3 being Function st rng b3 c= Funcs b1,b2 holds
( rng (uncurry b3) c= b2 & rng (uncurry' b3) c= b2 )
proof end;

theorem Th49: :: FUNCT_5:49
( curry {} = {} & curry' {} = {} )
proof end;

theorem Th50: :: FUNCT_5:50
( uncurry {} = {} & uncurry' {} = {} )
proof end;

theorem Th51: :: FUNCT_5:51
for b1, b2 being set
for b3, b4 being Function st dom b3 = [:b1,b2:] & dom b4 = [:b1,b2:] & curry b3 = curry b4 holds
b3 = b4
proof end;

theorem Th52: :: FUNCT_5:52
for b1, b2 being set
for b3, b4 being Function st dom b3 = [:b1,b2:] & dom b4 = [:b1,b2:] & curry' b3 = curry' b4 holds
b3 = b4
proof end;

theorem Th53: :: FUNCT_5:53
for b1, b2 being set
for b3, b4 being Function st rng b3 c= Funcs b1,b2 & rng b4 c= Funcs b1,b2 & b1 <> {} & uncurry b3 = uncurry b4 holds
b3 = b4
proof end;

theorem Th54: :: FUNCT_5:54
for b1, b2 being set
for b3, b4 being Function st rng b3 c= Funcs b1,b2 & rng b4 c= Funcs b1,b2 & b1 <> {} & uncurry' b3 = uncurry' b4 holds
b3 = b4
proof end;

theorem Th55: :: FUNCT_5:55
for b1, b2 being set
for b3 being Function st rng b3 c= Funcs b1,b2 & b1 <> {} holds
( curry (uncurry b3) = b3 & curry' (uncurry' b3) = b3 )
proof end;

theorem Th56: :: FUNCT_5:56
for b1, b2 being set
for b3 being Function st dom b3 = [:b1,b2:] holds
( uncurry (curry b3) = b3 & uncurry' (curry' b3) = b3 )
proof end;

theorem Th57: :: FUNCT_5:57
for b1, b2 being set
for b3 being Function st dom b3 c= [:b1,b2:] holds
( uncurry (curry b3) = b3 & uncurry' (curry' b3) = b3 )
proof end;

theorem Th58: :: FUNCT_5:58
for b1, b2 being set
for b3 being Function st rng b3 c= PFuncs b1,b2 & not {} in rng b3 holds
( curry (uncurry b3) = b3 & curry' (uncurry' b3) = b3 )
proof end;

theorem Th59: :: FUNCT_5:59
for b1, b2 being set
for b3, b4 being Function st dom b3 c= [:b1,b2:] & dom b4 c= [:b1,b2:] & curry b3 = curry b4 holds
b3 = b4
proof end;

theorem Th60: :: FUNCT_5:60
for b1, b2 being set
for b3, b4 being Function st dom b3 c= [:b1,b2:] & dom b4 c= [:b1,b2:] & curry' b3 = curry' b4 holds
b3 = b4
proof end;

theorem Th61: :: FUNCT_5:61
for b1, b2 being set
for b3, b4 being Function st rng b3 c= PFuncs b1,b2 & rng b4 c= PFuncs b1,b2 & not {} in rng b3 & not {} in rng b4 & uncurry b3 = uncurry b4 holds
b3 = b4
proof end;

theorem Th62: :: FUNCT_5:62
for b1, b2 being set
for b3, b4 being Function st rng b3 c= PFuncs b1,b2 & rng b4 c= PFuncs b1,b2 & not {} in rng b3 & not {} in rng b4 & uncurry' b3 = uncurry' b4 holds
b3 = b4
proof end;

theorem Th63: :: FUNCT_5:63
for b1, b2, b3 being set st b1 c= b2 holds
Funcs b3,b1 c= Funcs b3,b2
proof end;

theorem Th64: :: FUNCT_5:64
for b1 being set holds Funcs {} ,b1 = {{} }
proof end;

theorem Th65: :: FUNCT_5:65
for b1, b2 being set holds
( b1, Funcs {b2},b1 are_equipotent & Card b1 = Card (Funcs {b2},b1) )
proof end;

theorem Th66: :: FUNCT_5:66
for b1, b2 being set holds Funcs b1,{b2} = {(b1 --> b2)}
proof end;

theorem Th67: :: FUNCT_5:67
for b1, b2, b3, b4 being set st b1,b2 are_equipotent & b3,b4 are_equipotent holds
( Funcs b1,b3, Funcs b2,b4 are_equipotent & Card (Funcs b1,b3) = Card (Funcs b2,b4) )
proof end;

theorem Th68: :: FUNCT_5:68
for b1, b2, b3, b4 being set st Card b1 = Card b2 & Card b3 = Card b4 holds
Card (Funcs b1,b3) = Card (Funcs b2,b4)
proof end;

theorem Th69: :: FUNCT_5:69
for b1, b2, b3 being set st b1 misses b2 holds
( Funcs (b1 \/ b2),b3,[:(Funcs b1,b3),(Funcs b2,b3):] are_equipotent & Card (Funcs (b1 \/ b2),b3) = Card [:(Funcs b1,b3),(Funcs b2,b3):] )
proof end;

theorem Th70: :: FUNCT_5:70
for b1, b2, b3 being set holds
( Funcs [:b1,b2:],b3, Funcs b1,(Funcs b2,b3) are_equipotent & Card (Funcs [:b1,b2:],b3) = Card (Funcs b1,(Funcs b2,b3)) )
proof end;

theorem Th71: :: FUNCT_5:71
for b1, b2, b3 being set holds
( Funcs b1,[:b2,b3:],[:(Funcs b1,b2),(Funcs b1,b3):] are_equipotent & Card (Funcs b1,[:b2,b3:]) = Card [:(Funcs b1,b2),(Funcs b1,b3):] )
proof end;

theorem Th72: :: FUNCT_5:72
for b1, b2, b3 being set st b1 <> b2 holds
( Funcs b3,{b1,b2}, bool b3 are_equipotent & Card (Funcs b3,{b1,b2}) = Card (bool b3) )
proof end;

theorem Th73: :: FUNCT_5:73
for b1, b2, b3 being set st b1 <> b2 holds
( Funcs {b1,b2},b3,[:b3,b3:] are_equipotent & Card (Funcs {b1,b2},b3) = Card [:b3,b3:] )
proof end;