
theorem Th20:
  for f,g being FinSequence
  st g is_substring_of f,0 holds g is_substring_of f,1
proof
  let f,g be FinSequence;
  assume
A1: g is_substring_of f,0;
  now per cases;
    case
A2:   len g>0;
      then consider i being Nat such that
      0<=i and
A3:   i<=len f and
A4:   mid(f,i,(i-'1)+len g)=g by A1;
A5:   len g>=0+1 by A2,NAT_1:13;
      now per cases;
        case
A6:       i=0;
          0-1<0;
          then
A7:       i-'1=0 by A6,XREAL_0:def 2;
          then
A8:       (f/^(0-'1))|(len g-'0+1)=g by A4,A6,FINSEQ_6:def 3;
          len g -'0=len g -0 by XREAL_0:def 2
            .=len g;
          then
A9:       f|(len g+1)=g by A6,A7,A8,FINSEQ_5:28;
          now per cases;
            case len g+1>=len f;
              then f=g by A9,FINSEQ_1:58;
              hence thesis by A5,Th19;
            end;
            case
A10:          len g+1<len f;
              dom ( f|Seg(len g +1))=dom f /\ Seg(len g+1) by RELAT_1:61
                .= Seg(len f) /\ Seg(len g+1) by FINSEQ_1:def 3
                .=Seg (len g+1) by A10,FINSEQ_1:7;
              then len g=len g+1 by A9,FINSEQ_1:def 3;
              hence contradiction;
            end;
          end;
          hence thesis;
        end;
        case i<>0;
          then i>=0+1 by NAT_1:13;
          hence thesis by A3,A4;
        end;
      end;
      hence thesis;
    end;
    case len g<=0;
      hence thesis;
    end;
  end;
  hence thesis;
end;
