reserve i for Nat,
  j for Element of NAT,
  X,Y,x,y,z for set;

theorem Th7:
  for S being non void Signature
  for X being non empty-yielding ManySortedSet of the carrier of S
  for t being Element of Free(S,X) holds
  (ex s being SortSymbol of S, v being set st
  t = root-tree [v,s] & v in X.s) or
  ex o being OperSymbol of S,
  p being FinSequence of Free(S,X) st
  t = [o,the carrier of S]-tree p & len p = len the_arity_of o &
  p is DTree-yielding &
  p is ArgumentSeq of Sym(o, X(\/)((the carrier of S)-->{0}))
proof
  let S be non void Signature;
  let X be non empty-yielding ManySortedSet of the carrier of S;
  let t be Element of Free(S,X);
  set V = X(\/)((the carrier of S)-->{0});
  reconsider t9 = t as Term of S,V by MSAFREE3:8;
  defpred P[set] means $1 is Element of Free(S,X) implies
  (ex s being SortSymbol of S, v being set st
  $1 = root-tree [v,s] & v in X.s) or
  ex o being OperSymbol of S,
  p being FinSequence of Free(S,X) st
  $1 = [o,the carrier of S]-tree p & len p = len the_arity_of o &
  p is DTree-yielding & p is ArgumentSeq of Sym(o,V);
A1: for s being SortSymbol of S, v being Element of V.s
  holds P[root-tree [v,s]]
  proof
    let s be SortSymbol of S;
    let v be Element of V.s;
    set t = root-tree [v,s];
    assume
A2: t is Element of Free(S,X);
    {} in dom t by TREES_1:22;
    then t.{} in rng t by FUNCT_1:3;
    then [v,s] in rng t by TREES_4:3;
    then v in X.s by A2,MSAFREE3:35;
    hence thesis;
  end;
A3: for o being OperSymbol of S, p being ArgumentSeq of Sym(o,V) st
  for t being Term of S,V st t in rng p holds P[t]
  holds P[[o,the carrier of S]-tree p]
  proof
    let o be OperSymbol of S;
    let p be ArgumentSeq of Sym(o,V) such that
    for t being Term of S,V st t in rng p holds P[t];
    set t = [o,the carrier of S]-tree p;
    assume t is Element of Free(S,X);
    then consider s being object such that
A4: s in dom the Sorts of Free(S,X) and
A5: t in (the Sorts of Free(S,X)).s by CARD_5:2;
    reconsider s as Element of S by A4;
A6: the Sorts of Free(S,X) = S-Terms(X,V) by MSAFREE3:24;
    the_sort_of(Sym(o,V)-tree p) = the_result_sort_of o by MSATERM:20;
    then s = the_result_sort_of o by A5,A6,MSAFREE3:17;
    then rng p c= Union (S-Terms(X,V)) by A5,A6,MSAFREE3:19;
    then
A7: p is FinSequence of Free(S,X) by A6,FINSEQ_1:def 4;
    len the_arity_of o = len p by MSATERM:22;
    hence thesis by A7;
  end;
  for t being Term of S,V holds P[t] from MSATERM:sch 1(A1,A3);
  then P[t9];
  hence thesis;
end;
