let C be Category; :: thesis: for O being non empty Subset of the carrier of C
for M being non empty set
for d, c being Function of M,O
for p being PartFunc of [:M,M:],M
for i being Function of O,M st M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M holds
CatStr(# O,M,d,c,p #) is Subcategory of C

let O be non empty Subset of the carrier of C; :: thesis: for M being non empty set
for d, c being Function of M,O
for p being PartFunc of [:M,M:],M
for i being Function of O,M st M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M holds
CatStr(# O,M,d,c,p #) is Subcategory of C

let M be non empty set ; :: thesis: for d, c being Function of M,O
for p being PartFunc of [:M,M:],M
for i being Function of O,M st M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M holds
CatStr(# O,M,d,c,p #) is Subcategory of C

let d, c be Function of M,O; :: thesis: for p being PartFunc of [:M,M:],M
for i being Function of O,M st M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M holds
CatStr(# O,M,d,c,p #) is Subcategory of C

let p be PartFunc of [:M,M:],M; :: thesis: for i being Function of O,M st M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M holds
CatStr(# O,M,d,c,p #) is Subcategory of C

let i be Function of O,M; :: thesis: ( M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } & d = the Source of C | M & c = the Target of C | M & p = the Comp of C || M implies CatStr(# O,M,d,c,p #) is Subcategory of C )
set H = { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } ;
assume that
A1: M = union { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } and
A2: d = the Source of C | M and
A3: c = the Target of C | M and
A4: p = the Comp of C || M ; :: thesis: CatStr(# O,M,d,c,p #) is Subcategory of C
set B = CatStr(# O,M,d,c,p #);
A5: now :: thesis: for f being Morphism of CatStr(# O,M,d,c,p #) holds f is Morphism of C
let f be Morphism of CatStr(# O,M,d,c,p #); :: thesis: f is Morphism of C
consider X being set such that
A6: f in X and
A7: X in { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } by ;
ex a, b being Object of C st
( X = Hom (a,b) & a in O & b in O ) by A7;
hence f is Morphism of C by A6; :: thesis: verum
end;
A8: for a, b being Object of CatStr(# O,M,d,c,p #)
for a9, b9 being Object of C st a = a9 & b = b9 holds
Hom (a,b) = Hom (a9,b9)
proof
let a, b be Object of CatStr(# O,M,d,c,p #); :: thesis: for a9, b9 being Object of C st a = a9 & b = b9 holds
Hom (a,b) = Hom (a9,b9)

let a9, b9 be Object of C; :: thesis: ( a = a9 & b = b9 implies Hom (a,b) = Hom (a9,b9) )
assume A9: ( a = a9 & b = b9 ) ; :: thesis: Hom (a,b) = Hom (a9,b9)
now :: thesis: for x being object holds
( ( x in Hom (a,b) implies x in Hom (a9,b9) ) & ( x in Hom (a9,b9) implies x in Hom (a,b) ) )
let x be object ; :: thesis: ( ( x in Hom (a,b) implies x in Hom (a9,b9) ) & ( x in Hom (a9,b9) implies x in Hom (a,b) ) )
thus ( x in Hom (a,b) implies x in Hom (a9,b9) ) :: thesis: ( x in Hom (a9,b9) implies x in Hom (a,b) )
proof
assume A10: x in Hom (a,b) ; :: thesis: x in Hom (a9,b9)
then reconsider f = x as Morphism of CatStr(# O,M,d,c,p #) ;
reconsider f9 = f as Morphism of C by A5;
cod f = cod f9 by ;
then A11: b = cod f9 by ;
dom f = dom f9 by ;
then a = dom f9 by ;
hence x in Hom (a9,b9) by ; :: thesis: verum
end;
assume A12: x in Hom (a9,b9) ; :: thesis: x in Hom (a,b)
then reconsider f9 = x as Morphism of C ;
Hom (a9,b9) in { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } by A9;
then reconsider f = f9 as Morphism of CatStr(# O,M,d,c,p #) by ;
cod f = cod f9 by ;
then A13: cod f = b9 by ;
dom f = dom f9 by ;
then dom f = a9 by ;
hence x in Hom (a,b) by ; :: thesis: verum
end;
hence Hom (a,b) = Hom (a9,b9) by TARSKI:2; :: thesis: verum
end;
reconsider B = CatStr(# O,M,d,c,p #) as Category by Lm1, A1, A2, A3, A4;
A14: for a being Object of B
for a9 being Object of C st a = a9 holds
id a = id a9
proof
let a be Object of B; :: thesis: for a9 being Object of C st a = a9 holds
id a = id a9

let a9 be Object of C; :: thesis: ( a = a9 implies id a = id a9 )
assume A15: a = a9 ; :: thesis: id a = id a9
A16: Hom (a9,a9) in { (Hom (a,b)) where a, b is Object of C : ( a in O & b in O ) } by A15;
A17: id a9 in Hom (a9,a9) by CAT_1:27;
then reconsider ii = id a9 as Morphism of B by ;
A18: dom ii = dom (id a9) by
.= a9 ;
A19: cod ii = cod (id a9) by
.= a9 ;
ii in Hom (a,a) by A17, A8, A15;
then reconsider ii = ii as Morphism of a,a by CAT_1:def 5;
A20: for f, g being Morphism of B holds
( [g,f] in dom p iff d . g = c . f )
proof
let f, g be Morphism of B; :: thesis: ( [g,f] in dom p iff d . g = c . f )
reconsider gg = g, ff = f as Morphism of C by A5;
A21: ( d . g = dom gg & c . f = cod ff ) by ;
thus ( [g,f] in dom p implies d . g = c . f ) :: thesis: ( d . g = c . f implies [g,f] in dom p )
proof
assume [g,f] in dom p ; :: thesis: d . g = c . f
then [g,f] in (dom the Comp of C) /\ [:M,M:] by ;
then [gg,ff] in dom the Comp of C by XBOOLE_0:def 4;
hence d . g = c . f by ; :: thesis: verum
end;
assume d . g = c . f ; :: thesis: [g,f] in dom p
then [g,f] in dom the Comp of C by ;
then [g,f] in (dom the Comp of C) /\ [:M,M:] by XBOOLE_0:def 4;
hence [g,f] in dom p by ; :: thesis: verum
end;
for b being Object of B holds
( ( Hom (a,b) <> {} implies for f being Morphism of a,b holds f (*) ii = f ) & ( Hom (b,a) <> {} implies for f being Morphism of b,a holds ii (*) f = f ) )
proof
let b be Object of B; :: thesis: ( ( Hom (a,b) <> {} implies for f being Morphism of a,b holds f (*) ii = f ) & ( Hom (b,a) <> {} implies for f being Morphism of b,a holds ii (*) f = f ) )
b in O ;
then reconsider bb = b as Element of C ;
thus ( Hom (a,b) <> {} implies for f being Morphism of a,b holds f (*) ii = f ) :: thesis: ( Hom (b,a) <> {} implies for f being Morphism of b,a holds ii (*) f = f )
proof
assume A22: Hom (a,b) <> {} ; :: thesis: for f being Morphism of a,b holds f (*) ii = f
let g be Morphism of a,b; :: thesis: g (*) ii = g
reconsider gg = g as Morphism of C by A5;
A23: dom gg = dom g by
.= a9 by ;
A24: cod (id a9) = a9 ;
cod gg = cod g by
.= bb by ;
then reconsider gg = gg as Morphism of a9,bb by ;
A25: dom g = a by ;
hence g (*) ii = p . (g,ii) by
.= the Comp of C . (gg,(id a9)) by
.= gg (*) (id a9) by
.= g by ;
:: thesis: verum
end;
assume A26: Hom (b,a) <> {} ; :: thesis: for f being Morphism of b,a holds ii (*) f = f
let g be Morphism of b,a; :: thesis: ii (*) g = g
reconsider gg = g as Morphism of C by A5;
A27: cod gg = cod g by
.= a9 by ;
A28: dom (id a9) = a9 ;
dom gg = dom g by
.= bb by ;
then reconsider gg = gg as Morphism of bb,a9 by ;
A29: cod g = a by ;
hence ii (*) g = p . (ii,g) by
.= the Comp of C . ((id a9),gg) by
.= (id a9) (*) gg by
.= g by ;
:: thesis: verum
end;
hence id a = id a9 by CAT_1:def 12; :: thesis: verum
end;
( ( for a, b being Object of B
for a9, b9 being Object of C st a = a9 & b = b9 holds
Hom (a,b) c= Hom (a9,b9) ) & the Comp of B c= the Comp of C ) by ;
hence CatStr(# O,M,d,c,p #) is Subcategory of C by ; :: thesis: verum