let G be Graph; :: thesis: for sc being simple Chain of G holds
( sc is Path of G iff ( len sc = 0 or len sc = 1 or sc . 1 <> sc . 2 ) )

let sc be simple Chain of G; :: thesis: ( sc is Path of G iff ( len sc = 0 or len sc = 1 or sc . 1 <> sc . 2 ) )
hereby :: thesis: ( ( len sc = 0 or len sc = 1 or sc . 1 <> sc . 2 ) implies sc is Path of G )
assume A1: sc is Path of G ; :: thesis: ( not len sc = 0 & not len sc = 1 implies not sc . 1 = sc . 2 )
assume A2: not len sc = 0 ; :: thesis: ( not len sc = 1 implies not sc . 1 = sc . 2 )
assume not len sc = 1 ; :: thesis: not sc . 1 = sc . 2
then len sc > 1 by ;
then A3: 1 + 1 <= len sc by NAT_1:13;
assume sc . 1 = sc . 2 ; :: thesis: contradiction
hence contradiction by A1, A3, GRAPH_1:def 16; :: thesis: verum
end;
assume A4: ( len sc = 0 or len sc = 1 or sc . 1 <> sc . 2 ) ; :: thesis: sc is Path of G
per cases ( len sc = 0 or len sc = 1 or sc . 1 <> sc . 2 ) by A4;
suppose len sc = 0 ; :: thesis: sc is Path of G
then for n, m being Nat st 1 <= n & n < m & m <= len sc holds
sc . n <> sc . m ;
hence sc is Path of G by GRAPH_1:def 16; :: thesis: verum
end;
suppose len sc = 1 ; :: thesis: sc is Path of G
then for n, m being Nat st 1 <= n & n < m & m <= len sc holds
sc . n <> sc . m by XXREAL_0:2;
hence sc is Path of G by GRAPH_1:def 16; :: thesis: verum
end;
suppose A5: sc . 1 <> sc . 2 ; :: thesis: sc is Path of G
now :: thesis: for n, m being Nat st 1 <= n & n < m & m <= len sc holds
sc . n <> sc . m
let n, m be Nat; :: thesis: ( 1 <= n & n < m & m <= len sc implies sc . n <> sc . m )
assume that
A6: 1 <= n and
A7: n < m and
A8: m <= len sc ; :: thesis: sc . n <> sc . m
thus sc . n <> sc . m :: thesis: verum
proof
consider vs being FinSequence of the carrier of G such that
A9: vs is_vertex_seq_of sc and
A10: for n, m being Nat st 1 <= n & n < m & m <= len vs & vs . n = vs . m holds
( n = 1 & m = len vs ) by Def9;
set vm1 = vs /. (m + 1);
A11: len vs = (len sc) + 1 by A9;
then A12: m + 1 <= len vs by ;
then A13: vs /. (m + 1) = vs . (m + 1) by ;
set vn1 = vs /. (n + 1);
set vn = vs /. n;
A14: n <= len sc by ;
then A15: sc . n joins vs /. n,vs /. (n + 1) by A6, A9;
n + 1 <= len vs by ;
then A16: vs /. (n + 1) = vs . (n + 1) by ;
n <= len vs by ;
then A17: vs /. n = vs . n by ;
set vm = vs /. m;
A18: 1 <= m by ;
then A19: sc . m joins vs /. m,vs /. (m + 1) by A8, A9;
A20: m <= len vs by ;
then A21: vs /. m = vs . m by ;
assume A22: not sc . n <> sc . m ; :: thesis: contradiction
per cases ( ( vs /. n = vs /. m & vs /. (n + 1) = vs /. (m + 1) ) or ( vs /. n = vs /. (m + 1) & vs /. (n + 1) = vs /. m ) ) by ;
suppose A23: ( vs /. n = vs /. m & vs /. (n + 1) = vs /. (m + 1) ) ; :: thesis: contradiction
A24: n + 1 < m + 1 by ;
n = 1 by A6, A7, A10, A20, A17, A21, A23;
hence contradiction by A10, A12, A16, A13, A23, A24; :: thesis: verum
end;
suppose A25: ( vs /. n = vs /. (m + 1) & vs /. (n + 1) = vs /. m ) ; :: thesis: contradiction
thus contradiction :: thesis: verum
proof
A26: n + 1 <= m by ;
A27: n + 0 < m + 1 by ;
per cases ( n + 1 = m or n + 1 < m ) by ;
suppose A28: n + 1 = m ; :: thesis: contradiction
end;
suppose A29: n + 1 < m ; :: thesis: contradiction
end;
end;
end;
end;
end;
end;
end;
hence sc is Path of G by GRAPH_1:def 16; :: thesis: verum
end;
end;