reserve p, q for FinSequence,
  X, Y, x, y, e for set,
  D for non empty set,
  i, j, k, l, m, n, r for Nat;
reserve G for Graph;
reserve v, v1, v2, v3, v4 for Element of G;
reserve vs, vs1, vs2 for FinSequence of the carrier of G,
  c, c1, c2 for Chain of G;

theorem Th38:
  c alternates_vertices_in G implies ex vs1,vs2 st vs1<>vs2 & vs1
  is_vertex_seq_of c & vs2 is_vertex_seq_of c & for vs st vs is_vertex_seq_of c
  holds vs=vs1 or vs=vs2
proof
  set X = (the Source of G).(c.1);
  set Y = (the Target of G).(c.1);
  consider p1 being FinSequence of the carrier of G such that
A1: p1 is_vertex_seq_of c by Th33;
  assume
A2: c alternates_vertices_in G;
  then
A3: 1<=len c;
  then
A4: 1 in dom c by FINSEQ_3:25;
A5: 1+1=2;
  then
A6: p1.1 <> p1.2 by A2,A1,A4,Th35;
A7: rng p1 = {X, Y} by A2,A1,Th36;
A8: len p1 = len c + 1 by A1;
  then
A9: len p1 > 1 by A3,NAT_1:13;
  then consider p2 being TwoValued Alternating FinSequence such that
A10: rng p2 = {p1.2, p1.1} and
A11: len p2 = len p1 and
A12: p2.1=p1.2 by A6,FINSEQ_6:149;
A13: dom p1 = dom p2 by A11,FINSEQ_3:29;
  1+1<=len p1 by A9,NAT_1:13;
  then 2 in dom p1 by FINSEQ_3:25;
  then p1.2 in rng p1 by FUNCT_1:def 3;
  then
A14: p1.2 = X or p1.2 = Y by A7,TARSKI:def 2;
  1 in dom p1 by A9,FINSEQ_3:25;
  then p1.1 in rng p1 by FUNCT_1:def 3;
  then
A15: p1.1 = X or p1.1 = Y by A7,TARSKI:def 2;
  then reconsider p2 as FinSequence of the carrier of G by A2,A1,A7,A4,A5,A10
,A14,Th35,FINSEQ_1:def 4;
  take p1, p2;
  thus p1<>p2 by A2,A1,A4,A5,A12,Th35;
  thus p1 is_vertex_seq_of c by A1;
A16: p1 is TwoValued Alternating FinSequence by A2,A1,Th37;
  now
    thus len p2 = len c + 1 by A1,A11;
    let n be Nat such that
A17: 1<=n and
A18: n<=len c;
A19: n<=len p1 by A8,A18,NAT_1:12;
    then
A20: p2/.n = p2.n by A11,A17,FINSEQ_4:15;
A21: n in dom p1 by A17,A19,FINSEQ_3:25;
    then p2.n in {X, Y} by A2,A1,A4,A5,A10,A13,A15,A14,Th35,FUNCT_1:def 3;
    then
A22: p2.n=X or p2.n=Y by TARSKI:def 2;
    set x = p1/.n;
    set y = p1/.(n+1);
A23: c.n joins x, y by A1,A17,A18;
A24: n+1<=len p1 by A8,A18,XREAL_1:6;
    then
A25: p2/.(n+1) = p2.(n+1) by A11,FINSEQ_4:15,NAT_1:12;
A26: 1<=n+1 by NAT_1:12;
    then
A27: n+1 in dom p1 by A24,FINSEQ_3:25;
    then p2.(n+1) in {X, Y} by A2,A1,A4,A5,A10,A13,A15,A14,Th35,FUNCT_1:def 3;
    then
A28: p2.(n+1)=X or p2.(n+1)=Y by TARSKI:def 2;
    p1.n in {X, Y} by A7,A21,FUNCT_1:def 3;
    then p1.n=X or p1.n=Y by TARSKI:def 2;
    then
A29: x = p2.(n+1) by A7,A16,A6,A10,A11,A12,A15,A14,A17,A19,A24,A22,A28,
    FINSEQ_6:def 7,FINSEQ_6:147,FINSEQ_4:15;
    p1.(n+1) in {X, Y} by A7,A27,FUNCT_1:def 3;
    then p1.(n+1)=X or p1.(n+1)=Y by TARSKI:def 2;
    then y = p2.n by A7,A16,A6,A10,A11,A12,A15,A14,A17,A26,A24,
    A22,A28,FINSEQ_6:def 7,FINSEQ_6:147,FINSEQ_4:15;
    hence c.n joins p2/.n,p2/.(n+1) by A23,A29,A20,A25;
  end;
  hence p2 is_vertex_seq_of c;
  let p be FinSequence of the carrier of G;
  assume
A30: p is_vertex_seq_of c;
  then reconsider p9 = p as TwoValued Alternating FinSequence by A2,Th37;
A31: len p = len c + 1 by A30;
  rng p = {X, Y} by A2,A30,Th36;
  then p9=p1 or p9=p2 by A8,A7,A16,A6,A10,A11,A12,A15,A14,A31,FINSEQ_6:148;
  hence thesis;
end;
