
theorem Th32:
  for n being non zero Nat, P1, P2 being n-vertex Path-like _Graph
  holds P2 is P1-isomorphic
proof
  let n be non zero Nat, P1, P2 be n-vertex Path-like _Graph;
  consider P7 being vertex-distinct Path of P1 such that
    A1: P7.vertices() = the_Vertices_of P1 & P7.edges() = the_Edges_of P1 and
    Endvertices P1 = {P7.first(),P7.last()} iff P1 is non _trivial and
    P7 is trivial iff P1 is _trivial and
    P7 is closed iff P1 is _trivial and
    P7 is minlength by Th31;
  consider P8 being vertex-distinct Path of P2 such that
    A4: P8.vertices() = the_Vertices_of P2 & P8.edges() = the_Edges_of P2 and
    Endvertices P2 = {P8.first(),P8.last()} iff P2 is non _trivial and
    P8 is trivial iff P2 is _trivial and
    P8 is closed iff P2 is _trivial and
    P8 is minlength by Th31;
  set p1 = P7.vertexSeq(), p2 = P8.vertexSeq();
  P1.order() = n & P2.order() = n by GLIB_013:def 3;
  then A7: card the_Vertices_of P1 = card the_Vertices_of P2;
  set f = p2*(p1");
  A8: card p2 = card dom p2 by CARD_1:62
    .= card the_Vertices_of P2 by A4, CARD_1:70
    .= card dom p1 by A1, A7, CARD_1:70
    .= card p1 by CARD_1:62;
  A9: dom p2 = Seg len p2 by FINSEQ_1:def 3
    .= dom p1 by A8, FINSEQ_1:def 3;
  then A10: dom p2 = rng(p1") by FUNCT_1:33;
  then A11: dom f = dom(p1") by RELAT_1:27
    .= the_Vertices_of P1 by A1, FUNCT_1:33;
  A12: len p1 = len p2 by A9, FINSEQ_3:29;
  A13: rng f = the_Vertices_of P2 by A4, A10, RELAT_1:28;
  then reconsider f as Function of the_Vertices_of P1, the_Vertices_of P2
    by A11, FUNCT_2:1;
  :: show that adjacency is preserved
  now
    let v,w,e be object;
    assume A14: v in dom f & w in dom f & e Joins v,w,P1;
    then A15: v in P7.vertices() by A1;
    A16: w in P7.vertices() by A1, A14;
    consider n being odd Element of NAT such that
      A17: n <= len P7 & P7.n = v by A15, GLIB_001:87;
    consider m being odd Element of NAT such that
      A18: m <= len P7 & P7.m = w by A16, GLIB_001:87;
    set i = (n+1) div 2, j = (m+1) div 2;
    A19: 2 * i - 1 = n & 1 <= i & i <= len p1 by A17, GLIB_001:68;
    then A20: p1.i = v by A17, GLIB_001:def 14;
    A21: i in dom p1 by A19, FINSEQ_3:25;
    A22: f.v = p2.(p1".v) by A14, FUNCT_1:12
      .= p2.i by A20, A21, FUNCT_1:34
      .= P8.n by A12, A19, GLIB_001:def 14;
    A23: 2 * j - 1 = m & 1 <= j & j <= len p1 by A18, GLIB_001:68;
    then A24: p1.j = w by A18, GLIB_001:def 14;
    A25: j in dom p1 by A23, FINSEQ_3:25;
    A26: f.w = p2.(p1".w) by A14, FUNCT_1:12
      .= p2.j by A24, A25, FUNCT_1:34
      .= P8.m by A12, A23, GLIB_001:def 14;
    2 * len p1 = len P7 + 1 & 2 * len p2 = len P8 + 1 by GLIB_001:def 14;
    then A27: len P7 = len P8 by A12;
    :: show that either n = m+2 or m = n+2
    e in P7.edges() by A1, A14, GLIB_000:def 13;
    then consider k being odd Element of NAT such that
      A28: k < len P7 & P7.(k+1) = e by GLIB_001:100;
    A29: k <= len P7 & k+2 <= len P7 by A28, CHORD:4;
    e Joins P7.k, P7.(k+2), P1 by A28, GLIB_001:def 3;
    then per cases by A17, A18, A14, GLIB_000:15;
    suppose P7.k = P7.n & P7.(k+2) = P7.m;
      then k = n & k+2 = m by A17, A18, A29, GLIB_001:def 29;
      then A30: n+2 = m;
      A31: n < len P8
      proof
        assume n >= len P8;
        then A32: n+2 >= len P7 + 2 by A27, XREAL_1:6;
        m+2 <= len P7 + 2 by A18, XREAL_1:6;
        then m+0 >= m+2 by A30, A32, XXREAL_0:2;
        hence contradiction by XREAL_1:6;
      end;
      reconsider e9 = P8.(n+1) as object;
      take e9;
      e9 Joins f.v,P8.(n+2),P2 by A22, A31, GLIB_001:def 3;
      hence e9 Joins f.v,f.w,P2 by A30, A26;
    end;
    suppose P7.k = P7.m & P7.(k+2) = P7.n;
      then k = m & k+2 = n by A17, A18, A29, GLIB_001:def 29;
      then A33: m+2 = n;
      A34: m < len P8
      proof
        assume m >= len P8;
        then A35: m+2 >= len P7 + 2 by A27, XREAL_1:6;
        n+2 <= len P7 + 2 by A17, XREAL_1:6;
        then n+0 >= n+2 by A33, A35, XXREAL_0:2;
        hence contradiction by XREAL_1:6;
      end;
      reconsider e9 = P8.(m+1) as object;
      take e9;
      e9 Joins P8.m,P8.(m+2),P2 by A34, GLIB_001:def 3;
      hence e9 Joins f.v,f.w,P2 by A26, A33, A22, GLIB_000:14;
    end;
  end;
  then reconsider f as PVertexMapping of P1, P2 by GLIB_011:1;
  :: show continuous property (analogously to before)
  now
    let v,w,e9 be object;
    assume A36: v in dom f & w in dom f & e9 Joins f.v,f.w,P2;
    then A37: f.v in P8.vertices() by A4, GLIB_000:13;
    A38: f.w in P8.vertices() by A4, A36, GLIB_000:13;
    consider n being odd Element of NAT such that
      A39: n <= len P8 & P8.n = f.v by A37, GLIB_001:87;
    consider m being odd Element of NAT such that
      A40: m <= len P8 & P8.m = f.w by A38, GLIB_001:87;
    set i = (n+1) div 2, j = (m+1) div 2;
    A41: 2 * i - 1 = n & 1 <= i & i <= len p2 by A39, GLIB_001:68;
    then A42: p2.i = f.v by A39, GLIB_001:def 14;
    A43: i in dom p2 by A41, FINSEQ_3:25;
    A44: v = f".(p2.i) by A36, A42, FUNCT_1:34
      .= (p1""*p2").(p2.i) by FUNCT_1:44
      .= (p1*p2").(p2.i) by FUNCT_1:43
      .= ((p1*p2")*p2).i by A43, FUNCT_1:13
      .= (p1*(p2"*p2)).i by RELAT_1:36
      .= (p1*id dom p2).i by FUNCT_1:39
      .= p1.i by A9, RELAT_1:52
      .= P7.n by A12, A41, GLIB_001:def 14;
    A45: 2 * j - 1 = m & 1 <= j & j <= len p2 by A40, GLIB_001:68;
    then A46: p2.j = f.w by A40, GLIB_001:def 14;
    A47: j in dom p2 by A45, FINSEQ_3:25;
    A48: w = f".(p2.j) by A36, A46, FUNCT_1:34
      .= (p1""*p2").(p2.j) by FUNCT_1:44
      .= (p1*p2").(p2.j) by FUNCT_1:43
      .= ((p1*p2")*p2).j by A47, FUNCT_1:13
      .= (p1*(p2"*p2)).j by RELAT_1:36
      .= (p1*id dom p2).j by FUNCT_1:39
      .= p1.j by A9, RELAT_1:52
      .= P7.m by A12, A45, GLIB_001:def 14;
    2 * len p2 = len P8 + 1 & 2 * len p1 = len P7 + 1 by GLIB_001:def 14;
    then A49: len P7 = len P8 by A12;
    :: show that either n = m+2 or m = n+2
    e9 in P8.edges() by A4, A36, GLIB_000:def 13;
    then consider k being odd Element of NAT such that
      A50: k < len P8 & P8.(k+1) = e9 by GLIB_001:100;
    A51: k <= len P8 & k+2 <= len P8 by A50, CHORD:4;
    e9 Joins P8.k, P8.(k+2), P2 by A50, GLIB_001:def 3;
    then per cases by A39, A40, A36, GLIB_000:15;
    suppose P8.k = P8.n & P8.(k+2) = P8.m;
      then k = n & k+2 = m by A39, A40, A51, GLIB_001:def 29;
      then A52: n+2 = m;
      A53: n < len P7
      proof
        assume n >= len P7;
        then A54: n+2 >= len P8 + 2 by A49, XREAL_1:6;
        m+2 <= len P8 + 2 by A40, XREAL_1:6;
        then m+0 >= m+2 by A52, A54, XXREAL_0:2;
        hence contradiction by XREAL_1:6;
      end;
      reconsider e = P7.(n+1) as object;
      take e;
      e Joins P7.n,P7.(n+2),P1 by A53, GLIB_001:def 3;
      hence e Joins v,w,P1 by A44, A52, A48;
    end;
    suppose P8.k = P8.m & P8.(k+2) = P8.n;
      then k = m & k+2 = n by A39, A40, A51, GLIB_001:def 29;
      then A55: m+2 = n;
      A56: m < len P7
      proof
        assume m >= len P7;
        then A57: m+2 >= len P8 + 2 by A49, XREAL_1:6;
        n+2 <= len P8 + 2 by A39, XREAL_1:6;
        then n+0 >= n+2 by A55, A57, XXREAL_0:2;
        hence contradiction by XREAL_1:6;
      end;
      reconsider e = P7.(m+1) as object;
      take e;
      e Joins P7.m,P7.(m+2),P1 by A56, GLIB_001:def 3;
      hence e Joins v,w,P1 by A48, A55, A44, GLIB_000:14;
    end;
  end;
  then A58: f is continuous by GLIB_011:2;
  f is total onto by A13, FUNCT_2:def 3;
  hence thesis by A58, GLIB_011:49;
end;
