theorem
  q = p|(Seg i) implies len q = min(i,len p)
proof
  assume
A1: q = p|(Seg i);
  now
    per cases;
    case
      i <= len p;
      hence len q = i by A1,FINSEQ_1:17;
    end;
    case
      not i <= len p;
      hence len q = len p by A1,Th18;
    end;
  end;
  hence thesis by XXREAL_0:def 9;
end;
