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 Th24:
  (((elementary_tree 2)-->[2,0]) with-replacement (<*0*>,A))
  with-replacement (<*1*>,B) is MP-wff
proof
  reconsider d =<*0*> as Element of elementary_tree 2 by TREES_1:28;
  set y = ((elementary_tree 2)-->[2,0]) with-replacement (<*0*>,A);
  set x = y with-replacement (<*1*>,B);
A1: not <*0*> is_a_proper_prefix_of <*1*>
  by TREES_1:3;
  reconsider db = dom B as finite Tree;
  reconsider da = dom A as finite Tree;
  <*0*> in elementary_tree 2 by TREES_1:28;
  then
A2: <*0*> in dom((elementary_tree 2)-->[2,0]) by FUNCOP_1:13;
  then @((elementary_tree 2) --> [2,0],<*0*>,A) = y by Def7;
  then reconsider y as DecoratedTree of [: NAT,NAT :];
A3: dom y = dom((elementary_tree 2)-->[2,0]) with-replacement (<*0*>,dom A)
  by A2,TREES_2:def 11;
  dom ((elementary_tree 2) --> [2,0]) = elementary_tree 2 by FUNCOP_1:13;
  then dom y = (elementary_tree 2) with-replacement(d,da) by TREES_2:def 11;
  then reconsider dy = dom y as finite Tree;
  <*1*> in elementary_tree 2 by TREES_1:28;
  then
A4: <*1*> in dom((elementary_tree 2)-->[2,0]) by FUNCOP_1:13;
  then
A5: <*1*> in dom y by A2,A3,A1,TREES_1:def 9;
  reconsider d1 = <*1*> as Element of dy by A2,A3,A4,A1,TREES_1:def 9;
  dom x = dy with-replacement (d1,db) & @(y,<*1*>,B) = x by A5,Def7,
TREES_2:def 11;
  then reconsider x as finite DecoratedTree of [: NAT,NAT :] by Lm2;
A6: dom x = dom y with-replacement (<*1*>,dom B) by A5,TREES_2:def 11;
  for v being Element of dom x holds branchdeg v <= 2 & (branchdeg v = 0
implies x .v = [0,0] or ex k st x .v = [3,k]) & (branchdeg v = 1 implies x .v =
  [1,0] or x .v = [1,1]) & (branchdeg v = 2 implies x .v = [2,0])
  proof
    set e = (elementary_tree 2)-->[2,0];
    let v be Element of dom x;
    now
      per cases by A5,A6,TREES_2:def 11;
      suppose
A7:     not <*1*> is_a_prefix_of v & x .v = y .v;
        then
A8:     not ex s st s in dom B & v = <*1*>^s by TREES_1:1;
        then
A9:     v in dom e with-replacement (<*0*>,dom A) by A3,A5,A6,TREES_1:def 9;
        now
          per cases by A2,A9,TREES_2:def 11;
          suppose
A10:        not <*0*> is_a_prefix_of v & y.v = e.v;
A11:        dom e = {{},<*0*>,<*1*>} by FUNCOP_1:13,TREES_1:53;
A12:        not ex s st s in dom A & v = <*0*>^s by A10,TREES_1:1;
            then
A13:        v in dom e by A2,A9,TREES_1:def 9;
            then
A14:        v = {} by A7,A10,A11,ENUMSET1:def 1;
            reconsider v9=v as Element of dom e by A2,A9,A12,TREES_1:def 9;
A15:        succ v = succ v9
            proof
              reconsider v99 = v as Element of dom y by A5,A6,A8,TREES_1:def 9;
              succ v99 = succ v9 by A2,A3,A14,Lm1,Th8;
              hence thesis by A5,A6,A14,Lm1,Th8;
            end;
            now
              let x be object;
              thus x in succ v9 implies x in {<*0*>,<*1*>}
              proof
                assume x in succ v9;
                then x in { v9^<*n*> : v9^<*n*> in dom e } by TREES_2:def 5;
                then consider n such that
