
theorem Th38: :: TopPath02
  for G being _Graph, W being Walk of G ex P being Path of G st
    P is_Walk_from W.first(),W.last() & P is minlength
proof
  let G being _Graph, W being Walk of G;
  set X = { len P where P is Path of G : P is_Walk_from W.first(),W.last() };
  set T = the Path-like Subwalk of W;
A1: T.last() = W.last() by GLIB_001:161;
  T.first() = W.first() by GLIB_001:161;
  then T is_Walk_from W.first(),W.last() by A1;
  then
A2: len T in X;
  X c= NAT
  proof
    let x be object;
    assume x in X;
    then
    ex P being Path of G st x = len P & P is_Walk_from W.first(),W .last();
    hence thesis;
  end;
  then reconsider X as non empty Subset of NAT by A2;
  min X in X by XXREAL_2:def 7;
  then consider P being Path of G such that
A3: len P = min X and
A4: P is_Walk_from W.first(),W.last();
A5: P.first() = W.first() by A4;
  take P;
  thus P is_Walk_from W.first(),W.last() by A4;
  let W2 be Walk of G such that
A6: W2 is_Walk_from P.first(),P.last();
A7: P.last() = W2.last() by A6;
  set T = the Path-like Subwalk of W2;
A8: T.first() = W2.first() by GLIB_001:161;
A9: T.last() = W2.last() by GLIB_001:161;
A10: P.last() = W.last() by A4;
  P.first() = W2.first() by A6;
  then T is_Walk_from W.first(),W.last() by A7,A5,A10,A8,A9;
  then len T in X;
  then
A11: len P <= len T by A3,XXREAL_2:def 7;
  len T <= len W2 by GLIB_001:162;
  hence thesis by A11,XXREAL_0:2;
end;
