reserve X,Z for set;
reserve x,y,z for object;
reserve A,B,C for Subset of X;

theorem Th73:
  for A being RelStr, s being FinSequence of A holds
    s is weakly-ascending iff Rev(s) is weakly-descending
proof
  let A be RelStr, s be FinSequence of A;
  hereby
    assume A1: s is weakly-ascending;
    now
      let n, m be Nat;
      assume that
        A2: n in dom Rev(s) & m in dom Rev(s) and
        A3: n < m;
      set l = len s;
      A4: n in dom s & m in dom s by A2, FINSEQ_5:57;
      then A5: n in Seg l & m in Seg l by FINSEQ_1:def 3;
      then n <= l & m <= l by FINSEQ_1:1;
      then reconsider a = l - n + 1, b = l - m + 1 as Nat by FINSEQ_5:1;
      a in Seg l & b in Seg l by A5, FINSEQ_5:2;
      then A6: a in dom s & b in dom s by FINSEQ_1:def 3;
      A7: s/.b = s.b by A6, PARTFUN1:def 6
        .= (Rev s).m by A4, FINSEQ_5:58
        .= (Rev s)/.m by A2, PARTFUN1:def 6;
      A8: s/.a = s.a by A6, PARTFUN1:def 6
        .= (Rev s).n by A4, FINSEQ_5:58
        .= (Rev s)/.n by A2, PARTFUN1:def 6;
      a = l + 1 - n & b = l + 1 - m;
      then b < a by A3, XREAL_1:15;
      hence (Rev s)/.m <= (Rev s)/.n by A7, A8, A1, A6;
    end;
    hence Rev s is weakly-descending;
  end;
  assume A9: Rev s is weakly-descending;
  now
    let n, m be Nat;
    assume that
      A10: n in dom s & m in dom s and
      A11: n < m;
    set l = len Rev(s);
    n in dom Rev(s) & m in dom Rev(s) by A10, FINSEQ_5:57;
    then A12: n in Seg l & m in Seg l by FINSEQ_1:def 3;
    then n <= l & m <= l by FINSEQ_1:1;
    then reconsider a = l - n + 1, b = l - m + 1 as Nat by FINSEQ_5:1;
    A13: dom s = dom Rev(s) by FINSEQ_5:57;
    a in Seg l & b in Seg l by A12, FINSEQ_5:2;
    then A14: a in dom s & b in dom s by A13, FINSEQ_1:def 3;
    A15: s/.n = Rev(Rev(s)).n by A10, PARTFUN1:def 6
      .= (Rev s).a by A13, A10, FINSEQ_5:58
      .= (Rev s)/.a by A14, A13, PARTFUN1:def 6;
    A16: s/.m = Rev(Rev(s)).m by A10, PARTFUN1:def 6
      .= (Rev s).b by A13, A10, FINSEQ_5:58
      .= (Rev s)/.b by A14, A13, PARTFUN1:def 6;
    a = l + 1 - n & b = l + 1 - m;
    then b < a by A11, XREAL_1:15;
    hence s/.n <= s/.m by A15, A16, A9, A13, A14;
  end;
  hence thesis;
end;
