reserve a,b,i,j,k,l,m,n for Nat;

theorem REV:
  for f be FinSequence holds f = (Rev f)*(Rev (idseq len f))
proof
  let f be FinSequence;
  reconsider P = (Rev (idseq (len f))) as Permutation of dom (Rev f) by RFP;
  reconsider g = (Rev f)*P as FinSequence;
  A1: dom f = dom (Rev f) by FINSEQ_5:57
  .= dom ((Rev f)*P) by DR;
  for x be object st x in dom f holds f.x = g.x
  proof
    set n=len f;
    let x be object such that
    B1: x in dom f;
    reconsider x as Nat by B1;
    B2: 1 <= x <= n by B1,FINSEQ_3:25; then
    reconsider m = x-1 as Nat;
    reconsider k = n - x as Element of NAT by B2,NAT_1:21;
    set l = k+1;
    1+0 <= l <= k+x by B2,XREAL_1:6; then
    l in dom f by FINSEQ_3:25; then
    B3: l in dom Rev f by FINSEQ_5:57;
    g.x = (Rev f).(Rev (idseq (m+l)).(m+1)) by A1,B1,FUNCT_1:12
    .= f.(n-l+1) by B3,FINSEQ_5:def 3
    .= f.x;
    hence thesis;
  end;
  hence thesis by A1,FUNCT_1:2;
end;
