reserve n,m,k for Nat,
  x,y for set,
  r for Real;
reserve C,D for non empty finite set,
  a for FinSequence of bool D;

theorem Th2:
  for a be FinSequence holds a is ascending iff for n,m st n<=m & n
  in dom a & m in dom a holds a.n c= a.m
proof
  let A be FinSequence;
  thus A is ascending implies for n,m st n<=m & n in dom A & m in dom A holds
  A.n c= A.m
  proof
    defpred P[Nat] means for n st n<=$1 & n in dom A & $1 in dom A
    holds A.n c= A.$1;
    assume
A1: A is ascending;
A2: for m st P[m] holds P[m+1]
    proof
      let m;
      assume
A3:   P[m];
      let n;
      assume that
A4:   n<=m+1 and
A5:   n in dom A and
A6:   m+1 in dom A;
      now
        per cases;
        case
          n=m+1;
          hence thesis;
        end;
        case
          n<>m+1;
          then n<m+1 by A4,XXREAL_0:1;
          then
A7:       n<=m by NAT_1:13;
          1<=n by A5,FINSEQ_3:25;
          then
A8:       1<=m by A7,XXREAL_0:2;
A9:       m+1<=len A by A6,FINSEQ_3:25;
          m<=m+1 by NAT_1:11;
          then m<=len A by A9,XXREAL_0:2;
          then m in dom A by A8,FINSEQ_3:25;
          then
A10:      A.n c= A.m by A3,A5,A7;
          m<=len A - 1 by A9,XREAL_1:19;
          then A.m c= A.(m+1) by A1,A8;
          hence thesis by A10;
        end;
      end;
      hence thesis;
    end;
    let n,m;
    assume
A11: n<=m & n in dom A & m in dom A;
A12: P[ 0 ];
    for m holds P[m] from NAT_1:sch 2(A12,A2);
    hence thesis by A11;
  end;
  assume
A13: for n,m st n<=m & n in dom A & m in dom A holds A.n c= A.m;
  let n be Nat;
  assume that
A14: 1<=n and
A15: n<=len A - 1;
A16: n+1<=len A by A15,XREAL_1:19;
  n<=n+1 by NAT_1:11;
  then n<=len A by A16,XXREAL_0:2;
  then
A17: n in dom A by A14,FINSEQ_3:25;
  1<=n+1 by NAT_1:11;
  then n+1 in dom A by A16,FINSEQ_3:25;
  hence thesis by A13,A17,NAT_1:11;
end;
