:: COH_SP semantic presentation

definition
let c1 be set ;
canceled;
attr a1 is binary_complete means :Def2: :: COH_SP:def 2
for b1 being set st b1 c= a1 & ( for b2, b3 being set st b2 in b1 & b3 in b1 holds
b2 \/ b3 in a1 ) holds
union b1 in a1;
end;

:: deftheorem Def1 COH_SP:def 1 :
canceled;

:: deftheorem Def2 defines binary_complete COH_SP:def 2 :
for b1 being set holds
( b1 is binary_complete iff for b2 being set st b2 c= b1 & ( for b3, b4 being set st b3 in b2 & b4 in b2 holds
b3 \/ b4 in b1 ) holds
union b2 in b1 );

registration
cluster non empty subset-closed binary_complete set ;
existence
ex b1 being set st
( b1 is subset-closed & b1 is binary_complete & not b1 is empty )
proof end;
end;

definition
mode Coherence_Space is non empty subset-closed binary_complete set ;
end;

theorem Th1: :: COH_SP:1
for b1 being Coherence_Space holds {} in b1
proof end;

theorem Th2: :: COH_SP:2
for b1 being set holds bool b1 is Coherence_Space
proof end;

theorem Th3: :: COH_SP:3
{{} } is Coherence_Space by Th2, ZFMISC_1:1;

theorem Th4: :: COH_SP:4
for b1 being set
for b2 being Coherence_Space st b1 in union b2 holds
{b1} in b2
proof end;

definition
let c1 be Coherence_Space;
func Web c1 -> Tolerance of union a1 means :Def3: :: COH_SP:def 3
for b1, b2 being set holds
( [b1,b2] in a2 iff ex b3 being set st
( b3 in a1 & b1 in b3 & b2 in b3 ) );
existence
ex b1 being Tolerance of union c1 st
for b2, b3 being set holds
( [b2,b3] in b1 iff ex b4 being set st
( b4 in c1 & b2 in b4 & b3 in b4 ) )
proof end;
uniqueness
for b1, b2 being Tolerance of union c1 st ( for b3, b4 being set holds
( [b3,b4] in b1 iff ex b5 being set st
( b5 in c1 & b3 in b5 & b4 in b5 ) ) ) & ( for b3, b4 being set holds
( [b3,b4] in b2 iff ex b5 being set st
( b5 in c1 & b3 in b5 & b4 in b5 ) ) ) holds
b1 = b2
by TOLER_1:52;
end;

:: deftheorem Def3 defines Web COH_SP:def 3 :
for b1 being Coherence_Space
for b2 being Tolerance of union b1 holds
( b2 = Web b1 iff for b3, b4 being set holds
( [b3,b4] in b2 iff ex b5 being set st
( b5 in b1 & b3 in b5 & b4 in b5 ) ) );

theorem Th5: :: COH_SP:5
for b1 being Coherence_Space
for b2 being Tolerance of union b1 holds
( b2 = Web b1 iff for b3, b4 being set holds
( [b3,b4] in b2 iff {b3,b4} in b1 ) )
proof end;

theorem Th6: :: COH_SP:6
for b1 being set
for b2 being Coherence_Space holds
( b1 in b2 iff for b3, b4 being set st b3 in b1 & b4 in b1 holds
{b3,b4} in b2 )
proof end;

theorem Th7: :: COH_SP:7
for b1 being set
for b2 being Coherence_Space holds
( b1 in b2 iff for b3, b4 being set st b3 in b1 & b4 in b1 holds
[b3,b4] in Web b2 )
proof end;

theorem Th8: :: COH_SP:8
for b1 being set
for b2 being Coherence_Space st ( for b3, b4 being set st b3 in b1 & b4 in b1 holds
{b3,b4} in b2 ) holds
b1 c= union b2
proof end;

theorem Th9: :: COH_SP:9
for b1, b2 being Coherence_Space st Web b1 = Web b2 holds
b1 = b2
proof end;

theorem Th10: :: COH_SP:10
for b1 being Coherence_Space st union b1 in b1 holds
b1 = bool (union b1)
proof end;

theorem Th11: :: COH_SP:11
for b1 being Coherence_Space st b1 = bool (union b1) holds
Web b1 = Total (union b1)
proof end;

