
theorem Th8:
  for T1,T2 being Tree holds T1 is binary & T2 is binary iff tree(
  T1,T2) is binary
proof
  let T1,T2 be Tree;
  set RT = tree(T1,T2);
  hereby
    assume that
A1: T1 is binary and
A2: T2 is binary;
    now
      let t be Element of RT;
      assume
A3:   not t in Leaves RT;
      per cases by TREES_3:68;
      suppose
        t = {};
        hence succ t = { t^<*0*>, t^<*1*> } by Th7;
      end;
      suppose
        ex p being FinSequence st p in T1 & t = <*0*>^p or p in T2 & t
        = <*1*>^p;
        then consider p being FinSequence such that
A4:     p in T1 & t = <*0*>^p or p in T2 & t = <*1*>^p;
A5:     now
          assume that
A6:       p in T2 and
A7:       t = <*1*>^p;
          reconsider p as Element of T2 by A6;
          per cases;
          suppose
            p in Leaves T2;
            hence succ t = { t^<*0*>, t^<*1*> } by A3,A7,Th6;
          end;
          suppose
            not p in Leaves T2;
            then
A8:         succ p = { p^<*0*>, p^<*1*> } by A2;
            now
              let x be object;
              hereby
                assume
A9:             x in succ t;
                then x in { t^<*n*> where n is Nat : t^<*n*> in RT
                } by TREES_2:def 5;
                then consider n being Nat such that
A10:            x = t^<*n*> and
A11:            t^<*n*> in RT;
A12:            x = <*1*>^(p^<*n*>) by A7,A10,FINSEQ_1:32;
                then reconsider pn = p^<*n*> as Element of T2 by A10,A11,
TREES_3:70;
                pn in succ p by A7,A9,A12,Th7;
                then pn = p^<*0*> or pn = p^<*1*> by A8,TARSKI:def 2;
                then x = t^<*0*> or x = t^<*1*> by A10,FINSEQ_1:33;
                hence x in { t^<*0*>, t^<*1*> } by TARSKI:def 2;
              end;
              assume x in { t^<*0*>, t^<*1*> };
              then x = <*1*>^p^<*0*> or x = <*1*>^p^<*1*> by A7,TARSKI:def 2;
              then
A13:          x = <*1*>^(p^<*0*>) or x = <*1*>^(p^<*1*>) by FINSEQ_1:32;
              p^<*0*> in succ p & p^<*1*> in succ p by A8,TARSKI:def 2;
              hence x in succ t by A7,A13,Th7;
            end;
            hence succ t = { t^<*0*>, t^<*1*> } by TARSKI:2;
          end;
        end;
        now
          assume that
A14:      p in T1 and
A15:      t = <*0*>^p;
          reconsider p as Element of T1 by A14;
          per cases;
          suppose
            p in Leaves T1;
            hence succ t = { t^<*0*>, t^<*1*> } by A3,A15,Th6;
          end;
          suppose
            not p in Leaves T1;
            then
A16:        succ p = { p^<*0*>, p^<*1*> } by A1;
            now
              let x be object;
              hereby
                assume
A17:            x in succ t;
                then x in { t^<*n*> where n is Nat : t^<*n*> in RT
                } by TREES_2:def 5;
                then consider n being Nat such that
A18:            x = t^<*n*> and
A19:            t^<*n*> in RT;
A20:            x = <*0*>^(p^<*n*>) by A15,A18,FINSEQ_1:32;
                then reconsider pn = p^<*n*> as Element of T1 by A18,A19,
TREES_3:69;
                pn in succ p by A15,A17,A20,Th7;
                then pn = p^<*0*> or pn = p^<*1*> by A16,TARSKI:def 2;
                then x = t^<*0*> or x = t^<*1*> by A18,FINSEQ_1:33;
                hence x in { t^<*0*>, t^<*1*> } by TARSKI:def 2;
              end;
              assume x in { t^<*0*>, t^<*1*> };
              then x = <*0*>^p^<*0*> or x = <*0*>^p^<*1*> by A15,TARSKI:def 2;
              then
