
theorem Th4:
  for I being non empty set, J being TopStruct-yielding non-Empty
ManySortedSet of I, i being Element of I, P being Subset of J.i holds proj(J,i)
  "P = product ((Carrier J) +* (i,P))
proof
  let I be non empty set, J be TopStruct-yielding non-Empty ManySortedSet of I,
  i be Element of I, P be Subset of J.i;
  set f = (Carrier J) +* (i,P);
A1: dom Carrier J = I by PARTFUN1:def 2;
A2: dom f = dom Carrier J by FUNCT_7:30
    .= I by PARTFUN1:def 2;
A3: product f c= proj(J,i)"P
  proof
    let x be object;
    assume x in product f;
    then consider g being Function such that
A4: x = g and
A5: dom g = dom f and
A6: for y being object st y in dom f holds g.y in f.y by CARD_3:def 5;
A7: for j being object st j in dom Carrier J holds g.j in (Carrier J).j
    proof
      let j be object;
      assume j in dom Carrier J;
      then
A8:   j in I;
      then
A9:   ex R being 1-sorted st R = J.j & (Carrier J).j = the carrier of R by
PRALG_1:def 15;
      per cases;
      suppose
A10:    j = i;
        f.i = P by A1,FUNCT_7:31;
        then g.j in P by A2,A6,A10;
        hence thesis by A9,A10;
      end;
      suppose
        j <> i;
        then f.j = (Carrier J).j by FUNCT_7:32;
        hence thesis by A2,A6,A8;
      end;
    end;
    dom g = dom Carrier J by A5,FUNCT_7:30;
    then
A11: g in product Carrier J by A7,CARD_3:9;
    then
A12: g in dom proj(Carrier J,i) by CARD_3:def 16;
    f.i = P by A1,FUNCT_7:31;
    then g.i in P by A2,A6;
    then
A13: proj(Carrier J,i).g in P by A12,CARD_3:def 16;
    g in dom proj(J,i) by A11,CARD_3:def 16;
    hence thesis by A4,A13,FUNCT_1:def 7;
  end;
  proj(J,i)"P c= product f
  proof
    let x be object;
    assume
A14: x in proj(J,i)"P;
    then
A15: x in dom proj(Carrier J,i) by FUNCT_1:def 7;
    then x in product Carrier J;
    then consider g being Function such that
A16: x = g and
A17: dom g = dom Carrier J and
A18: for y being object st y in dom Carrier J holds g.y in (Carrier J).y
    by CARD_3:def 5;
A19: dom g = dom f by A17,FUNCT_7:30;
    for j being object st j in dom f holds g.j in f.j
    proof
      let j be object;
      assume j in dom f;
      then
A20:  g.j in (Carrier J).j by A17,A18,A19;
      per cases;
      suppose
A21:    i = j;
        proj(Carrier J,i).x = g.i by A15,A16,CARD_3:def 16;
        then g.i in P by A14,FUNCT_1:def 7;
        hence thesis by A1,A21,FUNCT_7:31;
      end;
      suppose
        i <> j;
        hence thesis by A20,FUNCT_7:32;
      end;
    end;
    hence thesis by A16,A19,CARD_3:def 5;
  end;
  hence thesis by A3;
end;
