reserve S for OrderSortedSign;
reserve S for OrderSortedSign,
  X for ManySortedSet of S,
  o for OperSymbol of S ,
  b for Element of ([:the carrier' of S,{the carrier of S}:] \/ Union (coprod X
  ))*;
reserve x for set;

theorem Th5:
  for S be OrderSortedSign, X be non-empty ManySortedSet of S, o be
OperSymbol of S, x be set st x in ((ParsedTerms X)# * (the Arity of S)).o holds
  x is FinSequence of TS(DTConOSA(X))
proof
  let S be OrderSortedSign, X be non-empty ManySortedSet of S, o be OperSymbol
  of S, x be set;
  set D = DTConOSA(X), ar = the_arity_of o;
A1: (the Arity of S).o = ar by MSUALG_1:def 1;
  assume x in ((ParsedTerms X)# * (the Arity of S)).o;
  then x in product ((ParsedTerms X) * ar) by A1,MSAFREE:1;
  then consider f be Function such that
A2: x = f and
A3: dom f = dom ((ParsedTerms X) * ar) and
A4: for y be object st y in dom ((ParsedTerms X)* ar) holds f.y in ((
  ParsedTerms X) * ar).y by CARD_3:def 5;
A5: dom ((ParsedTerms X) * ar) = dom ar by PARTFUN1:def 2;
  dom ar = Seg len ar by FINSEQ_1:def 3;
  then reconsider f as FinSequence by A3,A5,FINSEQ_1:def 2;
  rng f c= TS D
  proof
    let a be object;
    assume a in rng f;
    then consider b be object such that
A6: b in dom f and
A7: f.b = a by FUNCT_1:def 3;
A8: a in ((ParsedTerms X) * ar).b by A3,A4,A6,A7;
    reconsider b as Nat by A6;
    ((ParsedTerms X) * ar).b = (ParsedTerms X).(ar.b) by A3,A6,FUNCT_1:12
      .= (ParsedTerms X). (ar/.b) by A3,A5,A6,PARTFUN1:def 6
      .= ParsedTerms(X,ar/.b) by Def8
      .= { s where s is Element of TS D: (ex s1 being Element of S,
   x be object
st s1 <= ar/.b & x in X.(s1) & s = root-tree [x,s1]) or ex o1 be OperSymbol of
    S st [o1,the carrier of S] = s.{} & the_result_sort_of o1 <= ar/.b};
    then ex e be Element of TS D st a = e &( (ex s1 being Element of S,
   x be object
    st s1 <= ar/.b & x in X.(s1) & e = root-tree [x,s1]) or ex o be OperSymbol
    of S st [o,the carrier of S] = e.{} & the_result_sort_of o <= ar/.b) by A8;
    hence thesis;
  end;
  then reconsider f as FinSequence of TS(D) by FINSEQ_1:def 4;
  f = x by A2;
  hence thesis;
end;
