reserve
  a for natural Number,
  k,l,m,n,k1,b,c,i for Nat,
  x,y,z,y1,y2 for object,
  X,Y for set,
  f,g for Function;
reserve p,q,r,s,t for FinSequence;
reserve D for set;
reserve a, b, c, d, e, f for object;

theorem
  for p,r being FinSequence st r = p|Seg n ex q being FinSequence st p = r^q
proof
  let p,r be FinSequence;
  assume
A1: r = p|Seg n;
  then consider m be Nat such that
A2: len p = len r + m by Th79,NAT_1:10;
  deffunc U(Nat) = p.(len r + $1);
  consider q being FinSequence such that
A3: len q = m & for k st k in dom q holds q.k = U(k) from SeqLambda;
  take q;
A4: len p = len(r^q) by A2,A3,Th22;
  now
    let k such that
A5: 1 <= k and
A6: k <= len p;
A7: now
      assume k <= len r;
      then
A8:   k in Seg len r by A5;
A9:  dom r = Seg len r by Def3;
      then (r^q).k = r.k by A8,Def7;
      hence p.k = (r^q).k by A1,A8,A9,FUNCT_1:47;
    end;
    now
      assume
A10:  not k <= len r;
      then consider j being Nat such that
A11:  k = len r + j by NAT_1:10;
      k-len r = j by A11;
      then
A12:  (r^q).k = q.j by A4,A6,A10,Th24;
      j <> 0 by A10,A11;
      then
A13:  0+1 <= j by NAT_1:13;
      j <= len q by A2,A3,A6,A11,XREAL_1:6;
      then j in Seg m by A3,A13;
      then j in dom q by A3,Def3;
      hence p.k = (r^q).k by A3,A11,A12;
    end;
    hence p.k = (r^q).k by A7;
  end;
  hence thesis by A4,Th14;
end;
