reserve x,y,x1,x2,z for set,
  n,m,k for Nat,
  t1 for (DecoratedTree of [: NAT,NAT :]),
  w,s,t,u for FinSequence of NAT,
  D for non empty set;
reserve s9,w9,v9 for Element of NAT*;
reserve p,q for MP-variable;
reserve A,A1,B,B1,C,C1 for MP-wff;

theorem Th30:
  (A '&' B) = (A1 '&' B1) implies A = A1 & B = B1
proof
  set e = elementary_tree 2;
  set y = (e-->[2,0]) with-replacement (<*0*>,A);
  set y1 = (e-->[2,0]) with-replacement (<*0*>,A1);
  assume
A1: A '&' B = A1 '&' B1;
A2: <*1*> in e by TREES_1:28;
A3: <*0*> in e & dom (e --> [2,0]) = e by FUNCOP_1:13,TREES_1:28;
  then
A4: dom y1 = dom(e-->[2,0]) with-replacement (<*0*>,dom A1) by TREES_2:def 11;
  not <*1*> is_a_proper_prefix_of <*0*> by TREES_1:52;
  then
A5: <*0*> in dom(e-->[2,0]) with-replacement (<*1*>,dom B) by A2,A3,
TREES_1:def 9;
A6: not <*0*> is_a_proper_prefix_of <*1*> by TREES_1:52;
  then
A7: <*1*> in dom y1 by A2,A3,A4,TREES_1:def 9;
A8: dom y = dom(e-->[2,0]) with-replacement (<*0*>,dom A) by A3,TREES_2:def 11;
  then
A9: <*1*> in dom y by A2,A3,A6,TREES_1:def 9;
  then
A10: dom (A '&' B) = dom y with-replacement (<*1*>,dom B) by TREES_2:def 11;
A11: dom (A1 '&' B1) = dom y1 with-replacement (<*1*>,dom B1) by A7,
TREES_2:def 11;
  now
    let s;
    thus s in dom B implies s in dom B1
    proof
      assume s in dom B;
      then
A12:  <*1*>^s in dom(A1 '&' B1) by A1,A9,A10,TREES_1:def 9;
      now
        per cases;
        suppose
          s = {};
          hence thesis by TREES_1:22;
        end;
        suppose
          s <> {};
          then <*1*> is_a_proper_prefix_of <*1*>^s by TREES_1:10;
          then ex w st w in dom B1 & <*1*>^s = <*1*>^w by A7,A11,A12,
TREES_1:def 9;
          hence thesis by FINSEQ_1:33;
        end;
      end;
      hence thesis;
    end;
    assume s in dom B1;
    then
A13: <*1*>^s in dom(A '&' B) by A1,A7,A11,TREES_1:def 9;
    now
      per cases;
      suppose
        s = {};
        hence s in dom B by TREES_1:22;
      end;
      suppose
        s <> {};
        then <*1*> is_a_proper_prefix_of <*1*>^s by TREES_1:10;
        then ex w st w in dom B & <*1*>^s = <*1*>^w by A9,A10,A13,TREES_1:def 9
;
        hence s in dom B by FINSEQ_1:33;
      end;
    end;
    hence s in dom B;
  end;
  then
A14: dom B = dom B1 by TREES_2:def 1;
A15: for s st s in dom B holds B.s = B1.s
  proof
    let s;
    assume s in dom B;
    then
A16: <*1*>^s in dom(A1 '&' B1) by A1,A9,A10,TREES_1:def 9;
A17: <*1*> is_a_prefix_of <*1*>^s by TREES_1:1;
    then consider w such that
    w in dom B1 and
A18: <*1*>^s = <*1*>^w and
A19: (A1 '&' B1).(<*1*>^s) = B1.w by A7,A11,A16,TREES_2:def 11;
A20: ex u st u in dom B & <*1*>^s = <*1*>^u & (A '&' B).(<*1*>^s) = B.u by A1
,A9,A10,A16,A17,TREES_2:def 11;
    s = w by A18,FINSEQ_1:33;
    hence thesis by A1,A19,A20,FINSEQ_1:33;
  end;
  then
A21: B = B1 by A14,TREES_2:31;
A22: not <*0*>,<*1*> are_c=-comparable by TREES_1:5;
  then
A23: dom (A '&' B) = (dom(e-->[2,0]) with-replacement (<*1*>,dom B))
  with-replacement (<*0*>,dom A) by A2,A3,A8,A10,TREES_2:8;
A24: dom (A1 '&' B1) = (dom(e-->[2,0]) with-replacement (<*1*>,dom B))
  with-replacement (<*0*>,dom A1) by A22,A2,A3,A4,A11,A14,TREES_2:8;
  then
A25: dom A = dom A1 by A1,A5,A23,Th6;
  for s st s in dom A holds A.s = A1.s
  proof
    let s;
    assume
A26: s in dom A;
    then
A27: <*0*>^s in dom y by A3,A8,TREES_1:def 9;
A28: <*0*> is_a_prefix_of <*0*>^s by TREES_1:1;
    then
A29: ex w st w in dom A & <*0*>^s = <*0*>^w & y.(<*0*>^s) = A.w by A3,A8,A27,
TREES_2:def 11;
    <*0*>^s in dom y1 by A3,A4,A25,A26,TREES_1:def 9;
    then
A30: ex u st u in dom A1 & <*0*>^s = <*0*>^u & y1.(<*0*>^s) = A1.u by A3,A4,A28
,TREES_2:def 11;
    not <*1*> is_a_proper_prefix_of <*0*>^s by Th2;
    then
A31: <*0*>^s in dom (A '&' B) by A9,A10,A27,TREES_1:def 9;
    not ex w st w in dom B & <*0*>^s = <*1*>^w & (A '&' B).(<*0*>^s) = B.w
            by TREES_1:1,50;
    then (A '&' B).(<*0*>^s) = y.(<*0*> ^s) by A9,A10,A31,TREES_2:def 11;
    then
A32: A.s = (A1 '&' B).(<*0*>^s) by A1,A21,A29,FINSEQ_1:33;
    not ex w st w in dom B1 & <*0*>^s = <*1*>^w & (A1 '&' B1).(<*0*>^s) = B1.w
       by TREES_1:1,50;
    then (A1 '&' B1).(<*0*>^s) = y1.(<* 0*>^s) by A1,A7,A11,A31,TREES_2:def 11;
    hence thesis by A21,A32,A30,FINSEQ_1:33;
  end;
  hence thesis by A1,A5,A14,A23,A24,A15,Th6,TREES_2:31;
end;