definition
let c1 be set ;
let c2 be Tolerance of c1;
func CohSp c2 -> Coherence_Space means :Def4: :: COH_SP:def 4
for b1 being set holds
( b1 in a3 iff for b2, b3 being set st b2 in b1 & b3 in b1 holds
[b2,b3] in a2 );
existence
ex b1 being Coherence_Space st
for b2 being set holds
( b2 in b1 iff for b3, b4 being set st b3 in b2 & b4 in b2 holds
[b3,b4] in c2 )
proof end;
uniqueness
for b1, b2 being Coherence_Space st ( for b3 being set holds
( b3 in b1 iff for b4, b5 being set st b4 in b3 & b5 in b3 holds
[b4,b5] in c2 ) ) & ( for b3 being set holds
( b3 in b2 iff for b4, b5 being set st b4 in b3 & b5 in b3 holds
[b4,b5] in c2 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines CohSp COH_SP:def 4 :
for b1 being set
for b2 being Tolerance of b1
for b3 being Coherence_Space holds
( b3 = CohSp b2 iff for b4 being set holds
( b4 in b3 iff for b5, b6 being set st b5 in b4 & b6 in b4 holds
[b5,b6] in b2 ) );

theorem Th12: :: COH_SP:12
for b1 being set
for b2 being Tolerance of b1 holds Web (CohSp b2) = b2
proof end;

theorem Th13: :: COH_SP:13
for b1 being Coherence_Space holds CohSp (Web b1) = b1
proof end;

theorem Th14: :: COH_SP:14
for b1, b2 being set
for b3 being Tolerance of b1 holds
( b2 in CohSp b3 iff b2 is TolSet of b3 )
proof end;

theorem Th15: :: COH_SP:15
for b1 being set
for b2 being Tolerance of b1 holds CohSp b2 = TolSets b2
proof end;

definition
let c1 be set ;
func CSp c1 -> set equals :: COH_SP:def 5
{ b1 where B is Subset-Family of a1 : b1 is Coherence_Space } ;
coherence
{ b1 where B is Subset-Family of c1 : b1 is Coherence_Space } is set
;
end;

:: deftheorem Def5 defines CSp COH_SP:def 5 :
for b1 being set holds CSp b1 = { b2 where B is Subset-Family of b1 : b2 is Coherence_Space } ;

registration
let c1 be set ;
cluster CSp a1 -> non empty ;
coherence
not CSp c1 is empty
proof end;
end;

registration
let c1 be set ;
cluster -> non empty subset-closed binary_complete Element of CSp a1;
coherence
for b1 being Element of CSp c1 holds
( b1 is subset-closed & b1 is binary_complete & not b1 is empty )
proof end;
end;

theorem Th16: :: COH_SP:16
for b1, b2, b3 being set
for b4 being Element of CSp b1 st {b2,b3} in b4 holds
( b2 in union b4 & b3 in union b4 )
proof end;

definition
let c1 be set ;
canceled;
func FuncsC c1 -> set equals :: COH_SP:def 7
union { (Funcs (union b1),(union b2)) where B is Element of CSp a1, B is Element of CSp a1 : verum } ;
coherence
union { (Funcs (union b1),(union b2)) where B is Element of CSp c1, B is Element of CSp c1 : verum } is set
;
end;

:: deftheorem Def6 COH_SP:def 6 :
canceled;

:: deftheorem Def7 defines FuncsC COH_SP:def 7 :
for b1 being set holds FuncsC b1 = union { (Funcs (union b2),(union b3)) where B is Element of CSp b1, B is Element of CSp b1 : verum } ;

registration
let c1 be set ;
cluster FuncsC a1 -> non empty functional ;
coherence
( not FuncsC c1 is empty & FuncsC c1 is functional )
proof end;
end;

theorem Th17: :: COH_SP:17
for b1, b2 being set holds
( b1 in FuncsC b2 iff ex b3, b4 being Element of CSp b2 st
( ( union b4 = {} implies union b3 = {} ) & b1 is Function of union b3, union b4 ) )
proof end;

definition
let c1 be set ;
func MapsC c1 -> set equals :: COH_SP:def 8
{ [[b1,b2],b3] where B is Element of CSp a1, B is Element of CSp a1, B is Element of FuncsC a1 : ( ( union b2 = {} implies union b1 = {} ) & b3 is Function of union b1, union b2 & ( for b1, b2 being set st {b4,b5} in b1 holds
{(b3 . b4),(b3 . b5)} in b2 ) )
}
;
coherence
{ [[b1,b2],b3] where B is Element of CSp c1, B is Element of CSp c1, B is Element of FuncsC c1 : ( ( union b2 = {} implies union b1 = {} ) & b3 is Function of union b1, union b2 & ( for b1, b2 being set st {b4,b5} in b1 holds
{(b3 . b4),(b3 . b5)} in b2 ) )
}
is set
;
end;

:: deftheorem Def8 defines MapsC COH_SP:def 8 :
for b1 being set holds MapsC b1 = { [[b2,b3],b4] where B is Element of CSp b1, B is Element of CSp b1, B is Element of FuncsC b1 : ( ( union b3 = {} implies union b2 = {} ) & b4 is Function of union b2, union b3 & ( for b1, b2 being set st {b5,b6} in b2 holds
{(b4 . b5),(b4 . b6)} in b3 ) )
}
;

registration
let c1 be set ;
cluster MapsC a1 -> non empty ;
coherence
not MapsC c1 is empty
proof end;
end;

theorem Th18: :: COH_SP:18
for b1 being set
for b2 being Element of MapsC b1 ex b3 being Element of FuncsC b1ex b4, b5 being Element of CSp b1 st
( b2 = [[b4,b5],b3] & ( union b5 = {} implies union b4 = {} ) & b3 is Function of union b4, union b5 & ( for b6, b7 being set st {b6,b7} in b4 holds
{(b3 . b6),(b3 . b7)} in b5 ) )
proof end;

theorem Th19: :: COH_SP:19
for b1 being set
for b2, b3 being Element of CSp b1
for b4 being Function of union b2, union b3 st ( union b3 = {} implies union b2 = {} ) & ( for b5, b6 being set st {b5,b6} in b2 holds
{(b4 . b5),(b4 . b6)} in b3 ) holds
[[b2,b3],b4] in MapsC b1
proof end;

registration
let c1 be set ;
let c2 be Element of MapsC c1;
cluster a2 `2 -> Relation-like Function-like ;
coherence
( c2 `2 is Function-like & c2 `2 is Relation-like )
proof end;
end;

definition
let c1 be set ;
let c2 be Element of MapsC c1;
canceled;
func dom c2 -> Element of CSp a1 equals :: COH_SP:def 10
(a2 `1 ) `1 ;
coherence
(c2 `1 ) `1 is Element of CSp c1
proof end;
func cod c2 -> Element of CSp a1 equals :: COH_SP:def 11
(a2 `1 ) `2 ;
coherence
(c2 `1 ) `2 is Element of CSp c1
proof end;
end;

:: deftheorem Def9 COH_SP:def 9 :
canceled;

:: deftheorem Def10 defines dom COH_SP:def 10 :
for b1 being set
for b2 being Element of MapsC b1 holds dom b2 = (b2 `1 ) `1 ;

:: deftheorem Def11 defines cod COH_SP:def 11 :
for b1 being set
for b2 being Element of MapsC b1 holds cod b2 = (b2 `1 ) `2 ;

theorem Th20: :: COH_SP:20
for b1 being set
for b2 being Element of MapsC b1 holds b2 = [[(dom b2),(cod b2)],(b2 `2 )]
proof end;

