reserve x, y, z for object,
  i, j, n for Nat,
  p, q, r for FinSequence,
  v for FinSequence of NAT;
reserve T,T9 for DecoratedTree,
  x,y for set;
reserve D1, D2 for non empty set,
  T for DecoratedTree of D1,D2,
  d1 for Element of D1,
  d2 for Element of D2,
  F for non empty DTree-set of D1,D2,
  F1 for non empty (DTree-set of D1),
  F2 for non empty DTree-set of D2;

theorem Th27:
  for D1,D2, d1,d2, F,F1
  for p being FinSequence of F, p1 being FinSequence of F1 st dom p1 = dom p &
  for i st i in dom p for T st T = p.i holds p1.i = T`1
  holds ([d1,d2]-tree p)`1 = d1-tree p1
proof
  let D1,D2, d1,d2, F,F1;
  let p be FinSequence of F, p1 be FinSequence of F1 such that
A1: dom p1 = dom p and
A2: for i st i in dom p for T st T = p.i holds p1.i = T`1;
  set W = [d1,d2]-tree p, W1 = d1-tree p1;
A3: len doms p = len p by TREES_3:38;
A4: len doms p1 = len p1 by TREES_3:38;
A5: len p = len p1 by A1,FINSEQ_3:29;
then A6: dom doms p = dom doms p1 by A3,A4,FINSEQ_3:29;
A7: dom doms p = dom p by A3,FINSEQ_3:29;
 now
    let i be Nat;
    assume
A8: i in dom p;
    then reconsider T = p.i as Element of F by Lm1;
A9: p1.i = T`1 by A2,A8;
A10: (doms p).i = dom T by A8,FUNCT_6:22;
 (doms p1).i = dom T`1 by A1,A8,A9,FUNCT_6:22;
    hence (doms p).i = (doms p1).i by A10,Th24;
  end;
then A11: doms p = doms p1 by A6,A7,FINSEQ_1:13;
 dom W`1 = dom W by Th24
    .= tree(doms p) by Th10;
  hence dom W`1 = dom W1 by A11,Th10;
  let x be Node of W`1;
  reconsider a = x as Node of W by Th24;
A12: W`1.x = (W.a)`1 by TREES_3:39;
  per cases;
  suppose
 x = {};
then  W.x = [d1,d2] & W1.x = d1 by Def4;
    hence thesis by A12;
  end;
  suppose
 x <> {};
    then consider n being Nat, T being DecoratedTree,
    q being Node of T such that
A13: n < len p and
A14: T = p.(n+1) and
A15: a = <*n*>^q by Th11;
    reconsider T as Element of F by A13,A14,Lm3;
    reconsider q as Node of T`1 by Th24;
A16: p1.(n+1) = T`1 by A2,A13,A14,Lm2;
A17: W.a = T.q by A13,A14,A15,Th12;
 W1.a = T`1.q by A5,A13,A15,A16,Th12;
    hence thesis by A12,A17,TREES_3:39;
  end;
end;
