reserve I for non empty set;
reserve M for ManySortedSet of I;
reserve Y,x,y,y1,i,j for set;
reserve k for Element of NAT;
reserve p for FinSequence;
reserve S for non void non empty ManySortedSign;
reserve A for non-empty MSAlgebra over S;

theorem Th11:
  for B be Subset of CongrLatt A holds "/\" (B,EqRelLatt the Sorts
  of A) is MSCongruence of A
proof
  set M = the Sorts of A;
  set E = EqRelLatt M;
  set C = CongrLatt A;
  let B be Subset of C;
  set d9 = "/\" (B,E);
  reconsider d = d9 as Equivalence_Relation of the Sorts of A by MSUALG_5:def 5
;
  reconsider d as MSEquivalence-like ManySortedRelation of A by MSUALG_4:def 3;
  the carrier of C c= the carrier of E by NAT_LAT:def 12;
  then reconsider B1 = B as Subset of E by XBOOLE_1:1;
  reconsider B1 as SubsetFamily of [|M,M|] by MSUALG_7:5;
  per cases;
  suppose
    B is empty;
    then reconsider B9 = B as empty Subset of CongrLatt A;
    for q being Element of E st q in B9 holds Top E [= q;
    then
A1: Top E is_less_than B by LATTICE3:def 16;
    for b be Element of E st b is_less_than B holds b [= Top E by LATTICES:19;
    then "/\" (B,E) = Top E by A1,LATTICE3:34
      .= [|M,M|] by MSUALG_7:4;
    hence thesis by MSUALG_5:18;
  end;
  suppose
A2: B is non empty;
    for o be OperSymbol of S, x,y be Element of Args(o,A) st (for n be Nat
st n in dom x holds [x.n,y.n] in d.((the_arity_of o)/.n)) holds [Den(o,A).x,Den
    (o,A).y] in d.(the_result_sort_of o)
    proof
      reconsider B19 = B1 as non empty SubsetFamily of [|M,M|] by A2;
      reconsider m = meet |:B1:| as Equivalence_Relation of M by A2,MSUALG_7:8;
      let o be OperSymbol of S;
      let x,y be Element of Args(o,A);
A3:   |:B19:| is non-empty;
      assume
A4:   for n be Nat st n in dom x holds [x.n,y.n] in d.((the_arity_of o )/.n);
A5:   now
        let q be MSCongruence of A;
        assume
A6:     q in B;
        now
          let n be Nat;
          assume n in dom x;
          then [x.n,y.n] in d.((the_arity_of o)/.n) by A4;
          then
A7:       [x.n,y.n] in m.((the_arity_of o)/.n) by A2,MSUALG_7:10;
          m c= q by A6,MSUALG_7:7;
          then m.((the_arity_of o)/.n) c= q.((the_arity_of o)/.n) by
PBOOLE:def 2;
          hence [x.n,y.n] in q.((the_arity_of o)/.n) by A7;
        end;
        hence [Den(o,A).x,Den(o,A).y] in q.(the_result_sort_of o) by
MSUALG_4:def 4;
      end;
A8:   |:B1:|.(the_result_sort_of o) = { x1.(the_result_sort_of o) where
      x1 is Element of Bool [|M,M|] : x1 in B } by A2,CLOSURE2:14;
      now
        let Y be set;
        assume Y in |:B1:|.(the_result_sort_of o);
        then consider z be Element of Bool [|M,M|] such that
A9:     Y = z.(the_result_sort_of o) and
A10:    z in B by A8;
        reconsider z9 = z as MSCongruence of A by A10,MSUALG_5:def 6;
        [Den(o,A).x,Den(o,A).y] in z9.(the_result_sort_of o) by A5,A10;
        hence [Den(o,A).x,Den(o,A).y] in Y by A9;
      end;
      then (ex Q be Subset-Family of ([|M,M|].(the_result_sort_of o)) st Q =
|:B1:|.( the_result_sort_of o) & m.(the_result_sort_of o) = Intersect Q )& [Den
      (o,A).x,Den(o,A).y] in meet (|:B1:|.(the_result_sort_of o)) by A3,
MSSUBFAM:def 1,SETFAM_1:def 1;
      then [Den(o,A).x,Den(o,A).y] in m.(the_result_sort_of o) by A3,
SETFAM_1:def 9;
      hence thesis by A2,MSUALG_7:10;
    end;
    hence thesis by MSUALG_4:def 4;
  end;
end;
