
theorem Th40:
  for T being _Tree for a, b, c, d being Vertex of T for P1, P2
  being Path of T st P1 = T.pathBetween(a,b) & P2 = T.pathBetween(a,c) & not P1
  is_a_prefix_of P2 & not P2 is_a_prefix_of P1 & d = P1.len maxPrefix(P1,P2)
holds (T.pathBetween(d,b)).vertices() /\ (T.pathBetween(d,c)).vertices() = {d}
proof
  let T being _Tree;
  let a, b, c, d being Vertex of T;
  let P1, P2 being Path of T such that
A1: P1 = T.pathBetween(a,b) and
A2: P2 = T.pathBetween(a,c) and
A3: not P1 c= P2 and
A4: not P2 c= P1 and
A5: d = P1.len maxPrefix(P1,P2);
  set Pad = T.pathBetween(a,d);
  set di = len maxPrefix(P1,P2);
A6: P1.first() = a by A1,Th28;
A7: P2.first() = a by A2,Th28;
  then reconsider di as odd Element of NAT by A6,Th22;
A8: di <= di+2 by NAT_1:11;
  set Pdb = T.pathBetween(d,b);
A9: Pdb.first() = d by Th28;
  set Pdc = T.pathBetween(d,c);
A10: d = P2.len maxPrefix(P1,P2) by A5,Th7;
A11: di <= di+2 by NAT_1:11;
  di+2 <= len P2 by A4,A6,A7,Th23;
  then di <= len P2 by A11,XXREAL_0:2;
  then d in P2.vertices() by A10,GLIB_001:87;
  then
A12: P2 = Pad.append(Pdc) by A2,Th36;
A13: Pad.last() = d by Th28;
A14: Pdc.1 = Pdc.first() .= d by Th28;
A15: Pdc.first() = d by Th28;
  di+2 <= len P1 by A3,A6,A7,Th23;
  then
A16: di <= len P1 by A8,XXREAL_0:2;
  then d in P1.vertices() by A5,GLIB_001:87;
  then
A17: P1 = Pad.append(Pdb) by A1,Th36;
A18: 1 <= di by ABIAN:12;
  then Pad = P1.cut(2*0+1,di) by A5,A6,A16,Th35;
  then
A19: len Pad + ((2*0)+1) = di + 1 by A16,A18,GLIB_001:36;
A20: Pdb.1 = Pdb.first() .= d by Th28;
  thus Pdb.vertices() /\ Pdc.vertices() = {d}
  proof
    hereby
      assume not Pdb.vertices() /\ Pdc.vertices() c= {d};
      then consider e being object such that
A21:  e in Pdb.vertices() /\ Pdc.vertices() and
A22:  not e in {d};
A23:  e in Pdb.vertices() by A21,XBOOLE_0:def 4;
A24:  e in Pdc.vertices() by A21,XBOOLE_0:def 4;
      reconsider e as Vertex of T by A21;
      consider ebi be odd Element of NAT such that
A25:  ebi <= len Pdb and
A26:  e = Pdb.ebi by A23,GLIB_001:87;
      set Pdeb = Pdb.cut(1,ebi);
      1 <= ebi & 2*0+1 is odd Element of NAT by ABIAN:12;
      then
A27:  Pdeb is_Walk_from d, e by A20,A25,A26,GLIB_001:37;
      1 < len Pdeb
      proof
        assume
A28:    1 >= len Pdeb;
        per cases by A28,NAT_1:25;
        suppose
          len Pdeb = 2*0;
          hence contradiction;
        end;
        suppose
A29:      len Pdeb = 1;
A30:      Pdeb.1 = d by A27;
          Pdeb.1 = e by A27,A29;
          hence contradiction by A22,A30,TARSKI:def 1;
        end;
      end;
      then
A31:  (2*0+1)+2 <= len Pdeb by CHORD:4;
      then
A32:  2 < len Pdeb by XXREAL_0:2;
      consider eci be odd Element of NAT such that
A33:  eci <= len Pdc and
A34:  e = Pdc.eci by A24,GLIB_001:87;
      set Pdec = Pdc.cut(1,eci);
      1 <= eci & 2*0+1 is odd Element of NAT by ABIAN:12;
      then
A35:  Pdec is_Walk_from d, e by A14,A33,A34,GLIB_001:37;
      1 < len Pdec
      proof
        assume
A36:    1 >= len Pdec;
        per cases by A36,NAT_1:25;
        suppose
          len Pdec = 2*0;
          hence contradiction;
        end;
        suppose
A37:      len Pdec = 1;
A38:      Pdec.1 = d by A35;
          Pdec.1 = e by A35,A37;
          hence contradiction by A22,A38,TARSKI:def 1;
        end;
      end;
      then
A39:  (2*0+1)+2 <= len Pdec by CHORD:4;
      then
A40:  2 < len Pdec by XXREAL_0:2;
      1+2 in dom Pdeb by A31,FINSEQ_3:25;
      then
A41:  Pdeb.(1+2) = Pdb.(1+2) by A25,GLIB_001:46;
      len Pdeb <= len Pdb by Th10;
      then 2 < len Pdb by A32,XXREAL_0:2;
      then
A42:  P1.(di+2) = Pdb.(1+2) by A9,A13,A17,A19,GLIB_001:33;
      len Pdec <= len Pdc by Th10;
      then 2 < len Pdc by A40,XXREAL_0:2;
      then
A43:  P2.(di+2) = Pdc.(1+2) by A15,A13,A12,A19,GLIB_001:33;
A44:  1+2 in dom Pdec by A39,FINSEQ_3:25;
      Pdeb.(1+2) = Pdec.(1+2) by A27,A35,Th27;
      hence contradiction by A3,A4,A6,A7,A33,A42,A41,A43,A44,Th24,GLIB_001:46;
    end;
    d in Pdb.vertices() & d in Pdc.vertices() by A9,A15,GLIB_001:88;
    then d in Pdb.vertices() /\ Pdc.vertices() by XBOOLE_0:def 4;
    hence thesis by ZFMISC_1:31;
  end;
end;
