
theorem Th27:
  for D being non empty set,f,g being FinSequence of D, n being Nat
st not g is_substring_of f,n holds for i being Element of NAT st n <= i & 0 < i
  holds mid(f,i,(i-'1)+len g) <> g
proof
  let D be non empty set,f,g be FinSequence of D,n be Nat;
  assume
A1: not g is_substring_of f,n;
  now
    let i be Element of NAT;
    assume that
A2: n <= i and
A3: 0 < i;
    now per cases;
      case i<=len f;
        hence mid(f,i,(i-'1)+len g) <> g by A1,A2;
      end;
      case
A4:     i>len f;
        now per cases;
          case
A5:         i<=(i-'1)+len g;
            then
A6:         mid(f,i,(i-'1)+len g)=(f/^(i-'1))|((i-'1)+len g-'i +1)
            by FINSEQ_6:def 3;
         now per cases;
              case
A7:             i-'1<= len f;
                i>=len f +1 by A4,NAT_1:13;
                then
A8:             i-1>= len f +1-1 by XREAL_1:9;
                0+1<=i by A3,NAT_1:13;
                then i-'1=i-1 by XREAL_0:def 2,XREAL_1:48;
                then
A9:            i-'1=len f by A7,A8,XXREAL_0:1;
                len (f/^(i-'1))=len f -(i-'1) by A7,RFINSEQ:def 1;
                hence len (f/^(i-'1)) =0 by A9;
              end;
              case i-'1>len f;
                then f/^(i-'1)=<*>D by RFINSEQ:def 1;
                hence len (f/^(i-'1)) =0;
              end;
            end;
            then
A10:        (f/^(i-'1))|((i-'1)+len g-'i+1)=<*>D by FINSEQ_1:58;
            now
              assume
A11:          mid(f,i,(i-'1)+len g)=g;
a12:          0+1<=i by A3,NAT_1:13;
              i-1<i+1-1 by XREAL_1:9,XREAL_1:29;
              hence contradiction by A5,A6,A10,A11,a12,XREAL_0:def 2;
            end;
            hence mid(f,i,(i-'1)+len g)<>g;
          end;
          case
A13:        i>(i-'1)+len g;
            now
              assume len g>0;
              then len g >=0+1 by NAT_1:13;
              then
A14:          (i-'1)+len g>=(i-'1)+1 by XREAL_1:7;
              0+1<=i by A3,NAT_1:13;
              then i-'1=i-1 by XREAL_0:def 2,XREAL_1:48;
              hence contradiction by A13,A14;
            end;
            hence contradiction by A1;
          end;
        end;
        hence mid(f,i,(i-'1)+len g)<>g;
      end;
    end;
    hence mid(f,i,(i-'1)+len g) <> g;
  end;
  hence thesis;
end;
