reserve x,y,X for set,
  i,j,k,m,n for Nat,
  p for FinSequence of X,
  ii for Integer;
reserve G for Graph,
  pe,qe for FinSequence of the carrier' of G,
  p,q for oriented Chain of G,
  W for Function,
  U,V,e,ee for set,
  v1,v2,v3,v4 for Vertex of G;
reserve G for finite Graph,
  P,Q for oriented Chain of G,
  v1,v2,v3 for Vertex of G;
reserve G for finite oriented Graph,
  P,Q for oriented Chain of G,
  W for Function of (the carrier' of G), Real>=0,
  v1,v2,v3,v4 for Vertex of G;

theorem Th16:
  the carrier of G= U \/ V & v1 in U & (for v3,v4 st v3 in U & v4
  in V holds not (ex e st e in the carrier' of G & e orientedly_joins v3,v4))
  implies (P is_shortestpath_of v1,v2,U,W iff P is_shortestpath_of v1,v2,W)
proof
  assume
A1: the carrier of G= U \/ V & v1 in U & for v3,v4 st v3 in U & v4 in V
  holds not (ex e st e in the carrier' of G & e orientedly_joins v3,v4);
  hereby
    assume
A2: P is_shortestpath_of v1,v2,U,W;
A3: now
      let Q;
      assume Q is_orientedpath_of v1,v2;
      then Q is_orientedpath_of v1,v2,U by A1,Th12;
      hence cost(P,W) <= cost(Q,W) by A2,GRAPH_5:def 18;
    end;
    P is_orientedpath_of v1,v2,U by A2,GRAPH_5:def 18;
    then P is_orientedpath_of v1,v2 by GRAPH_5:def 4;
    hence P is_shortestpath_of v1,v2,W by A3,GRAPH_5:def 17;
  end;
  hereby
    assume
A4: P is_shortestpath_of v1,v2,W;
A5: now
      let Q;
      assume Q is_orientedpath_of v1,v2,U;
      then Q is_orientedpath_of v1,v2 by GRAPH_5:def 4;
      hence cost(P,W) <= cost(Q,W) by A4,GRAPH_5:def 17;
    end;
    P is_orientedpath_of v1,v2 by A4,GRAPH_5:def 17;
    then P is_orientedpath_of v1,v2,U by A1,Th12;
    hence P is_shortestpath_of v1,v2,U,W by A5,GRAPH_5:def 18;
  end;
end;