A21:          x = <*0*>^(p^<*0*>) or x = <*0*>^(p^<*1*>) by FINSEQ_1:32;
              p^<*0*> in succ p & p^<*1*> in succ p by A16,TARSKI:def 2;
              hence x in succ t by A15,A21,Th7;
            end;
            hence succ t = { t^<*0*>, t^<*1*> } by TARSKI:2;
          end;
        end;
        hence succ t = { t^<*0*>, t^<*1*> } by A4,A5;
      end;
    end;
    hence tree(T1,T2) is binary;
  end;
  assume
A22: RT is binary;
  now
    let t be Element of T1;
    reconsider zt = <*0*>^t as Element of RT by TREES_3:69;
    assume not t in Leaves T1;
    then not zt in Leaves RT by Th6;
    then
A23: succ zt = { <*0*>^t^<*0*>, <*0*>^t^<*1*> } by A22;
A24: succ zt = {zt^<*n*> where n is Nat:zt^<*n*> in RT} by
TREES_2:def 5;
    now
      let x be object;
      hereby
        assume x in succ t;
        then
x in { t^<*n*> where n is Nat : t^<*n*> in T1 } by TREES_2:def 5;
        then consider n being Nat such that
A25:    x = t^<*n*> and
A26:    t^<*n*> in T1;
        <*0*>^(t^<*n*>) in RT by A26,TREES_3:69;
        then zt^<*n*> in RT by FINSEQ_1:32;
        then zt^<*n*> in {zt^<*k*> where k is Nat:zt^<*k*> in RT};
        then zt^<*n*> = zt^<*0*> or zt^<*n*> = zt^<*1*> by A23,A24,TARSKI:def 2
;
        then x = t^<*0*> or x = t^<*1*> by A25,FINSEQ_1:33;
        hence x in { t^<*0*>, t^<*1*> } by TARSKI:def 2;
      end;
      assume x in { t^<*0*>, t^<*1*> };
      then
A27:  x = t^<*0*> or x = t^<*1*> by TARSKI:def 2;
      <*0*>^t^<*1*> in succ zt by A23,TARSKI:def 2;
      then
A28:  <*0*>^(t^<*1*>) in succ zt by FINSEQ_1:32;
      <*0*>^t^<*0*> in succ zt by A23,TARSKI:def 2;
      then <*0*>^(t^<*0*>) in succ zt by FINSEQ_1:32;
      hence x in succ t by A27,A28,Th7;
    end;
    hence succ t = { t^<*0*>, t^<*1*> } by TARSKI:2;
  end;
  hence T1 is binary;
  now
    let t be Element of T2;
    reconsider zt = <*1*>^t as Element of RT by TREES_3:70;
    assume not t in Leaves T2;
    then not zt in Leaves RT by Th6;
    then
A29: succ zt = { <*1*>^t^<*0*>, <*1*>^t^<*1*> } by A22;
A30: succ zt = {zt^<*n*> where n is Nat:zt^<*n*> in RT} by
TREES_2:def 5;
    now
      let x be object;
      hereby
        assume x in succ t;
        then
x in { t^<*n*> where n is Nat : t^<*n*> in T2 } by TREES_2:def 5;
        then consider n being Nat such that
A31:    x = t^<*n*> and
A32:    t^<*n*> in T2;
        <*1*>^(t^<*n*>) in RT by A32,TREES_3:70;
        then zt^<*n*> in RT by FINSEQ_1:32;
        then zt^<*n*> in {zt^<*k*> where k is Nat:zt^<*k*> in RT};
        then zt^<*n*> = zt^<*0*> or zt^<*n*> = zt^<*1*> by A29,A30,TARSKI:def 2
;
        then x = t^<*0*> or x = t^<*1*> by A31,FINSEQ_1:33;
        hence x in { t^<*0*>, t^<*1*> } by TARSKI:def 2;
      end;
      assume x in { t^<*0*>, t^<*1*> };
      then
A33:  x = t^<*0*> or x = t^<*1*> by TARSKI:def 2;
      <*1*>^t^<*1*> in succ zt by A29,TARSKI:def 2;
      then
A34:  <*1*>^(t^<*1*>) in succ zt by FINSEQ_1:32;
      <*1*>^t^<*0*> in succ zt by A29,TARSKI:def 2;
      then <*1*>^(t^<*0*>) in succ zt by FINSEQ_1:32;
      hence x in succ t by A33,A34,Th7;
    end;
    hence succ t = { t^<*0*>, t^<*1*> } by TARSKI:2;
  end;
  hence thesis;
end;
