reserve x,y,z for set;
reserve f,f1,f2,f3 for FinSequence,
  p,p1,p2,p3 for set,
  i,k for Nat;
reserve D for non empty set,
  p,p1,p2,p3 for Element of D,
  f,f1,f2 for FinSequence of D;
reserve D for non empty set;
reserve p, q for FinSequence,
  X, Y, x, y for set,
  D for non empty set,
  i, j, k, l, m, n, r for Nat;

theorem
  q = p|Seg n implies len q<=len p & for i st 1<=i & i<=len q holds p.i = q.i
proof
  assume
A1: q = p|Seg n;
  per cases;
  suppose
A2: n<=len p;
    hence len q<=len p by A1,FINSEQ_1:17;
    let i be Nat;
    assume that
A3: 1<=i and
A4: i<=len q;
    len q = n by A1,A2,FINSEQ_1:17;
    then i in Seg n by A3,A4;
    hence thesis by A1,FUNCT_1:49;
  end;
  suppose
A5: len p<=n;
    hence len q<=len p by A1,FINSEQ_2:20;
    let i be Nat;
    assume that
    1<=i and
    i<=len q;
    thus thesis by A1,A5,FINSEQ_2:20;
  end;
end;
