
theorem Th9:
  for p, q being FinSequence st not p is_a_prefix_of q & not q
  is_a_prefix_of p holds p.(len maxPrefix(p,q) +1) <> q.(len maxPrefix(p,q) +1)
proof
  let p, q be FinSequence such that
A1: not p c= q and
A2: not q c= p and
A3: p.(len maxPrefix(p,q) +1) = q.(len maxPrefix(p,q) +1);
  set dI = len maxPrefix(p,q);
  set mP = maxPrefix(p,q);
  set lmP = mP^<*p.(dI+1)*>;
A4: now
    let x be object such that
A5: x in dom lmP;
    reconsider n = x as Nat by A5;
A6: 1 <= n by A5,FINSEQ_3:25;
    n <= len lmP by A5,FINSEQ_3:25;
    then
A7: n <= len mP + 1 by FINSEQ_2:16;
    per cases by A7,NAT_1:8;
    suppose
A8:   n <= dI;
      then n in dom mP by A6,FINSEQ_3:25;
      hence lmP.x = mP.x by FINSEQ_1:def 7
        .= q.x by A8,Th6;
    end;
    suppose
      n = dI + 1;
      hence lmP.x = q.x by A3,FINSEQ_1:42;
    end;
  end;
A9: now
    let x be object such that
A10: x in dom lmP;
    reconsider n = x as Nat by A10;
A11: 1 <= n by A10,FINSEQ_3:25;
    n <= len lmP by A10,FINSEQ_3:25;
    then
A12: n <= len mP + 1 by FINSEQ_2:16;
    per cases by A12,NAT_1:8;
    suppose
A13:  n <= dI;
      then n in dom mP by A11,FINSEQ_3:25;
      hence lmP.x = mP.x by FINSEQ_1:def 7
        .= p.x by A13,Th6;
    end;
    suppose
      n = dI + 1;
      hence lmP.x = p.x by FINSEQ_1:42;
    end;
  end;
A14: len lmP = len mP + 1 by FINSEQ_2:16;
  len mP < len q by A2,Th8;
  then len lmP <= len q by A14,NAT_1:13;
  then dom lmP c= dom q by FINSEQ_3:30;
  then
A15: lmP c= q by A4,GRFUNC_1:2;
  len mP < len p by A1,Th8;
  then len lmP <= len p by A14,NAT_1:13;
  then dom lmP c= dom p by FINSEQ_3:30;
  then lmP c= p by A9,GRFUNC_1:2;
  then lmP c= mP by A15,Def1;
  then len lmP <= len mP by FINSEQ_1:63;
  then len mP + 1 <= len mP by FINSEQ_2:16;
  hence contradiction by NAT_1:13;
end;
