reserve n for Nat;

theorem Th8:
  for f be FinSequence st f is almost-one-to-one holds Rev f is
  almost-one-to-one
proof
  let f be FinSequence;
  assume
A1: f is almost-one-to-one;
  let i,j be Nat;
  assume that
A2: i in dom Rev f and
A3: j in dom Rev f and
A4: i <> 1 or j <> len Rev f and
A5: i <> len Rev f or j <> 1 and
A6: Rev f.i = Rev f.j;
A7: not(len f - i + 1 = len f & len f - j + 1 = 1) by A4,FINSEQ_5:def 3;
A8: dom f = dom Rev f by FINSEQ_5:57;
  then i in Seg len f by A2,FINSEQ_1:def 3;
  then len f - i + 1 in Seg len f by FINSEQ_5:2;
  then
A9: len f - i + 1 in dom f by FINSEQ_1:def 3;
A10: Rev f.j = f.(len f - j + 1) by A3,FINSEQ_5:def 3;
A11: Rev f.i = f.(len f - i + 1) by A2,FINSEQ_5:def 3;
  j in Seg len f by A3,A8,FINSEQ_1:def 3;
  then len f - j + 1 in Seg len f by FINSEQ_5:2;
  then
A12: len f - j + 1 in dom f by FINSEQ_1:def 3;
  not(len f - i + 1 = 1 & len f - j + 1 = len f) by A5,FINSEQ_5:def 3;
  then len f - i + 1 = len f - j + 1 by A1,A6,A9,A12,A7,A11,A10;
  hence thesis;
end;
