reserve x,y,z for object, X,Y for set,
  i,k,n for Nat,
  p,q,r,s for FinSequence,
  w for FinSequence of NAT,
  f for Function;

theorem Th47:
  for T1,T2 being Tree, p being Element of T1 \/ T2 holds
  (p in T1 & p in T2 implies (T1 \/ T2)|p = (T1|p) \/ (T2|p)) &
  (not p in T1 implies (T1 \/ T2)|p = T2|p) &
  (not p in T2 implies (T1 \/ T2)|p = T1|p)
proof
  let T1,T2 be Tree, p be Element of T1 \/ T2;
  thus p in T1 & p in T2 implies (T1 \/ T2)|p = (T1|p) \/ (T2|p)
  proof
    assume that
A1: p in T1 and
A2: p in T2;
    let q be FinSequence of NAT;
    thus q in (T1 \/ T2)|p implies q in (T1|p) \/ (T2|p)
    proof
      assume q in (T1 \/ T2)|p;
      then p^q in T1 \/ T2 by TREES_1:def 6;
      then p^q in T1 or p^q in T2 by XBOOLE_0:def 3;
      then q in T1|p or q in T2|p by A1,A2,TREES_1:def 6;
      hence thesis by XBOOLE_0:def 3;
    end;
    assume q in (T1|p) \/ (T2|p);
    then q in T1|p or q in T2|p by XBOOLE_0:def 3;
    then p^q in T1 or p^q in T2 by A1,A2,TREES_1:def 6;
    then p^q in T1 \/ T2 by XBOOLE_0:def 3;
    hence thesis by TREES_1:def 6;
  end;
  for T1,T2 being Tree, p being Element of T1 \/ T2 st
  not p in T1 holds (T1 \/ T2)|p = T2|p
  proof
    let T1, T2 be Tree;
    let p be Element of T1 \/ T2;
    assume
A3: not p in T1;
    then
A4: p in T2 by XBOOLE_0:def 3;
    let q be FinSequence of NAT;
    thus q in (T1 \/ T2)|p implies q in T2|p
    proof
      assume q in (T1 \/ T2)|p;
      then p^q in T1 \/ T2 by TREES_1:def 6;
      then p^q in T1 or p^q in T2 by XBOOLE_0:def 3;
      hence thesis by A3,A4,TREES_1:21,def 6;
    end;
    assume q in T2|p;
    then p^q in T2 by A4,TREES_1:def 6;
    then p^q in T1 \/ T2 by XBOOLE_0:def 3;
    hence thesis by TREES_1:def 6;
  end;
  hence thesis;
end;
