
theorem Th13:
  for X being non empty set, S being non empty FinSequence of NAT
  ex A being Universal_Algebra st the carrier of A = X & signature A = S
proof
  let X be non empty set;
  let S be non empty FinSequence of NAT;
A1: dom S = Seg len S by FINSEQ_1:def 3;
  set x = the Element of X;
  defpred P[object,object] means
  ex i,j being Nat st $1 = i & j = S.i & $2 = (j-tuples_on X)--> x;
A2: for y being object st y in dom S ex z being object st P[y,z]
  proof
    let y be object;
    assume y in dom S;
    then reconsider i = y as Element of NAT;
    reconsider j = S.i as Element of NAT;
    take (j-tuples_on X)--> x, i, j;
    thus thesis;
  end;
  consider ch being Function such that
A3: dom ch = dom S & for y being object st y in dom S holds P[y,ch.y]
  from CLASSES1:sch 1(A2);
  reconsider ch as FinSequence by A1,A3,FINSEQ_1:def 2;
  rng ch c= PFuncs(X*,X)
  proof
    let y be object;
    assume y in rng ch;
    then consider xi being object such that
A4: xi in dom ch and
A5: y = ch.xi by FUNCT_1:def 3;
    consider i,j being Nat such that
    xi = i and j = S.i and
A6: y = (j-tuples_on X)--> x by A3,A4,A5;
A7: dom ((j-tuples_on X)--> x) = (j-tuples_on X) by FUNCOP_1:13;
    rng ((j-tuples_on X)--> x) c= {x} by FUNCOP_1:13;
    hence thesis by A6,A7,PARTFUN1:def 3;
  end;
  then reconsider ch as PFuncFinSequence of X by FINSEQ_1:def 4;
  set A = UAStr(#X,ch#);
A8: A is quasi_total
  proof
    let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
    assume that
A9: n in dom the charact of A and
A10: h = (the charact of A).n;
    ex i,j being Nat st n = i & j = S.i & h = (j-tuples_on X)--> x by A3,A9,A10
;
    hence thesis;
  end;
A11: A is non-empty
  proof
    thus the charact of A <> {} by A3;
    assume {} in rng the charact of A;
    then consider a being object such that
A12: a in dom ch and
A13: {} = ch.a by FUNCT_1:def 3;
    ex i,j being Nat st a = i & j = S.i & {} = (j-tuples_on X)--> x by A3,A12
,A13;
    hence thesis;
  end;
  A is partial
  proof
    let n be Nat, h be PartFunc of (the carrier of A)*, the carrier of A;
    assume that
A14: n in dom the charact of A and
A15: h = (the charact of A).n;
    ex i,j being Nat st n = i & j = S.i & h = (j-tuples_on X)--> x by A3,A14
,A15;
    hence thesis;
  end;
  then reconsider A as Universal_Algebra by A8,A11;
  take A;
  thus the carrier of A = X;
A16: len ch = len S by A3,FINSEQ_3:29;
  now
    let n be Nat such that
A17: n in dom S;
    let h be homogeneous non empty PartFunc of (the carrier of A)*,
    the carrier of A;
    assume h = (the charact of A).n;
    then consider i,j being Nat such that
A18: n = i and
A19: j = S.i and
A20: h = (j-tuples_on X)--> x by A3,A17;
    set z = the Element of j-tuples_on X;
A21: dom h = j-tuples_on X by A20,FUNCOP_1:13;
    len z = j by CARD_1:def 7;
    hence S.n = arity h by A18,A19,A21,MARGREL1:def 25;
  end;
  hence thesis by A16,UNIALG_1:def 4;
end;