Lemma15: for b1 being set
for b2, b3 being Element of MapsC b1 st b2 `2 = b3 `2 & dom b2 = dom b3 & cod b2 = cod b3 holds
b2 = b3
proof end;

definition
let c1 be set ;
let c2 be Element of CSp c1;
func id$ c2 -> Element of MapsC a1 equals :: COH_SP:def 12
[[a2,a2],(id (union a2))];
coherence
[[c2,c2],(id (union c2))] is Element of MapsC c1
proof end;
end;

:: deftheorem Def12 defines id$ COH_SP:def 12 :
for b1 being set
for b2 being Element of CSp b1 holds id$ b2 = [[b2,b2],(id (union b2))];

Lemma16: for b1, b2, b3, b4, b5, b6 being set st [[b1,b3],b5] = [[b2,b4],b6] holds
( b1 = b2 & b3 = b4 )
proof end;

theorem Th21: :: COH_SP:21
for b1 being set
for b2 being Element of MapsC b1 holds
( ( union (cod b2) <> {} or union (dom b2) = {} ) & b2 `2 is Function of union (dom b2), union (cod b2) & ( for b3, b4 being set st {b3,b4} in dom b2 holds
{((b2 `2 ) . b3),((b2 `2 ) . b4)} in cod b2 ) )
proof end;

definition
let c1 be set ;
let c2, c3 be Element of MapsC c1;
assume E18: cod c2 = dom c3 ;
func c3 * c2 -> Element of MapsC a1 equals :Def13: :: COH_SP:def 13
[[(dom a2),(cod a3)],((a3 `2 ) * (a2 `2 ))];
coherence
[[(dom c2),(cod c3)],((c3 `2 ) * (c2 `2 ))] is Element of MapsC c1
proof end;
end;

:: deftheorem Def13 defines * COH_SP:def 13 :
for b1 being set
for b2, b3 being Element of MapsC b1 st cod b2 = dom b3 holds
b3 * b2 = [[(dom b2),(cod b3)],((b3 `2 ) * (b2 `2 ))];

theorem Th22: :: COH_SP:22
for b1 being set
for b2, b3 being Element of MapsC b1 st dom b2 = cod b3 holds
( (b2 * b3) `2 = (b2 `2 ) * (b3 `2 ) & dom (b2 * b3) = dom b3 & cod (b2 * b3) = cod b2 )
proof end;

theorem Th23: :: COH_SP:23
for b1 being set
for b2, b3, b4 being Element of MapsC b1 st dom b2 = cod b3 & dom b4 = cod b2 holds
b4 * (b2 * b3) = (b4 * b2) * b3
proof end;

theorem Th24: :: COH_SP:24
for b1 being set
for b2 being Element of CSp b1 holds
( (id$ b2) `2 = id (union b2) & dom (id$ b2) = b2 & cod (id$ b2) = b2 )
proof end;

theorem Th25: :: COH_SP:25
for b1 being set
for b2 being Element of MapsC b1 holds
( b2 * (id$ (dom b2)) = b2 & (id$ (cod b2)) * b2 = b2 )
proof end;

definition
let c1 be set ;
func CDom c1 -> Function of MapsC a1, CSp a1 means :Def14: :: COH_SP:def 14
for b1 being Element of MapsC a1 holds a2 . b1 = dom b1;
existence
ex b1 being Function of MapsC c1, CSp c1 st
for b2 being Element of MapsC c1 holds b1 . b2 = dom b2
proof end;
uniqueness
for b1, b2 being Function of MapsC c1, CSp c1 st ( for b3 being Element of MapsC c1 holds b1 . b3 = dom b3 ) & ( for b3 being Element of MapsC c1 holds b2 . b3 = dom b3 ) holds
b1 = b2
proof end;
func CCod c1 -> Function of MapsC a1, CSp a1 means :Def15: :: COH_SP:def 15
for b1 being Element of MapsC a1 holds a2 . b1 = cod b1;
existence
ex b1 being Function of MapsC c1, CSp c1 st
for b2 being Element of MapsC c1 holds b1 . b2 = cod b2
proof end;
uniqueness
for b1, b2 being Function of MapsC c1, CSp c1 st ( for b3 being Element of MapsC c1 holds b1 . b3 = cod b3 ) & ( for b3 being Element of MapsC c1 holds b2 . b3 = cod b3 ) holds
b1 = b2
proof end;
func CComp c1 -> PartFunc of [:(MapsC a1),(MapsC a1):], MapsC a1 means :Def16: :: COH_SP:def 16
( ( for b1, b2 being Element of MapsC a1 holds
( [b1,b2] in dom a2 iff dom b1 = cod b2 ) ) & ( for b1, b2 being Element of MapsC a1 st dom b1 = cod b2 holds
a2 . [b1,b2] = b1 * b2 ) );
existence
ex b1 being PartFunc of [:(MapsC c1),(MapsC c1):], MapsC c1 st
( ( for b2, b3 being Element of MapsC c1 holds
( [b2,b3] in dom b1 iff dom b2 = cod b3 ) ) & ( for b2, b3 being Element of MapsC c1 st dom b2 = cod b3 holds
b1 . [b2,b3] = b2 * b3 ) )
proof end;
uniqueness
for b1, b2 being PartFunc of [:(MapsC c1),(MapsC c1):], MapsC c1 st ( for b3, b4 being Element of MapsC c1 holds
( [b3,b4] in dom b1 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsC c1 st dom b3 = cod b4 holds
b1 . [b3,b4] = b3 * b4 ) & ( for b3, b4 being Element of MapsC c1 holds
( [b3,b4] in dom b2 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsC c1 st dom b3 = cod b4 holds
b2 . [b3,b4] = b3 * b4 ) holds
b1 = b2
proof end;
func CId c1 -> Function of CSp a1, MapsC a1 means :Def17: :: COH_SP:def 17
for b1 being Element of CSp a1 holds a2 . b1 = id$ b1;
existence
ex b1 being Function of CSp c1, MapsC c1 st
for b2 being Element of CSp c1 holds b1 . b2 = id$ b2
proof end;
uniqueness
for b1, b2 being Function of CSp c1, MapsC c1 st ( for b3 being Element of CSp c1 holds b1 . b3 = id$ b3 ) & ( for b3 being Element of CSp c1 holds b2 . b3 = id$ b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def14 defines CDom COH_SP:def 14 :
for b1 being set
for b2 being Function of MapsC b1, CSp b1 holds
( b2 = CDom b1 iff for b3 being Element of MapsC b1 holds b2 . b3 = dom b3 );

:: deftheorem Def15 defines CCod COH_SP:def 15 :
for b1 being set
for b2 being Function of MapsC b1, CSp b1 holds
( b2 = CCod b1 iff for b3 being Element of MapsC b1 holds b2 . b3 = cod b3 );

:: deftheorem Def16 defines CComp COH_SP:def 16 :
for b1 being set
for b2 being PartFunc of [:(MapsC b1),(MapsC b1):], MapsC b1 holds
( b2 = CComp b1 iff ( ( for b3, b4 being Element of MapsC b1 holds
( [b3,b4] in dom b2 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsC b1 st dom b3 = cod b4 holds
b2 . [b3,b4] = b3 * b4 ) ) );

:: deftheorem Def17 defines CId COH_SP:def 17 :
for b1 being set
for b2 being Function of CSp b1, MapsC b1 holds
( b2 = CId b1 iff for b3 being Element of CSp b1 holds b2 . b3 = id$ b3 );

theorem Th26: :: COH_SP:26
for b1 being set holds CatStr(# (CSp b1),(MapsC b1),(CDom b1),(CCod b1),(CComp b1),(CId b1) #) is Category
proof end;

definition
let c1 be set ;
func CohCat c1 -> Category equals :: COH_SP:def 18
CatStr(# (CSp a1),(MapsC a1),(CDom a1),(CCod a1),(CComp a1),(CId a1) #);
coherence
CatStr(# (CSp c1),(MapsC c1),(CDom c1),(CCod c1),(CComp c1),(CId c1) #) is Category
by Th26;
end;

:: deftheorem Def18 defines CohCat COH_SP:def 18 :
for b1 being set holds CohCat b1 = CatStr(# (CSp b1),(MapsC b1),(CDom b1),(CCod b1),(CComp b1),(CId b1) #);

definition
let c1 be set ;
func Toler c1 -> set means :Def19: :: COH_SP:def 19
for b1 being set holds
( b1 in a2 iff b1 is Tolerance of a1 );
existence
ex b1 being set st
for b2 being set holds
( b2 in b1 iff b2 is Tolerance of c1 )
proof end;
uniqueness
for b1, b2 being set st ( for b3 being set holds
( b3 in b1 iff b3 is Tolerance of c1 ) ) & ( for b3 being set holds
( b3 in b2 iff b3 is Tolerance of c1 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def19 defines Toler COH_SP:def 19 :
for b1, b2 being set holds
( b2 = Toler b1 iff for b3 being set holds
( b3 in b2 iff b3 is Tolerance of b1 ) );

registration
let c1 be set ;
cluster Toler a1 -> non empty ;
coherence
not Toler c1 is empty
proof end;
end;

definition
let c1 be set ;
func Toler_on_subsets c1 -> set equals :: COH_SP:def 20
union { (Toler b1) where B is Subset of a1 : verum } ;
coherence
union { (Toler b1) where B is Subset of c1 : verum } is set
;
end;

:: deftheorem Def20 defines Toler_on_subsets COH_SP:def 20 :
for b1 being set holds Toler_on_subsets b1 = union { (Toler b2) where B is Subset of b1 : verum } ;

registration
let c1 be set ;
cluster Toler_on_subsets a1 -> non empty ;
coherence
not Toler_on_subsets c1 is empty
proof end;
end;

theorem Th27: :: COH_SP:27
for b1, b2 being set holds
( b1 in Toler_on_subsets b2 iff ex b3 being set st
( b3 c= b2 & b1 is Tolerance of b3 ) )
proof end;

theorem Th28: :: COH_SP:28
for b1 being set holds Total b1 in Toler b1 by Def19;

theorem Th29: :: COH_SP:29
canceled;

theorem Th30: :: COH_SP:30
for b1 being set holds {} in Toler_on_subsets b1
proof end;

theorem Th31: :: COH_SP:31
for b1, b2 being set st b1 c= b2 holds
Total b1 in Toler_on_subsets b2
proof end;

theorem Th32: :: COH_SP:32
for b1, b2 being set st b1 c= b2 holds
id b1 in Toler_on_subsets b2
proof end;

theorem Th33: :: COH_SP:33
for b1 being set holds Total b1 in Toler_on_subsets b1 by Th31;

theorem Th34: :: COH_SP:34
for b1 being set holds id b1 in Toler_on_subsets b1 by Th32;

definition
let c1 be set ;
func TOL c1 -> set equals :: COH_SP:def 21
{ [b1,b2] where B is Element of Toler_on_subsets a1, B is Subset of a1 : b1 is Tolerance of b2 } ;
coherence
{ [b1,b2] where B is Element of Toler_on_subsets c1, B is Subset of c1 : b1 is Tolerance of b2 } is set
;
end;

:: deftheorem Def21 defines TOL COH_SP:def 21 :
for b1 being set holds TOL b1 = { [b2,b3] where B is Element of Toler_on_subsets b1, B is Subset of b1 : b2 is Tolerance of b3 } ;

registration
let c1 be set ;
cluster TOL a1 -> non empty ;
coherence
not TOL c1 is empty
proof end;
end;

theorem Th35: :: COH_SP:35
for b1 being set holds [{} ,{} ] in TOL b1
proof end;

theorem Th36: :: COH_SP:36
for b1, b2 being set st b1 c= b2 holds
[(id b1),b1] in TOL b2
proof end;

theorem Th37: :: COH_SP:37
for b1, b2 being set st b1 c= b2 holds
[(Total b1),b1] in TOL b2
proof end;

theorem Th38: :: COH_SP:38
for b1 being set holds [(id b1),b1] in TOL b1 by Th36;

theorem Th39: :: COH_SP:39
for b1 being set holds [(Total b1),b1] in TOL b1 by Th37;

definition
let c1 be set ;
let c2 be Element of TOL c1;
redefine func `2 as c2 `2 -> Subset of a1;
coherence
c2 `2 is Subset of c1
proof end;
redefine func `1 as c2 `1 -> Tolerance of a2 `2 ;
coherence
c2 `1 is Tolerance of c2 `2
proof end;
end;

definition
let c1 be set ;
func FuncsT c1 -> set equals :: COH_SP:def 22
union { (Funcs (b1 `2 ),(b2 `2 )) where B is Element of TOL a1, B is Element of TOL a1 : verum } ;
coherence
union { (Funcs (b1 `2 ),(b2 `2 )) where B is Element of TOL c1, B is Element of TOL c1 : verum } is set
;
end;

:: deftheorem Def22 defines FuncsT COH_SP:def 22 :
for b1 being set holds FuncsT b1 = union { (Funcs (b2 `2 ),(b3 `2 )) where B is Element of TOL b1, B is Element of TOL b1 : verum } ;

registration
let c1 be set ;
cluster FuncsT a1 -> non empty functional ;
coherence
( not FuncsT c1 is empty & FuncsT c1 is functional )
proof end;
end;

theorem Th40: :: COH_SP:40
for b1, b2 being set holds
( b1 in FuncsT b2 iff ex b3, b4 being Element of TOL b2 st
( ( b4 `2 = {} implies b3 `2 = {} ) & b1 is Function of b3 `2 ,b4 `2 ) )
proof end;

definition
let c1 be set ;
func MapsT c1 -> set equals :: COH_SP:def 23
{ [[b1,b2],b3] where B is Element of TOL a1, B is Element of TOL a1, B is Element of FuncsT a1 : ( ( b2 `2 = {} implies b1 `2 = {} ) & b3 is Function of b1 `2 ,b2 `2 & ( for b1, b2 being set st [b4,b5] in b1 `1 holds
[(b3 . b4),(b3 . b5)] in b2 `1 ) )
}
;
coherence
{ [[b1,b2],b3] where B is Element of TOL c1, B is Element of TOL c1, B is Element of FuncsT c1 : ( ( b2 `2 = {} implies b1 `2 = {} ) & b3 is Function of b1 `2 ,b2 `2 & ( for b1, b2 being set st [b4,b5] in b1 `1 holds
[(b3 . b4),(b3 . b5)] in b2 `1 ) )
}
is set
;
end;

:: deftheorem Def23 defines MapsT COH_SP:def 23 :
for b1 being set holds MapsT b1 = { [[b2,b3],b4] where B is Element of TOL b1, B is Element of TOL b1, B is Element of FuncsT b1 : ( ( b3 `2 = {} implies b2 `2 = {} ) & b4 is Function of b2 `2 ,b3 `2 & ( for b1, b2 being set st [b5,b6] in b2 `1 holds
[(b4 . b5),(b4 . b6)] in b3 `1 ) )
}
;

registration
let c1 be set ;
cluster MapsT a1 -> non empty ;
coherence
not MapsT c1 is empty
proof end;
end;

theorem Th41: :: COH_SP:41
for b1 being set
for b2 being Element of MapsT b1 ex b3 being Element of FuncsT b1ex b4, b5 being Element of TOL b1 st
( b2 = [[b4,b5],b3] & ( b5 `2 = {} implies b4 `2 = {} ) & b3 is Function of b4 `2 ,b5 `2 & ( for b6, b7 being set st [b6,b7] in b4 `1 holds
[(b3 . b6),(b3 . b7)] in b5 `1 ) )
proof end;

theorem Th42: :: COH_SP:42
for b1 being set
for b2, b3 being Element of TOL b1
for b4 being Function of b2 `2 ,b3 `2 st ( b3 `2 = {} implies b2 `2 = {} ) & ( for b5, b6 being set st [b5,b6] in b2 `1 holds
[(b4 . b5),(b4 . b6)] in b3 `1 ) holds
[[b2,b3],b4] in MapsT b1
proof end;

registration
let c1 be set ;
let c2 be Element of MapsT c1;
cluster a2 `2 -> Relation-like Function-like ;
coherence
( c2 `2 is Function-like & c2 `2 is Relation-like )
proof end;
end;

definition
let c1 be set ;
let c2 be Element of MapsT c1;
canceled;
func dom c2 -> Element of TOL a1 equals :: COH_SP:def 25
(a2 `1 ) `1 ;
coherence
(c2 `1 ) `1 is Element of TOL c1
proof end;
func cod c2 -> Element of TOL a1 equals :: COH_SP:def 26
(a2 `1 ) `2 ;
coherence
(c2 `1 ) `2 is Element of TOL c1
proof end;
end;

:: deftheorem Def24 COH_SP:def 24 :
canceled;

:: deftheorem Def25 defines dom COH_SP:def 25 :
for b1 being set
for b2 being Element of MapsT b1 holds dom b2 = (b2 `1 ) `1 ;

:: deftheorem Def26 defines cod COH_SP:def 26 :
for b1 being set
for b2 being Element of MapsT b1 holds cod b2 = (b2 `1 ) `2 ;

theorem Th43: :: COH_SP:43
for b1 being set
for b2 being Element of MapsT b1 holds b2 = [[(dom b2),(cod b2)],(b2 `2 )]
proof end;

Lemma38: for b1 being set
for b2, b3 being Element of MapsT b1 st b2 `2 = b3 `2 & dom b2 = dom b3 & cod b2 = cod b3 holds
b2 = b3
proof end;

definition
let c1 be set ;
let c2 be Element of TOL c1;
func id$ c2 -> Element of MapsT a1 equals :: COH_SP:def 27
[[a2,a2],(id (a2 `2 ))];
coherence
[[c2,c2],(id (c2 `2 ))] is Element of MapsT c1
proof end;
end;

:: deftheorem Def27 defines id$ COH_SP:def 27 :
for b1 being set
for b2 being Element of TOL b1 holds id$ b2 = [[b2,b2],(id (b2 `2 ))];

theorem Th44: :: COH_SP:44
for b1 being set
for b2 being Element of MapsT b1 holds
( ( (cod b2) `2 <> {} or (dom b2) `2 = {} ) & b2 `2 is Function of (dom b2) `2 ,(cod b2) `2 & ( for b3, b4 being set st [b3,b4] in (dom b2) `1 holds
[((b2 `2 ) . b3),((b2 `2 ) . b4)] in (cod b2) `1 ) )
proof end;

definition
let c1 be set ;
let c2, c3 be Element of MapsT c1;
assume E40: cod c2 = dom c3 ;
func c3 * c2 -> Element of MapsT a1 equals :Def28: :: COH_SP:def 28
[[(dom a2),(cod a3)],((a3 `2 ) * (a2 `2 ))];
coherence
[[(dom c2),(cod c3)],((c3 `2 ) * (c2 `2 ))] is Element of MapsT c1
proof end;
end;

:: deftheorem Def28 defines * COH_SP:def 28 :
for b1 being set
for b2, b3 being Element of MapsT b1 st cod b2 = dom b3 holds
b3 * b2 = [[(dom b2),(cod b3)],((b3 `2 ) * (b2 `2 ))];

theorem Th45: :: COH_SP:45
for b1 being set
for b2, b3 being Element of MapsT b1 st dom b2 = cod b3 holds
( (b2 * b3) `2 = (b2 `2 ) * (b3 `2 ) & dom (b2 * b3) = dom b3 & cod (b2 * b3) = cod b2 )
proof end;

theorem Th46: :: COH_SP:46
for b1 being set
for b2, b3, b4 being Element of MapsT b1 st dom b2 = cod b3 & dom b4 = cod b2 holds
b4 * (b2 * b3) = (b4 * b2) * b3
proof end;

theorem Th47: :: COH_SP:47
for b1 being set
for b2 being Element of TOL b1 holds
( (id$ b2) `2 = id (b2 `2 ) & dom (id$ b2) = b2 & cod (id$ b2) = b2 )
proof end;

theorem Th48: :: COH_SP:48
for b1 being set
for b2 being Element of MapsT b1 holds
( b2 * (id$ (dom b2)) = b2 & (id$ (cod b2)) * b2 = b2 )
proof end;

definition
let c1 be set ;
func fDom c1 -> Function of MapsT a1, TOL a1 means :Def29: :: COH_SP:def 29
for b1 being Element of MapsT a1 holds a2 . b1 = dom b1;
existence
ex b1 being Function of MapsT c1, TOL c1 st
for b2 being Element of MapsT c1 holds b1 . b2 = dom b2
proof end;
uniqueness
for b1, b2 being Function of MapsT c1, TOL c1 st ( for b3 being Element of MapsT c1 holds b1 . b3 = dom b3 ) & ( for b3 being Element of MapsT c1 holds b2 . b3 = dom b3 ) holds
b1 = b2
proof end;
func fCod c1 -> Function of MapsT a1, TOL a1 means :Def30: :: COH_SP:def 30
for b1 being Element of MapsT a1 holds a2 . b1 = cod b1;
existence
ex b1 being Function of MapsT c1, TOL c1 st
for b2 being Element of MapsT c1 holds b1 . b2 = cod b2
proof end;
uniqueness
for b1, b2 being Function of MapsT c1, TOL c1 st ( for b3 being Element of MapsT c1 holds b1 . b3 = cod b3 ) & ( for b3 being Element of MapsT c1 holds b2 . b3 = cod b3 ) holds
b1 = b2
proof end;
func fComp c1 -> PartFunc of [:(MapsT a1),(MapsT a1):], MapsT a1 means :Def31: :: COH_SP:def 31
( ( for b1, b2 being Element of MapsT a1 holds
( [b1,b2] in dom a2 iff dom b1 = cod b2 ) ) & ( for b1, b2 being Element of MapsT a1 st dom b1 = cod b2 holds
a2 . [b1,b2] = b1 * b2 ) );
existence
ex b1 being PartFunc of [:(MapsT c1),(MapsT c1):], MapsT c1 st
( ( for b2, b3 being Element of MapsT c1 holds
( [b2,b3] in dom b1 iff dom b2 = cod b3 ) ) & ( for b2, b3 being Element of MapsT c1 st dom b2 = cod b3 holds
b1 . [b2,b3] = b2 * b3 ) )
proof end;
uniqueness
for b1, b2 being PartFunc of [:(MapsT c1),(MapsT c1):], MapsT c1 st ( for b3, b4 being Element of MapsT c1 holds
( [b3,b4] in dom b1 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsT c1 st dom b3 = cod b4 holds
b1 . [b3,b4] = b3 * b4 ) & ( for b3, b4 being Element of MapsT c1 holds
( [b3,b4] in dom b2 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsT c1 st dom b3 = cod b4 holds
b2 . [b3,b4] = b3 * b4 ) holds
b1 = b2
proof end;
func fId c1 -> Function of TOL a1, MapsT a1 means :Def32: :: COH_SP:def 32
for b1 being Element of TOL a1 holds a2 . b1 = id$ b1;
existence
ex b1 being Function of TOL c1, MapsT c1 st
for b2 being Element of TOL c1 holds b1 . b2 = id$ b2
proof end;
uniqueness
for b1, b2 being Function of TOL c1, MapsT c1 st ( for b3 being Element of TOL c1 holds b1 . b3 = id$ b3 ) & ( for b3 being Element of TOL c1 holds b2 . b3 = id$ b3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def29 defines fDom COH_SP:def 29 :
for b1 being set
for b2 being Function of MapsT b1, TOL b1 holds
( b2 = fDom b1 iff for b3 being Element of MapsT b1 holds b2 . b3 = dom b3 );

:: deftheorem Def30 defines fCod COH_SP:def 30 :
for b1 being set
for b2 being Function of MapsT b1, TOL b1 holds
( b2 = fCod b1 iff for b3 being Element of MapsT b1 holds b2 . b3 = cod b3 );

:: deftheorem Def31 defines fComp COH_SP:def 31 :
for b1 being set
for b2 being PartFunc of [:(MapsT b1),(MapsT b1):], MapsT b1 holds
( b2 = fComp b1 iff ( ( for b3, b4 being Element of MapsT b1 holds
( [b3,b4] in dom b2 iff dom b3 = cod b4 ) ) & ( for b3, b4 being Element of MapsT b1 st dom b3 = cod b4 holds
b2 . [b3,b4] = b3 * b4 ) ) );

:: deftheorem Def32 defines fId COH_SP:def 32 :
for b1 being set
for b2 being Function of TOL b1, MapsT b1 holds
( b2 = fId b1 iff for b3 being Element of TOL b1 holds b2 . b3 = id$ b3 );

theorem Th49: :: COH_SP:49
for b1 being set holds CatStr(# (TOL b1),(MapsT b1),(fDom b1),(fCod b1),(fComp b1),(fId b1) #) is Category
proof end;

definition
let c1 be set ;
func TolCat c1 -> Category equals :: COH_SP:def 33
CatStr(# (TOL a1),(MapsT a1),(fDom a1),(fCod a1),(fComp a1),(fId a1) #);
coherence
CatStr(# (TOL c1),(MapsT c1),(fDom c1),(fCod c1),(fComp c1),(fId c1) #) is Category
by Th49;
end;

:: deftheorem Def33 defines TolCat COH_SP:def 33 :
for b1 being set holds TolCat b1 = CatStr(# (TOL b1),(MapsT b1),(fDom b1),(fCod b1),(fComp b1),(fId b1) #);