reserve I for set;
reserve S for non empty non void ManySortedSign,
  U0, U1 for non-empty MSAlgebra over S;

theorem Th21:
  for A being MSAlgebra over S, C being MSSubAlgebra of A for D
  being ManySortedSubset of the Sorts of A st D = the Sorts of C for h being
ManySortedFunction of A, U0 for g being ManySortedFunction of C, U0 st g = h ||
D for o being OperSymbol of S, x being Element of Args(o,A) for y being Element
  of Args(o,C) st Args(o,C) <> {} & x = y holds h#x = g#y
proof
  let A be MSAlgebra over S, C be MSSubAlgebra of A, D be ManySortedSubset of
  the Sorts of A such that
A1: D = the Sorts of C;
  let h be ManySortedFunction of A, U0, g be ManySortedFunction of C, U0 such
  that
A2: g = h || D;
  let o be OperSymbol of S, x be Element of Args(o,A);
  let y be Element of Args(o,C) such that
A3: Args(o,C) <> {} and
A4: x = y;
  set hx = h#x, gy = g#y;
  set ar = the_arity_of o;
A5: y in Args(o,A) by A3,Th18;
  then reconsider xx = x, yy = y as Function by MSUALG_6:1;
A6: dom yy = dom ar by A3,MSUALG_3:6;
A7: dom xx = dom ar by A5,MSUALG_3:6;
A8: now
    let n be object;
    assume
A9: n in dom ar;
    then reconsider n9=n as Nat;
    reconsider hn = h.(ar.n) as Function of (the Sorts of A).(ar.n), (the
    Sorts of U0).(ar.n) by A9,PARTFUN1:4,PBOOLE:def 15;
    ar.n in the carrier of S by A9,PARTFUN1:4;
    then
A10: g.(ar.n9) = hn | (D.(ar.n)) by A2,MSAFREE:def 1;
    dom ((the Sorts of C)*(the_arity_of o)) = dom ar by PARTFUN1:def 2;
    then xx.n in ((the Sorts of C) * ar).n by A3,A4,A9,MSUALG_3:6;
    then
A11: xx.n in D.(ar.n) by A1,A9,FUNCT_1:13;
    thus hx.n = hx.n9 .= (h.(ar/.n)).(xx.n) by A5,A7,A9,MSUALG_3:24
      .= (h.(ar.n)).(xx.n) by A9,PARTFUN1:def 6
      .= (g.(ar.n)).(xx.n) by A10,A11,FUNCT_1:49
      .= (g.(ar/.n)).(yy.n) by A4,A9,PARTFUN1:def 6
      .= gy.n9 by A3,A6,A9,MSUALG_3:24
      .= gy.n;
  end;
  dom hx = dom ar & dom gy = dom ar by MSUALG_3:6;
  hence thesis by A8,FUNCT_1:2;
end;
