reserve n for Nat;

theorem Th54:
  for f,g be FinSequence of TOP-REAL 2 st f is unfolded s.n.c.
one-to-one & g is unfolded s.n.c. one-to-one & f/.len f = g/.1 & L~f /\ L~g = {
  g/.1} holds f^'g is s.n.c.
proof
  let f,g be FinSequence of TOP-REAL 2;
  assume that
A1: f is unfolded s.n.c. one-to-one and
A2: g is unfolded s.n.c. one-to-one and
A3: f/.len f = g/.1 and
A4: L~f /\ L~g = {g/.1};
  now
    let i,j be Nat;
    assume
A5: i+1 < j;
    now
      per cases;
      suppose
A6:     j < len f;
        then i+1 < len f by A5,XXREAL_0:2;
        then i < len f by NAT_1:13;
        then
A7:     LSeg(f^'g,i) = LSeg(f,i) by TOPREAL8:28;
        LSeg(f^'g,j) = LSeg(f,j) by A6,TOPREAL8:28;
        hence LSeg(f^'g,i) misses LSeg(f^'g,j) by A1,A5,A7,TOPREAL1:def 7;
      end;
      suppose
        j >= len f;
        then consider k be Nat such that
A8:    j = len f + k by NAT_1:10;
A9:    now
          assume g is trivial;
          then len g < 2 by NAT_D:60;
          then len g = 0 or len g = 1 by NAT_1:23;
          then L~g = {} by TOPREAL1:22;
          hence contradiction by A4;
        end;
        reconsider k as Nat;
A10:    now
          assume f is empty;
          then len f = 0;
          then L~f = {} by TOPREAL1:22;
          hence contradiction by A4;
        end;
        now
          per cases;
          suppose
A11:        i >= 1 & j+1 <= len(f^'g);
            then j+1 < len(f^'g)+1 by NAT_1:13;
            then len f+(k+1) < len f + len g by A8,A9,FINSEQ_6:139;
            then
A12:        k+1 < len g by XREAL_1:7;
            then
A13:        LSeg(f^'g,len f+k) = LSeg(g,k+1) by A3,A10,A9,TOPREAL8:31;
            then
A14:        LSeg(f^'g,j) c= L~g by A8,TOPREAL3:19;
            now
              per cases;
              suppose
A15:            i < len f;
                then
A16:            i+1 <= len f by NAT_1:13;
                i+1 > 1 by A11,NAT_1:13;
                then
A17:            i+1 in dom f by A16,FINSEQ_3:25;
A18:            len g >= 2 by A9,NAT_D:60;
A19:            LSeg(f^'g,i) = LSeg(f,i) by A15,TOPREAL8:28;
                then LSeg(f^'g,i) c= L~f by TOPREAL3:19;
                then
A20:            LSeg(f^'g,i) /\ LSeg(f^'g,j) c= {g/.1} by A4,A14,XBOOLE_1:27;
                assume LSeg(f^'g,i) meets LSeg(f^'g,j);
                then consider x be object such that
A21:            x in LSeg(f^'g,i) and
A22:            x in LSeg(f^'g,j) by XBOOLE_0:3;
                x in LSeg(f^'g,i) /\ LSeg(f^'g,j) by A21,A22,XBOOLE_0:def 4;
                then
A23:            x = g/.1 by A20,TARSKI:def 1;
                i in dom f by A11,A15,FINSEQ_3:25;
                then len f+0 < len f+k by A1,A3,A5,A8,A19,A21,A23,A17,
GOBOARD2:2;
                then k > 0;
                then k+1 > 0+1 by XREAL_1:6;
                hence contradiction by A2,A8,A13,A22,A23,A18,JORDAN5B:30;
              end;
              suppose
                i >= len f;
                then consider l be Nat such that
A24:            i = len f + l by NAT_1:10;
                reconsider l as Nat;
                len f+(l+1) < len f+k by A5,A8,A24;
                then l+1 < k by XREAL_1:7;
                then
A25:            l+1+1 < k+1 by XREAL_1:6;
                then l+1+1 < len g by A12,XXREAL_0:2;
                then l+1 < len g by NAT_1:13;
                then LSeg(f^'g,len f+l) = LSeg(g,l+1) by A3,A10,A9,TOPREAL8:31;
                hence LSeg(f^'g,i) misses LSeg(f^'g,j) by A2,A8,A13,A24,A25,
TOPREAL1:def 7;
              end;
            end;
            hence LSeg(f^'g,i) misses LSeg(f^'g,j);
          end;
          suppose
            j+1 > len(f^'g);
            then LSeg(f^'g,j) = {} by TOPREAL1:def 3;
            hence LSeg(f^'g,i) misses LSeg(f^'g,j);
          end;
          suppose
            i < 1;
            then LSeg(f^'g,i) = {} by TOPREAL1:def 3;
            hence LSeg(f^'g,i) misses LSeg(f^'g,j);
          end;
        end;
        hence LSeg(f^'g,i) misses LSeg(f^'g,j);
      end;
    end;
    hence LSeg(f^'g,i) misses LSeg(f^'g,j);
  end;
  hence thesis by TOPREAL1:def 7;
end;