A16:            x = v9^<*n*> and
A17:            v9^<*n*> in dom e;
                <*n*> in dom e by A14,A17,FINSEQ_1:34;
                then
A18:            <*n*> = {} or <*n*> = <*0*> or <*n*> = <*1*> by A11,
ENUMSET1:def 1;
                x = <*n*> by A14,A16,FINSEQ_1:34;
                hence thesis by A18,TARSKI:def 2;
              end;
              assume x in {<*0*>,<*1*>};
              then
A19:          x = <*0*> or x = <*1*> by TARSKI:def 2;
              now
                per cases by A14,A19,FINSEQ_1:34;
                suppose
A20:              x = v9^<*0*>;
                  then v9^<*0*> in dom e by A11,A19,ENUMSET1:def 1;
                  then x in { v9^<*n*> : v9^<*n*> in dom e } by A20;
                  hence x in succ v9 by TREES_2:def 5;
                end;
                suppose
A21:              x = v9^<*1*>;
                  then v9^<*1*> in dom e by A11,A19,ENUMSET1:def 1;
                  then x in { v9^<*n*> : v9^<*n*> in dom e } by A21;
                  hence x in succ v9 by TREES_2:def 5;
                end;
              end;
              hence x in succ v9;
            end;
            then
A22:        succ v9 = {<*0*>,<*1*>} by TARSKI:2;
            <*0*> <> <*1*> by TREES_1:3;
            then
A23:        2 = card succ v by A22,A15,CARD_2:57;
            hence branchdeg v <= 2 by TREES_2:def 12;
            v in elementary_tree 2 by A13;
            hence thesis by A7,A10,A23,FUNCOP_1:7,TREES_2:def 12;
          end;
          suppose
            ex s st s in dom A & v = <*0*>^s & y.v = A.s;
            then consider s such that
A24:        s in dom A and
A25:        v = <*0*>^s and
A26:        y.v = A.s;
            reconsider s as Element of dom A by A24;
            succ v,succ s are_equipotent
            proof
              reconsider v9=v as Element of dom y by A5,A6,A8,TREES_1:def 9;
              succ v9,succ s are_equipotent by A2,A3,A25,TREES_2:37;
              hence thesis by A5,A6,A25,Th1,Th9;
            end;
            then card succ v = card succ s by CARD_1:5;
            then
A27:        branchdeg v = card succ s by TREES_2:def 12;
A28:        branchdeg s <= 2 by Def5;
            hence branchdeg v <= 2 by A27,TREES_2:def 12;
A29:        branchdeg s = 1 implies A .s = [1,0] or A .s = [1,1] by Def5;
A30:        branchdeg s = 2 implies A .s = [2,0] by Def5;
            branchdeg s = 0 implies A .s = [0,0] or ex m st A .s = [3,m]
            by Def5;
            hence thesis by A7,A26,A28,A29,A30,A27,TREES_2:def 12;
          end;
        end;
        hence thesis;
      end;
      suppose
        ex s st s in dom B & v = <*1*>^s & x .v = B.s;
        then consider s such that
A31:    s in dom B and
A32:    v = <*1*>^s and
A33:    x .v = B.s;
        reconsider s as Element of dom B by A31;
        succ v,succ s are_equipotent by A5,A6,A32,TREES_2:37;
        then card succ v = card succ s by CARD_1:5;
        then
A34:    branchdeg v = card succ s by TREES_2:def 12;
A35:    branchdeg s = 2 implies B .s = [2,0] by Def5;
A36:    branchdeg s = 1 implies B .s = [1,0] or B .s = [1,1] by Def5;
A37:    branchdeg s = 0 implies B .s = [0,0] or ex m st B .s = [3,m] by Def5;
        branchdeg s <= 2 by Def5;
        hence thesis by A33,A37,A36,A35,A34,TREES_2:def 12;
      end;
    end;
    hence thesis;
  end;
  hence thesis by Def5;
end;
