
theorem Th16:
  for G being WGraph, W1,W2 being Walk of G st W1.last() = W2
  .first() holds W1.append(W2).weightSeq() = W1.weightSeq() ^ W2.weightSeq()
proof
  let G being WGraph, W1,W2 be Walk of G;
  set W3 = W1.append(W2), W4 = W1.weightSeq()^W2.weightSeq();
  assume
A1: W1.last() = W2.first();
  then W3.edgeSeq() = W1.edgeSeq() ^ W2.edgeSeq() by GLIB_001:85;
  then len W3.edgeSeq() = len W1.edgeSeq() + len W2.edgeSeq() by FINSEQ_1:22;
  then
A2: len W3.weightSeq() = len W1.edgeSeq() + len W2.edgeSeq() by Def18
    .= len W1.weightSeq() + len W2.edgeSeq() by Def18
    .= len W1.weightSeq() + len W2.weightSeq() by Def18
    .= len W4 by FINSEQ_1:22;
  now
    let n be Nat;
    assume
A3: 1 <= n & n <= len W3.weightSeq();
    then
A4: W3.weightSeq().n = (the_Weight_of G).(W3.edgeSeq().n) by Def18
      .= (the_Weight_of G).((W1.edgeSeq()^W2.edgeSeq()).n) by A1,GLIB_001:85;
A5: n in dom W4 by A2,A3,FINSEQ_3:25;
    now
      per cases by A5,FINSEQ_1:25;
      suppose
A6:     n in dom W1.weightSeq();
        then
A7:     1 <= n by FINSEQ_3:25;
A8:     n <= len W1.weightSeq() by A6,FINSEQ_3:25;
        then n <= len W1.edgeSeq() by Def18;
        then
A9:     n in dom W1.edgeSeq() by A7,FINSEQ_3:25;
        W4.n = W1.weightSeq().n by A6,FINSEQ_1:def 7
          .= (the_Weight_of G).(W1.edgeSeq().n) by A7,A8,Def18;
        hence W3.weightSeq().n = W4.n by A4,A9,FINSEQ_1:def 7;
      end;
      suppose
        ex k being Nat st k in dom W2.weightSeq() & n = len W1 .weightSeq()+k;
        then consider k being Nat such that
A10:    k in dom W2.weightSeq() and
A11:    n = len W1.weightSeq() + k;
A12:    1 <= k by A10,FINSEQ_3:25;
A13:    k <= len W2.weightSeq() by A10,FINSEQ_3:25;
        then k <= len W2.edgeSeq() by Def18;
        then
A14:    k in dom W2.edgeSeq() by A12,FINSEQ_3:25;
A15:    n = len W1.edgeSeq() + k by A11,Def18;
        W4.n = W2.weightSeq().k by A10,A11,FINSEQ_1:def 7
          .= (the_Weight_of G).(W2.edgeSeq().k) by A12,A13,Def18;
        hence W3.weightSeq().n = W4.n by A4,A14,A15,FINSEQ_1:def 7;
      end;
    end;
    hence W3.weightSeq().n = W4.n;
  end;
  hence thesis by A2,FINSEQ_1:14;
end;
