theorem Lem8B:
  for p,q,r being FinSequence st q is_a_prefix_of p^r holds
  q is_a_prefix_of p or p is_a_prefix_of q
  proof
    let p,q,r be FinSequence;
    given i such that
Z0: q = (p^r)|Seg i;
    per cases;
    suppose len p <= i;
      then consider j such that
A1:   i = (len p)+j by NAT_1:10;
      q = p^(r|Seg j) by Z0,A1,FINSEQ_6:14;
      hence thesis by TREES_1:1;
    end;
    suppose len p >= i;
      then q = p|Seg i by Z0,LemP;
      hence thesis by TREES_1:def 1;
    end;
  end;
