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

theorem Th89:
  for A being transitive RelStr, B being finite Subset of A st
    the InternalRel of A is_connected_in B holds
      ex s being FinSequence of A st s is B-asc_ordering
proof
  let A be transitive RelStr;
  let B be finite Subset of A;
  assume A1: the InternalRel of A is_connected_in B;
  defpred P[Nat] means for C being Subset of A st C c= B & card C = $1 holds
    ex s being FinSequence of A st s is C-asc_ordering;
  A2: P[0]
  proof
    let C be Subset of A;
    assume C c= B & card C = 0;
    then A3: C = {}the carrier of A;
    reconsider s = <*>the carrier of A as FinSequence of A;
    take s;
    thus thesis by A3;
  end;
  A4: for k be Nat st P[k] holds P[k + 1]
  proof
    let k be Nat;
    assume A5: P[k];
    for C being Subset of A st C c= B & card C = k+1 holds
      ex s being FinSequence of A st s is C-asc_ordering
    proof
      let C be Subset of A;
      assume A6: C c= B & card C = k+1;
      per cases;
      suppose k = 0;
        then A7: card C = 1 by A6;
        set x = the Element of C;
        A8: C is non empty by A7;
        then A9: {x} = C by A7, Th2;
        then x in C;
        then reconsider x as Element of A;
        set s = <*x*>;
        reconsider s as FinSequence of A by A8, FINSEQ_1:74;
        take s;
        thus thesis by A9, Th82;
      end;
      suppose k > 0;
        A10: C is non empty by A6;
        reconsider C as finite Subset of A by A6;
        the InternalRel of A is_connected_in C by A1, A6, Th16;
        then consider x being Element of A such that A11: x in C &
          for y being Element of A st y in C & x <> y holds
            x <= y by A10, Th31;
        set D = C \ {x};
        reconsider D as Subset of A;
        A12: D c= C by XBOOLE_1:36;
        then A13: D c= B by A6;
        card D = card C - card {x} by A11, ZFMISC_1:31, CARD_2:44
          .= k + 1 - 1 by A6, CARD_1:30
          .= k;
        then consider s1 being FinSequence of A such that
          A14: s1 is D-asc_ordering by A5, A13;
        A15: not x in D by ZFMISC_1:56;
        A16: for y being Element of A st y in D holds
          x <= y
        proof
          let y be Element of A such that A17: y in D;
          A18: x <> y by A17, ZFMISC_1:56;
          y in C by A17, A12;
          hence thesis by A11, A18;
        end;
        C = D \/ {x} by A11, ZFMISC_1:116;
        then consider s2 being FinSequence of A such that
   A19: s2 = <*x*> ^ s1 & s2 is C-asc_ordering by A14, A16, A15, Th85;
        take s2;
        thus thesis by A19;
      end;
    end;
    hence P[k+1];
  end;
  A20: for k being Nat holds P[k] from NAT_1:sch 2(A2, A4);
  reconsider cardB = card B as Nat;
  P[cardB] by A20;
  hence thesis;
end;
