
theorem Th1:
  for S being non empty non void ManySortedSign
  for A being non-empty MSAlgebra over S for V being Variables of A
  for t being Term of S,V, T being c-Term of A,V st T = t
  holds the_sort_of T = the_sort_of t
proof
  let S being non empty non void ManySortedSign;
  let A being non-empty MSAlgebra over S;
  let V being Variables of A;
  defpred P[set] means for t9 being Term of S,V, T being c-Term of A,V
  st t9 = $1 & T = t9 holds the_sort_of T = the_sort_of t9;
A1: for s being SortSymbol of S, v being Element of V.s holds
  P[root-tree [v,s]]
  proof
    let s being SortSymbol of S, v being Element of V.s;
    let t be Term of S,V, T be c-Term of A,V;
    assume that
A2: t = root-tree [v,s] and
A3: T = t;
    the_sort_of t = s by A2,MSATERM:14;
    hence thesis by A2,A3,MSATERM:16;
  end;
A4: for o being OperSymbol of S, p being ArgumentSeq of Sym(o,V) st
  for t9 being Term of S,V st t9 in rng p holds P[t9] holds
  P[[o,the carrier of S]-tree p]
  proof
    let o being OperSymbol of S;
    let p being ArgumentSeq of Sym(o,V);
    assume for t9 being Term of S,V st t9 in rng p
    for t being Term of S,V, T being c-Term of A,V
    st t = t9 & T = t holds the_sort_of T = the_sort_of t;
    let t being Term of S,V, T being c-Term of A,V;
    assume t = [o,the carrier of S]-tree p;
    then
A5: t.{} = [o,the carrier of S] by TREES_4:def 4;
    then the_sort_of t = the_result_sort_of o by MSATERM:17;
    hence thesis by A5,MSATERM:17;
  end;
  for t being Term of S,V holds P[t] from MSATERM:sch 1(A1,A4);
  hence thesis;
end;
