reserve A,B,C for Category,
  F,F1,F2,F3 for Functor of A,B,
  G for Functor of B, C;
reserve m,o for set;

theorem Th5:
  for O being non empty Subset of the carrier of A,
      M being non empty Subset of the carrier' of A st
  for o being Element of A st o in O holds id o in M
  for DOM,COD being Function of M,O st DOM = (the Source of A) |M &
     COD = (the Target of A)|M
  for COMP being PartFunc of [:M,M qua non empty set:], M
   st COMP = (the Comp of A)||M
   holds CatStr(#O,M,DOM,COD,COMP#) is Subcategory of A
proof
  let O be non empty Subset of the carrier of A,
      M be non empty Subset of the carrier' of A such that
A1: for o being Element of A st o in O holds id o in M;
  let DOM,COD be Function of M,O such that
A2: DOM = (the Source of A) |M and
A3: COD = (the Target of A)|M;
  let COMP be PartFunc of [:M,M qua non empty set:], M such that
A4: COMP = (the Comp of A)||M;
  set C = CatStr(#O,M,DOM,COD,COMP#);
A5: now
    let f be (Morphism of A), g be Morphism of C such that
A6: f = g;
    dom the Source of C = the carrier' of C by FUNCT_2:def 1;
    hence dom f = dom g by A2,A6,FUNCT_1:47;
    dom the Target of C = the carrier' of C by FUNCT_2:def 1;
    hence cod f = cod g by A3,A6,FUNCT_1:47;
  end;
A7: dom the Comp of C = (dom the Comp of A) /\ [:the carrier' of C, the
  carrier' of C:] by A4,RELAT_1:61;
A8: now
    let f,g be Morphism of C;
    reconsider g9=g, f9=f as Morphism of A by TARSKI:def 3;
    assume dom g = cod f;
    then dom g9 = cod f by A5
      .= cod f9 by A5;
    then
A9: [g9,f9] in dom the Comp of A by CAT_1:def 6;
    [g,f] in [:the carrier' of C, the carrier' of C:] by ZFMISC_1:87;
    hence [g,f] in dom the Comp of C by A7,A9,XBOOLE_0:def 4;
  end;
A10: dom the Comp of C c= dom the Comp of A by A4,RELAT_1:60;
A11: C is Category-like
  proof
      let f,g be Morphism of C;
      reconsider g9=g, f9=f as Morphism of A by TARSKI:def 3;
      thus [g,f] in dom(the Comp of C) implies dom g=cod f
      proof
        assume
A12:    [g,f] in dom the Comp of C;
        thus dom g = dom g9 by A5
          .= cod f9 by A10,A12,CAT_1:def 6
          .= cod f by A5;
      end;
      thus thesis by A8;
   end;
A13: C is transitive
   proof
      let f,g be Morphism of C;
      reconsider g9=g, f9=f as Morphism of A by TARSKI:def 3;
      assume
A14:  dom g=cod f;
      [g,f] in dom the Comp of C by A14,A11;
      then
A15:    (the Comp of C).(g,f) = g(*)f by CAT_1:def 1;
A16:  dom g9 = cod f by A5,A14
        .= cod f9 by A5;
      then [g9,f9] in dom the Comp of A by CAT_1:def 6;
      then
A17:     (the Comp of A).(g9,f9) = g9(*)f9 by CAT_1:def 1;
A18:  (the Comp of C).(g,f) = (the Comp of A).(g9,f9) by A4,A8,A14,FUNCT_1:47;
      thus dom(g(*)f) =
        dom(g9(*)f9) by A5,A18,A15,A17
        .= dom f9 by A16,CAT_1:def 7
        .= dom f by A5;
      thus cod(g(*)f)
         = cod(g9(*)f9) by A5,A18,A15,A17
        .= cod g9 by A16,CAT_1:def 7
        .= cod g by A5;
   end;
A19:   for f,g being Morphism of C st cod g = dom f
     for ff,gg being Morphism of A st ff=f & gg=g
      holds f(*)g = ff(*)gg
     proof let f,g be Morphism of C such that
A20:    cod g = dom f;
      let ff,gg be Morphism of A such that
A21:    ff=f & gg=g;
A22:     cod gg = dom f by A20,A5,A21
          .= dom ff by A5,A21;
       [f,g] in dom the Comp of C by A20,A11;
      hence f(*)g = (the Comp of C).(f,g) by CAT_1:def 1
        .= (the Comp of A).(ff,gg) by A21,A4,A8,A20,FUNCT_1:47
        .= ff(*)gg by A22,CAT_1:16;
     end;
A23: C is associative
    proof
      let f,g,h be Morphism of C;
      reconsider g9=g, f9=f, h9=h as Morphism of A by TARSKI:def 3;
      assume that
A24:  dom h = cod g and
A25:  dom g = cod f;
      reconsider gf = (the Comp of C).(g,f), hg = (the Comp of C).[h,g] as
      Morphism of C by A8,A24,A25,PARTFUN1:4;
A26:  dom h9 = cod g by A5,A24
        .= cod g9 by A5;
      then
A27:  [h9,g9] in dom the Comp of A by CAT_1:def 6;
A28:  dom g9 = cod f by A5,A25
        .= cod f9 by A5;
      then
A29:     [g9,f9] in dom the Comp of A by CAT_1:def 6;
      reconsider gf9 = g9(*)f9, hg9 = h9(*)g9 as Morphism of A;
  (the Comp of C).(h,g) = (the Comp of A).(h9,g9) by A4,A8,A24,FUNCT_1:47;
      then
A30:    hg = h9(*)g9 by A27,CAT_1:def 1;
      then
A31:  dom hg = dom hg9 by A5
        .= dom g9 by A26,CAT_1:def 7
        .= cod f by A5,A25;
  (the Comp of C).(g,f) = (the Comp of A).(g9,f9) by A4,A8,A25,FUNCT_1:47;
      then
A32:  gf = gf9 by A29,CAT_1:def 1;
A33:   dom h = cod g9 by A5,A24
        .= cod gf9 by A28,CAT_1:def 7
        .= cod gf by A5,A32;
A34:    h(*)g = h9(*)g9 by A19,A24;
        g(*)f = g9(*)f9 by A19,A25;
       hence h(*)(g(*)f)
         = h9(*)(g9(*)f9) by A19,A33,A32
        .= h9(*)g9(*)f9 by A26,A28,CAT_1:def 8
        .= h(*)g(*)f by A19,A34,A30,A31;
   end;
A35: C is reflexive
    proof
    let b be Object of C;
    reconsider b9 = b as Object of A by TARSKI:def 3;
    reconsider ii = id b9 as Morphism of C by A1;
A36:  cod ii = cod id b9 by A5 .= b;
    dom ii = dom id b9 by A5 .= b;
    then ii in Hom(b,b) by A36;
    hence Hom(b,b)<>{};
   end;
A37: for a be Object of C, aa being Element of A st a = aa
    for m being Morphism of C st m = id aa
      for b being Object of C holds
     (Hom(a,b) <> {} implies
       for f being Morphism of a,b holds f(*)m = f)
   & (Hom(b,a) <> {} implies
     for f being Morphism of b,a holds m(*)f = f)
    proof let a be Object of C, aa be Element of A such that
A38:   a = aa;
     let  m be Morphism of C such that
A39:   m = id aa;
      let b be Object of C;
       reconsider bb = b as Object of A by TARSKI:def 3;
     thus Hom(a,b) <> {} implies
       for f being Morphism of a,b holds f(*)m = f
      proof assume
A40:     Hom(a,b) <> {};
       let f be Morphism of a,b;
        reconsider ff = f as Morphism of A by TARSKI:def 3;
      dom f = a by A40,CAT_1:5;
        then
A41:      dom ff = aa by A38,A5;
        dom f = cod id aa by A38,A40,CAT_1:5 .= cod m by A39,A5;
       hence f(*)m = ff(*)id aa by A19,A39
             .= f by A41,CAT_1:22;
      end;
     thus Hom(b,a) <> {} implies
     for f being Morphism of b,a holds m(*)f = f
      proof assume
A42:     Hom(b,a) <> {};
       let f be Morphism of b,a;
        reconsider ff = f as Morphism of A by TARSKI:def 3;
        cod f = a by A42,CAT_1:5;
        then
A43:      cod ff = aa by A38,A5;
        dom f = b by A42,CAT_1:5;
        then dom ff = bb by A5;
        then
A44:      ff in Hom(bb,aa) by A43;
        then reconsider ff as Morphism of bb,aa by CAT_1:def 5;
A45:       Hom(aa,aa) <> {};
        cod f = dom id aa by A38,A42,CAT_1:5 .= dom m by A39,A5;
       hence m(*)f = (id aa)(*)ff by A19,A39
             .= (id aa)*ff by A44,A45,CAT_1:def 13
             .= f by A44,CAT_1:28;
      end;
    end;
   C is with_identities
   proof
    let a be Element of C;
     reconsider aa = a as Element of A by TARSKI:def 3;
     reconsider m = id aa as Morphism of C by A1;
A46:  cod m = cod id aa by A5 .= a;
    dom m = dom id aa by A5 .= a;
    then m in Hom(a,a) by A46;
    then reconsider m as Morphism of a,a by CAT_1:def 5;
    take m;
    thus thesis by A37;
  end;
  then reconsider C as Category by A11,A13,A23,A35;
  C is Subcategory of A
  proof
    thus the carrier of C c= the carrier of A;
    thus for a,b being Object of C, a9,b9 being Object of A st a = a9 & b = b9
    holds Hom(a,b) c= Hom(a9,b9)
    proof
      let a,b be Object of C, a9,b9 be Object of A such that
A47:  a = a9 and
A48:  b = b9;
      let x be object;
      assume x in Hom(a,b);
      then consider f being Morphism of C such that
A49:  x = f and
A50:  dom f = a and
A51:  cod f = b;
      reconsider f9 = f as Morphism of A by TARSKI:def 3;
A52:  cod f9 = b9 by A5,A48,A51;
      dom f9 = a9 by A5,A47,A50;
      hence thesis by A49,A52;
    end;
    thus the Comp of C c= the Comp of A by A4,RELAT_1:59;
    let a be Object of C, a9 be Object of A;
    assume
A53:  a = a9;
     reconsider m = id a9 as Morphism of C by A1,A53;
A54:  cod m = cod id a9 by A5 .= a by A53;
    dom m = dom id a9 by A5 .= a by A53;
    then m in Hom(a,a) by A54;
    then reconsider m as Morphism of a,a by CAT_1:def 5;
      for b being Object of C holds
     (Hom(a,b) <> {} implies
       for f being Morphism of a,b holds f(*)m = f)
   & (Hom(b,a) <> {} implies
     for f being Morphism of b,a holds m(*)f = f) by A53,A37;
   hence id a = id a9 by CAT_1:def 12;
  end;
  hence thesis;
end;
