Article FINSEQ_8, MML version 4.99.1005

:: FINSEQ_8:funcnot 1 => FINSEQ_8:func 1
definition
  let a1 be set;
  let a2, a3 be FinSequence of a1;
  redefine func a2 ^ a3 -> FinSequence of a1;
end;

:: FINSEQ_8:th 1
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st 1 <= len b2
   holds mid(b2 ^ b3,1,len b2) = b2;

:: FINSEQ_8:th 2
theorem
for b1 being set
for b2 being FinSequence of b1
for b3 being Element of NAT
      st len b2 <= b3
   holds b2 /^ b3 = <*> b1;

:: FINSEQ_8:th 3
theorem
for b1 being non empty set
for b2, b3 being Element of NAT holds
mid(<*> b1,b2,b3) = <*> b1;

:: FINSEQ_8:funcnot 2 => FINSEQ_8:func 2
definition
  let a1 be set;
  let a2 be FinSequence of a1;
  let a3, a4 be natural set;
  func smid(A2,A3,A4) -> FinSequence of a1 equals
    (a2 /^ (a3 -' 1)) | ((a4 + 1) -' a3);
end;

:: FINSEQ_8:def 1
theorem
for b1 being set
for b2 being FinSequence of b1
for b3, b4 being natural set holds
smid(b2,b3,b4) = (b2 /^ (b3 -' 1)) | ((b4 + 1) -' b3);

:: FINSEQ_8:th 4
theorem
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Element of NAT
      st b3 <= b4
   holds smid(b2,b3,b4) = mid(b2,b3,b4);

:: FINSEQ_8:th 5
theorem
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of NAT holds
   smid(b2,1,b3) = b2 | b3;

:: FINSEQ_8:th 6
theorem
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of NAT
      st len b2 <= b3
   holds smid(b2,1,b3) = b2;

:: FINSEQ_8:th 7
theorem
for b1 being set
for b2 being FinSequence of b1
for b3, b4 being Element of NAT
      st b4 < b3
   holds smid(b2,b3,b4) = {};

:: FINSEQ_8:th 8
theorem
for b1 being set
for b2 being FinSequence of b1
for b3 being Element of NAT holds
   smid(b2,0,b3) = smid(b2,1,b3 + 1);

:: FINSEQ_8:th 9
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
smid(b2 ^ b3,(len b2) + 1,(len b2) + len b3) = b3;

:: FINSEQ_8:funcnot 3 => FINSEQ_8:func 3
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  func ovlpart(A2,A3) -> FinSequence of a1 means
    len it <= len a3 &
     it = smid(a3,1,len it) &
     it = smid(a2,((len a2) -' len it) + 1,len a2) &
     (for b1 being natural set
           st b1 <= len a3 &
              smid(a3,1,b1) = smid(a2,((len a2) -' b1) + 1,len a2)
        holds b1 <= len it);
end;

:: FINSEQ_8:def 2
theorem
for b1 being non empty set
for b2, b3, b4 being FinSequence of b1 holds
   b4 = ovlpart(b2,b3)
iff
   len b4 <= len b3 &
    b4 = smid(b3,1,len b4) &
    b4 = smid(b2,((len b2) -' len b4) + 1,len b2) &
    (for b5 being natural set
          st b5 <= len b3 &
             smid(b3,1,b5) = smid(b2,((len b2) -' b5) + 1,len b2)
       holds b5 <= len b4);

:: FINSEQ_8:th 10
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
len ovlpart(b2,b3) <= len b2;

:: FINSEQ_8:funcnot 4 => FINSEQ_8:func 4
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  func ovlcon(A2,A3) -> FinSequence of a1 equals
    a2 ^ (a3 /^ len ovlpart(a2,a3));
end;

:: FINSEQ_8:def 3
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlcon(b2,b3) = b2 ^ (b3 /^ len ovlpart(b2,b3));

:: FINSEQ_8:th 11
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlcon(b2,b3) = (b2 | ((len b2) -' len ovlpart(b2,b3))) ^ b3;

:: FINSEQ_8:funcnot 5 => FINSEQ_8:func 5
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  func ovlldiff(A2,A3) -> FinSequence of a1 equals
    a2 | ((len a2) -' len ovlpart(a2,a3));
end;

:: FINSEQ_8:def 4
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlldiff(b2,b3) = b2 | ((len b2) -' len ovlpart(b2,b3));

:: FINSEQ_8:funcnot 6 => FINSEQ_8:func 6
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  func ovlrdiff(A2,A3) -> FinSequence of a1 equals
    a3 /^ len ovlpart(a2,a3);
end;

:: FINSEQ_8:def 5
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlrdiff(b2,b3) = b3 /^ len ovlpart(b2,b3);

:: FINSEQ_8:th 12
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlcon(b2,b3) = ((ovlldiff(b2,b3)) ^ ovlpart(b2,b3)) ^ ovlrdiff(b2,b3) &
 ovlcon(b2,b3) = (ovlldiff(b2,b3)) ^ ((ovlpart(b2,b3)) ^ ovlrdiff(b2,b3));

:: FINSEQ_8:th 13
theorem
for b1 being non empty set
for b2 being FinSequence of b1 holds
   ovlcon(b2,b2) = b2 & ovlpart(b2,b2) = b2 & ovlldiff(b2,b2) = {} & ovlrdiff(b2,b2) = {};

:: FINSEQ_8:th 14
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
ovlpart(b2 ^ b3,b3) = b3 & ovlpart(b2,b2 ^ b3) = b2;

:: FINSEQ_8:th 15
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
len ovlcon(b2,b3) = ((len b2) + len b3) - len ovlpart(b2,b3) &
 len ovlcon(b2,b3) = ((len b2) + len b3) -' len ovlpart(b2,b3) &
 len ovlcon(b2,b3) = (len b2) + ((len b3) -' len ovlpart(b2,b3));

:: FINSEQ_8:th 16
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
len ovlpart(b2,b3) <= len b2 & len ovlpart(b2,b3) <= len b3;

:: FINSEQ_8:prednot 1 => FINSEQ_8:pred 1
definition
  let a1 be non empty set;
  let a2 be FinSequence of a1;
  pred A2 separates_uniquely means
    for b1 being FinSequence of a1
    for b2, b3 being Element of NAT
          st 1 <= b2 &
             b2 < b3 &
             (b3 + len a2) -' 1 <= len b1 &
             smid(b1,b2,(b2 + len a2) -' 1) = smid(b1,b3,(b3 + len a2) -' 1) &
             smid(b1,b2,(b2 + len a2) -' 1) = a2
       holds len a2 <= b3 -' b2;
end;

:: FINSEQ_8:dfs 6
definiens
  let a1 be non empty set;
  let a2 be FinSequence of a1;
To prove
     a2 separates_uniquely
it is sufficient to prove
  thus for b1 being FinSequence of a1
    for b2, b3 being Element of NAT
          st 1 <= b2 &
             b2 < b3 &
             (b3 + len a2) -' 1 <= len b1 &
             smid(b1,b2,(b2 + len a2) -' 1) = smid(b1,b3,(b3 + len a2) -' 1) &
             smid(b1,b2,(b2 + len a2) -' 1) = a2
       holds len a2 <= b3 -' b2;

:: FINSEQ_8:def 6
theorem
for b1 being non empty set
for b2 being FinSequence of b1 holds
      b2 separates_uniquely
   iff
      for b3 being FinSequence of b1
      for b4, b5 being Element of NAT
            st 1 <= b4 &
               b4 < b5 &
               (b5 + len b2) -' 1 <= len b3 &
               smid(b3,b4,(b4 + len b2) -' 1) = smid(b3,b5,(b5 + len b2) -' 1) &
               smid(b3,b4,(b4 + len b2) -' 1) = b2
         holds len b2 <= b5 -' b4;

:: FINSEQ_8:th 17
theorem
for b1 being non empty set
for b2 being FinSequence of b1 holds
      b2 separates_uniquely
   iff
      len ovlpart(b2 /^ 1,b2) = 0;

:: FINSEQ_8:prednot 2 => FINSEQ_8:pred 2
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  let a4 be Element of NAT;
  pred A3 is_substring_of A2,A4 means
    (0 < len a3) implies ex b1 being Element of NAT st
       a4 <= b1 &
        b1 <= len a2 &
        mid(a2,b1,(b1 -' 1) + len a3) = a3;
end;

:: FINSEQ_8:dfs 7
definiens
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  let a4 be Element of NAT;
To prove
     a3 is_substring_of a2,a4
it is sufficient to prove
  thus (0 < len a3) implies ex b1 being Element of NAT st
       a4 <= b1 &
        b1 <= len a2 &
        mid(a2,b1,(b1 -' 1) + len a3) = a3;

:: FINSEQ_8:def 7
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being Element of NAT holds
      b3 is_substring_of b2,b4
   iff
      (0 < len b3 implies ex b5 being Element of NAT st
         b4 <= b5 &
          b5 <= len b2 &
          mid(b2,b5,(b5 -' 1) + len b3) = b3);

:: FINSEQ_8:th 18
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4, b5 being Element of NAT
      st b4 <= b5 & b3 is_substring_of b2,b5
   holds b3 is_substring_of b2,b4;

:: FINSEQ_8:th 19
theorem
for b1 being non empty set
for b2 being FinSequence of b1
      st 1 <= len b2
   holds b2 is_substring_of b2,1;

:: FINSEQ_8:th 20
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st b3 is_substring_of b2,0
   holds b3 is_substring_of b2,1;

:: FINSEQ_8:prednot 3 => TARSKI:pred 1
notation
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  synonym a2 is_preposition_of a3 for a1 c= a2;
end;

:: FINSEQ_8:prednot 4 => FINSEQ_8:pred 3
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  redefine pred A2 c= A3 means
    (0 < len a2) implies 1 <= len a3 & mid(a3,1,len a2) = a2;
  reflexivity;
::  for a1 being non empty set
::  for a2 being FinSequence of a1 holds
::     a2 c= a2;
end;

:: FINSEQ_8:dfs 8
definiens
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
To prove
     a2 c= a3
it is sufficient to prove
  thus (0 < len a2) implies 1 <= len a3 & mid(a3,1,len a2) = a2;

:: FINSEQ_8:def 8
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
   b2 c= b3
iff
   (len b2 <= 0 or 1 <= len b3 & mid(b3,1,len b2) = b2);

:: FINSEQ_8:th 21
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st 0 < len b3 & b3 c= b2
   holds b3 . 1 = b2 . 1;

:: FINSEQ_8:prednot 5 => FINSEQ_8:pred 4
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  pred A3 is_postposition_of A2 means
    Rev a3 c= Rev a2;
end;

:: FINSEQ_8:dfs 9
definiens
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
To prove
     a3 is_postposition_of a2
it is sufficient to prove
  thus Rev a3 c= Rev a2;

:: FINSEQ_8:def 9
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
   b3 is_postposition_of b2
iff
   Rev b3 c= Rev b2;

:: FINSEQ_8:th 22
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st len b3 = 0
   holds b3 is_postposition_of b2;

:: FINSEQ_8:th 23
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st b3 is_postposition_of b2
   holds len b3 <= len b2;

:: FINSEQ_8:th 24
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st b3 is_postposition_of b2 & 0 < len b3
   holds len b3 <= len b2 &
    mid(b2,((len b2) + 1) -' len b3,len b2) = b3;

:: FINSEQ_8:th 25
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st (len b3 <= 0 or len b3 <= len b2 &
         mid(b2,((len b2) + 1) -' len b3,len b2) = b3)
   holds b3 is_postposition_of b2;

:: FINSEQ_8:th 26
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
      st 1 <= len b2 & b3 c= b2
   holds b3 is_substring_of b2,1;

:: FINSEQ_8:th 27
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being Element of NAT
   st not b3 is_substring_of b2,b4
for b5 being Element of NAT
      st b4 <= b5 & 0 < b5
   holds mid(b2,b5,(b5 -' 1) + len b3) <> b3;

:: FINSEQ_8:funcnot 7 => FINSEQ_8:func 7
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  let a4 be Element of NAT;
  func instr(A4,A2,A3) -> Element of NAT means
    (it = 0 or a4 <= it &
      a3 c= a2 /^ (it -' 1) &
      (for b1 being Element of NAT
            st a4 <= b1 & 0 < b1 & a3 c= a2 /^ (b1 -' 1)
         holds it <= b1)) &
     (it = 0 implies not a3 is_substring_of a2,a4);
end;

:: FINSEQ_8:def 10
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4, b5 being Element of NAT holds
   b5 = instr(b4,b2,b3)
iff
   (b5 = 0 or b4 <= b5 &
     b3 c= b2 /^ (b5 -' 1) &
     (for b6 being Element of NAT
           st b4 <= b6 & 0 < b6 & b3 c= b2 /^ (b6 -' 1)
        holds b5 <= b6)) &
    (b5 = 0 implies not b3 is_substring_of b2,b4);

:: FINSEQ_8:funcnot 8 => FINSEQ_8:func 8
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  func addcr(A2,A3) -> FinSequence of a1 equals
    ovlcon(a2,a3);
end;

:: FINSEQ_8:def 11
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
addcr(b2,b3) = ovlcon(b2,b3);

:: FINSEQ_8:prednot 6 => FINSEQ_8:pred 5
definition
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
  pred A2 is_terminated_by A3 means
    (0 < len a3) implies len a3 <= len a2 &
     instr(1,a2,a3) = ((len a2) + 1) -' len a3;
end;

:: FINSEQ_8:dfs 12
definiens
  let a1 be non empty set;
  let a2, a3 be FinSequence of a1;
To prove
     a2 is_terminated_by a3
it is sufficient to prove
  thus (0 < len a3) implies len a3 <= len a2 &
     instr(1,a2,a3) = ((len a2) + 1) -' len a3;

:: FINSEQ_8:def 12
theorem
for b1 being non empty set
for b2, b3 being FinSequence of b1 holds
   b2 is_terminated_by b3
iff
   (len b3 <= 0 or len b3 <= len b2 &
    instr(1,b2,b3) = ((len b2) + 1) -' len b3);

:: FINSEQ_8:th 28
theorem
for b1 being non empty set
for b2 being FinSequence of b1 holds
   b2 is_terminated_by b2;