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;

theorem Th4:
  W is_weight_of G & len pe = 1 implies cost(pe,W) = W.(pe.1)
proof
  assume that
A1: W is_weight_of G and
A2: len pe = 1;
A3: 1 in dom pe by A2,FINSEQ_3:25;
  set f=RealSequence(pe,W);
  reconsider f1 = f.1 as Element of REAL by XREAL_0:def 1;
  dom f = dom pe by A1,GRAPH_5:def 15;
  then len f=1 by A2,FINSEQ_3:29;
  then
A4: f = <*f1*> by FINSEQ_1:40;
  thus cost(pe,W) = Sum f by GRAPH_5:def 16
    .= f.1 by A4,FINSOP_1:11
    .= W.(pe.1) by A1,A3,GRAPH_5:def 15;
end;
