Article BAGORDER, MML version 4.99.1005

:: BAGORDER:th 1
theorem
for b1, b2, b3 being set
      st b3 in b1 & b3 in b2
   holds    b1 \ {b3} = b2 \ {b3}
   iff
      b1 = b2;

:: BAGORDER:th 2
theorem
for b1, b2 being Element of NAT holds
   b2 in Seg b1
iff
   b2 - 1 is Element of NAT & b2 - 1 < b1;

:: BAGORDER:funcreg 1
registration
  let a1 be Relation-like Function-like finite-support set;
  let a2 be set;
  cluster a1 | a2 -> Relation-like finite-support;
end;

:: BAGORDER:th 3
theorem
for b1 being Relation-like Function-like set
for b2 being set
      st b2 in proj1 b1
   holds <*b2*> * b1 = <*b1 . b2*>;

:: BAGORDER:th 4
theorem
for b1, b2, b3 being Relation-like Function-like set
      st proj1 b1 = proj1 b2 & proj2 b1 c= proj1 b3 & proj2 b2 c= proj1 b3 & b1,b2 are_fiberwise_equipotent
   holds b1 * b3,b2 * b3 are_fiberwise_equipotent;

:: BAGORDER:th 5
theorem
for b1 being FinSequence of NAT holds
      Sum b1 = 0
   iff
      b1 = (len b1) |-> 0;

:: BAGORDER:funcnot 1 => BAGORDER:func 1
definition
  let a1, a2, a3 be Element of NAT;
  let a4 be ManySortedSet of a1;
  func (A2,A3)-cut A4 -> ManySortedSet of a3 -' a2 means
    for b1 being Element of NAT
          st b1 in a3 -' a2
       holds it . b1 = a4 . (a2 + b1);
end;

:: BAGORDER:def 1
theorem
for b1, b2, b3 being Element of NAT
for b4 being ManySortedSet of b1
for b5 being ManySortedSet of b3 -' b2 holds
      b5 = (b2,b3)-cut b4
   iff
      for b6 being Element of NAT
            st b6 in b3 -' b2
         holds b5 . b6 = b4 . (b2 + b6);

:: BAGORDER:funcreg 2
registration
  let a1, a2, a3 be Element of NAT;
  let a4 be natural-valued ManySortedSet of a1;
  cluster (a2,a3)-cut a4 -> natural-valued;
end;

:: BAGORDER:funcreg 3
registration
  let a1, a2, a3 be Element of NAT;
  let a4 be finite-support ManySortedSet of a1;
  cluster (a2,a3)-cut a4 -> finite-support;
end;

:: BAGORDER:th 6
theorem
for b1, b2 being Element of NAT
for b3, b4 being ManySortedSet of b1 holds
   b3 = b4
iff
   (0,b2 + 1)-cut b3 = (0,b2 + 1)-cut b4 &
    (b2 + 1,b1)-cut b3 = (b2 + 1,b1)-cut b4;

:: BAGORDER:funcnot 2 => BAGORDER:func 2
definition
  let a1 be non empty set;
  let a2 be non empty Element of NAT;
  func Fin(A1,A2) -> set equals
    {b1 where b1 is Element of bool a1: b1 is finite & b1 is not empty & Card b1 c= a2};
end;

:: BAGORDER:def 2
theorem
for b1 being non empty set
for b2 being non empty Element of NAT holds
   Fin(b1,b2) = {b3 where b3 is Element of bool b1: b3 is finite & b3 is not empty & Card b3 c= b2};

:: BAGORDER:funcreg 4
registration
  let a1 be non empty set;
  let a2 be non empty Element of NAT;
  cluster Fin(a1,a2) -> non empty;
end;

:: BAGORDER:th 7
theorem
for b1 being non empty transitive antisymmetric RelStr
for b2 being finite Element of bool the carrier of b1
      st b2 <> {}
   holds ex b3 being Element of the carrier of b1 st
      b3 in b2 & b3 is_maximal_wrt b2,the InternalRel of b1;

:: BAGORDER:th 8
theorem
for b1 being non empty transitive antisymmetric RelStr
for b2 being finite Element of bool the carrier of b1
      st b2 <> {}
   holds ex b3 being Element of the carrier of b1 st
      b3 in b2 & b3 is_minimal_wrt b2,the InternalRel of b1;

:: BAGORDER:th 9
theorem
for b1 being non empty transitive antisymmetric RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1
   st b2 is descending(b1)
for b3, b4 being Element of NAT
      st b4 < b3
   holds b2 . b4 <> b2 . b3 &
    [b2 . b3,b2 . b4] in the InternalRel of b1;

:: BAGORDER:attrnot 1 => BAGORDER:attr 1
definition
  let a1 be non empty RelStr;
  let a2 be Function-like quasi_total Relation of NAT,the carrier of a1;
  attr a2 is non-increasing means
    for b1 being Element of NAT holds
       [a2 . (b1 + 1),a2 . b1] in the InternalRel of a1;
end;

:: BAGORDER:dfs 3
definiens
  let a1 be non empty RelStr;
  let a2 be Function-like quasi_total Relation of NAT,the carrier of a1;
To prove
     a2 is non-increasing
it is sufficient to prove
  thus for b1 being Element of NAT holds
       [a2 . (b1 + 1),a2 . b1] in the InternalRel of a1;

:: BAGORDER:def 3
theorem
for b1 being non empty RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1 holds
      b2 is non-increasing(b1)
   iff
      for b3 being Element of NAT holds
         [b2 . (b3 + 1),b2 . b3] in the InternalRel of b1;

:: BAGORDER:th 10
theorem
for b1 being non empty transitive RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1
   st b2 is non-increasing(b1)
for b3, b4 being Element of NAT
      st b4 < b3
   holds [b2 . b3,b2 . b4] in the InternalRel of b1;

:: BAGORDER:th 11
theorem
for b1 being non empty transitive RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1
      st b1 is well_founded & b2 is non-increasing(b1)
   holds ex b3 being Element of NAT st
      for b4 being Element of NAT
            st b3 <= b4
         holds b2 . b3 = b2 . b4;

:: BAGORDER:th 12
theorem
for b1 being set
for b2 being Element of b1
for b3 being finite Element of bool b1
for b4 being total reflexive antisymmetric transitive Relation of b1,b1
      st b3 = {b2} & b4 linearly_orders b3
   holds SgmX(b4,b3) = <*b2*>;

:: BAGORDER:funcnot 3 => BAGORDER:func 3
definition
  let a1 be ordinal set;
  let a2 be natural-valued finite-support ManySortedSet of a1;
  func TotDegree A2 -> Element of NAT means
    ex b1 being FinSequence of NAT st
       it = Sum b1 & b1 = a2 * SgmX(RelIncl a1,support a2);
end;

:: BAGORDER:def 4
theorem
for b1 being ordinal set
for b2 being natural-valued finite-support ManySortedSet of b1
for b3 being Element of NAT holds
      b3 = TotDegree b2
   iff
      ex b4 being FinSequence of NAT st
         b3 = Sum b4 & b4 = b2 * SgmX(RelIncl b1,support b2);

:: BAGORDER:th 13
theorem
for b1 being ordinal set
for b2 being natural-valued finite-support ManySortedSet of b1
for b3 being finite Element of bool b1
for b4, b5 being FinSequence of NAT
      st b4 = b2 * SgmX(RelIncl b1,support b2) &
         b5 = b2 * SgmX(RelIncl b1,(support b2) \/ b3)
   holds Sum b4 = Sum b5;

:: BAGORDER:th 14
theorem
for b1 being ordinal set
for b2, b3 being natural-valued finite-support ManySortedSet of b1 holds
TotDegree (b2 + b3) = (TotDegree b2) + TotDegree b3;

:: BAGORDER:th 15
theorem
for b1 being ordinal set
for b2, b3 being natural-valued finite-support ManySortedSet of b1
      st b3 divides b2
   holds TotDegree (b2 -' b3) = (TotDegree b2) - TotDegree b3;

:: BAGORDER:th 16
theorem
for b1 being ordinal set
for b2 being natural-valued finite-support ManySortedSet of b1 holds
      TotDegree b2 = 0
   iff
      b2 = EmptyBag b1;

:: BAGORDER:th 17
theorem
for b1, b2, b3 being Element of NAT holds
(b1,b2)-cut EmptyBag b3 = EmptyBag (b2 -' b1);

:: BAGORDER:th 18
theorem
for b1, b2, b3 being Element of NAT
for b4, b5 being natural-valued finite-support ManySortedSet of b3 holds
(b1,b2)-cut (b4 + b5) = ((b1,b2)-cut b4) + ((b1,b2)-cut b5);

:: BAGORDER:th 19
theorem
for b1 being set holds
   support EmptyBag b1 = {};

:: BAGORDER:th 20
theorem
for b1 being set
for b2 being natural-valued finite-support ManySortedSet of b1
      st support b2 = {}
   holds b2 = EmptyBag b1;

:: BAGORDER:th 21
theorem
for b1, b2 being ordinal set
for b3 being natural-valued finite-support ManySortedSet of b1
      st b2 in b1
   holds b3 | b2 is natural-valued finite-support ManySortedSet of b2;

:: BAGORDER:th 22
theorem
for b1 being ordinal set
for b2, b3 being natural-valued finite-support ManySortedSet of b1
      st b3 divides b2
   holds support b3 c= support b2;

:: BAGORDER:modenot 1
definition
  let a1 be set;
  mode TermOrder of a1 is total reflexive antisymmetric transitive Relation of Bags a1,Bags a1;
end;

:: BAGORDER:funcnot 4 => POLYNOM1:func 16
notation
  let a1 be ordinal set;
  synonym LexOrder a1 for BagOrder a1;
end;

:: BAGORDER:attrnot 2 => BAGORDER:attr 2
definition
  let a1 be ordinal set;
  let a2 be total reflexive antisymmetric transitive Relation of Bags a1,Bags a1;
  attr a2 is admissible means
    a2 is_strongly_connected_in Bags a1 &
     (for b1 being natural-valued finite-support ManySortedSet of a1 holds
        [EmptyBag a1,b1] in a2) &
     (for b1, b2, b3 being natural-valued finite-support ManySortedSet of a1
           st [b1,b2] in a2
        holds [b1 + b3,b2 + b3] in a2);
end;

:: BAGORDER:dfs 5
definiens
  let a1 be ordinal set;
  let a2 be total reflexive antisymmetric transitive Relation of Bags a1,Bags a1;
To prove
     a2 is admissible
it is sufficient to prove
  thus a2 is_strongly_connected_in Bags a1 &
     (for b1 being natural-valued finite-support ManySortedSet of a1 holds
        [EmptyBag a1,b1] in a2) &
     (for b1, b2, b3 being natural-valued finite-support ManySortedSet of a1
           st [b1,b2] in a2
        holds [b1 + b3,b2 + b3] in a2);

:: BAGORDER:def 7
theorem
for b1 being ordinal set
for b2 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1 holds
      b2 is admissible(b1)
   iff
      b2 is_strongly_connected_in Bags b1 &
       (for b3 being natural-valued finite-support ManySortedSet of b1 holds
          [EmptyBag b1,b3] in b2) &
       (for b3, b4, b5 being natural-valued finite-support ManySortedSet of b1
             st [b3,b4] in b2
          holds [b3 + b5,b4 + b5] in b2);

:: BAGORDER:th 23
theorem
for b1 being ordinal set holds
   BagOrder b1 is admissible(b1);

:: BAGORDER:exreg 1
registration
  let a1 be ordinal set;
  cluster Relation-like total reflexive antisymmetric transitive admissible Relation of Bags a1,Bags a1;
end;

:: BAGORDER:funcreg 5
registration
  let a1 be ordinal set;
  cluster BagOrder a1 -> total reflexive antisymmetric transitive admissible;
end;

:: BAGORDER:th 24
theorem
for b1 being ordinal infinite set holds
   BagOrder b1 is not well-ordering;

:: BAGORDER:funcnot 5 => BAGORDER:func 4
definition
  let a1 be ordinal set;
  func InvLexOrder A1 -> total reflexive antisymmetric transitive Relation of Bags a1,Bags a1 means
    for b1, b2 being natural-valued finite-support ManySortedSet of a1 holds
       [b1,b2] in it
    iff
       (not b1 = b2 implies ex b3 being ordinal set st
          b3 in a1 &
           b1 . b3 < b2 . b3 &
           (for b4 being ordinal set
                 st b3 in b4 & b4 in a1
              holds b1 . b4 = b2 . b4));
end;

:: BAGORDER:def 8
theorem
for b1 being ordinal set
for b2 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1 holds
      b2 = InvLexOrder b1
   iff
      for b3, b4 being natural-valued finite-support ManySortedSet of b1 holds
         [b3,b4] in b2
      iff
         (not b3 = b4 implies ex b5 being ordinal set st
            b5 in b1 &
             b3 . b5 < b4 . b5 &
             (for b6 being ordinal set
                   st b5 in b6 & b6 in b1
                holds b3 . b6 = b4 . b6));

:: BAGORDER:th 25
theorem
for b1 being ordinal set holds
   InvLexOrder b1 is admissible(b1);

:: BAGORDER:funcreg 6
registration
  let a1 be ordinal set;
  cluster InvLexOrder a1 -> total reflexive antisymmetric transitive admissible;
end;

:: BAGORDER:th 26
theorem
for b1 being ordinal set holds
   InvLexOrder b1 is well-ordering;

:: BAGORDER:funcnot 6 => BAGORDER:func 5
definition
  let a1 be ordinal set;
  let a2 be total reflexive antisymmetric transitive Relation of Bags a1,Bags a1;
  assume for b1, b2, b3 being natural-valued finite-support ManySortedSet of a1
          st [b1,b2] in a2
       holds [b1 + b3,b2 + b3] in a2;
  func Graded A2 -> total reflexive antisymmetric transitive Relation of Bags a1,Bags a1 means
    for b1, b2 being natural-valued finite-support ManySortedSet of a1 holds
       [b1,b2] in it
    iff
       (TotDegree b2 <= TotDegree b1 implies TotDegree b1 = TotDegree b2 & [b1,b2] in a2);
end;

:: BAGORDER:def 9
theorem
for b1 being ordinal set
for b2 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1
   st for b3, b4, b5 being natural-valued finite-support ManySortedSet of b1
           st [b3,b4] in b2
        holds [b3 + b5,b4 + b5] in b2
for b3 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1 holds
      b3 = Graded b2
   iff
      for b4, b5 being natural-valued finite-support ManySortedSet of b1 holds
         [b4,b5] in b3
      iff
         (TotDegree b5 <= TotDegree b4 implies TotDegree b4 = TotDegree b5 & [b4,b5] in b2);

:: BAGORDER:th 27
theorem
for b1 being ordinal set
for b2 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1
      st (for b3, b4, b5 being natural-valued finite-support ManySortedSet of b1
               st [b3,b4] in b2
            holds [b3 + b5,b4 + b5] in b2) &
         b2 is_strongly_connected_in Bags b1
   holds Graded b2 is admissible(b1);

:: BAGORDER:funcnot 7 => BAGORDER:func 6
definition
  let a1 be ordinal set;
  func GrLexOrder A1 -> total reflexive antisymmetric transitive Relation of Bags a1,Bags a1 equals
    Graded BagOrder a1;
end;

:: BAGORDER:def 10
theorem
for b1 being ordinal set holds
   GrLexOrder b1 = Graded BagOrder b1;

:: BAGORDER:funcnot 8 => BAGORDER:func 7
definition
  let a1 be ordinal set;
  func GrInvLexOrder A1 -> total reflexive antisymmetric transitive Relation of Bags a1,Bags a1 equals
    Graded InvLexOrder a1;
end;

:: BAGORDER:def 11
theorem
for b1 being ordinal set holds
   GrInvLexOrder b1 = Graded InvLexOrder b1;

:: BAGORDER:th 28
theorem
for b1 being ordinal set holds
   GrLexOrder b1 is admissible(b1);

:: BAGORDER:funcreg 7
registration
  let a1 be ordinal set;
  cluster GrLexOrder a1 -> total reflexive antisymmetric transitive admissible;
end;

:: BAGORDER:th 29
theorem
for b1 being ordinal infinite set holds
   GrLexOrder b1 is not well-ordering;

:: BAGORDER:th 30
theorem
for b1 being ordinal set holds
   GrInvLexOrder b1 is admissible(b1);

:: BAGORDER:funcreg 8
registration
  let a1 be ordinal set;
  cluster GrInvLexOrder a1 -> total reflexive antisymmetric transitive admissible;
end;

:: BAGORDER:th 31
theorem
for b1 being ordinal set holds
   GrInvLexOrder b1 is well-ordering;

:: BAGORDER:funcnot 9 => BAGORDER:func 8
definition
  let a1, a2 be Element of NAT;
  let a3 be total reflexive antisymmetric transitive Relation of Bags (a1 + 1),Bags (a1 + 1);
  let a4 be total reflexive antisymmetric transitive Relation of Bags (a2 -' (a1 + 1)),Bags (a2 -' (a1 + 1));
  func BlockOrder(A1,A2,A3,A4) -> total reflexive antisymmetric transitive Relation of Bags a2,Bags a2 means
    for b1, b2 being natural-valued finite-support ManySortedSet of a2 holds
       [b1,b2] in it
    iff
       ((0,a1 + 1)-cut b1 <> (0,a1 + 1)-cut b2 &
        [(0,a1 + 1)-cut b1,(0,a1 + 1)-cut b2] in a3 or (0,a1 + 1)-cut b1 = (0,a1 + 1)-cut b2 &
        [(a1 + 1,a2)-cut b1,(a1 + 1,a2)-cut b2] in a4);
end;

:: BAGORDER:def 12
theorem
for b1, b2 being Element of NAT
for b3 being total reflexive antisymmetric transitive Relation of Bags (b1 + 1),Bags (b1 + 1)
for b4 being total reflexive antisymmetric transitive Relation of Bags (b2 -' (b1 + 1)),Bags (b2 -' (b1 + 1))
for b5 being total reflexive antisymmetric transitive Relation of Bags b2,Bags b2 holds
      b5 = BlockOrder(b1,b2,b3,b4)
   iff
      for b6, b7 being natural-valued finite-support ManySortedSet of b2 holds
         [b6,b7] in b5
      iff
         ((0,b1 + 1)-cut b6 <> (0,b1 + 1)-cut b7 &
          [(0,b1 + 1)-cut b6,(0,b1 + 1)-cut b7] in b3 or (0,b1 + 1)-cut b6 = (0,b1 + 1)-cut b7 &
          [(b1 + 1,b2)-cut b6,(b1 + 1,b2)-cut b7] in b4);

:: BAGORDER:th 32
theorem
for b1, b2 being Element of NAT
for b3 being total reflexive antisymmetric transitive Relation of Bags (b1 + 1),Bags (b1 + 1)
for b4 being total reflexive antisymmetric transitive Relation of Bags (b2 -' (b1 + 1)),Bags (b2 -' (b1 + 1))
      st b3 is admissible(b1 + 1) & b4 is admissible(b2 -' (b1 + 1))
   holds BlockOrder(b1,b2,b3,b4) is admissible(b2);

:: BAGORDER:funcnot 10 => BAGORDER:func 9
definition
  let a1 be Element of NAT;
  func NaivelyOrderedBags A1 -> strict RelStr means
    the carrier of it = Bags a1 &
     (for b1, b2 being natural-valued finite-support ManySortedSet of a1 holds
        [b1,b2] in the InternalRel of it
     iff
        b1 divides b2);
end;

:: BAGORDER:def 13
theorem
for b1 being Element of NAT
for b2 being strict RelStr holds
      b2 = NaivelyOrderedBags b1
   iff
      the carrier of b2 = Bags b1 &
       (for b3, b4 being natural-valued finite-support ManySortedSet of b1 holds
          [b3,b4] in the InternalRel of b2
       iff
          b3 divides b4);

:: BAGORDER:th 33
theorem
for b1 being Element of NAT holds
   the carrier of product (b1 --> OrderedNAT) = Bags b1;

:: BAGORDER:th 34
theorem
for b1 being Element of NAT holds
   NaivelyOrderedBags b1 = product (b1 --> OrderedNAT);

:: BAGORDER:th 35
theorem
for b1 being Element of NAT
for b2 being total reflexive antisymmetric transitive Relation of Bags b1,Bags b1
      st b2 is admissible(b1)
   holds the InternalRel of NaivelyOrderedBags b1 c= b2 & b2 is well-ordering;

:: BAGORDER:funcnot 11 => BAGORDER:func 10
definition
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  let a2 be Element of Fin the carrier of a1;
  assume a2 is not empty;
  func PosetMin A2 -> Element of the carrier of a1 means
    it in a2 & it is_minimal_wrt a2,the InternalRel of a1;
end;

:: BAGORDER:def 14
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2 being Element of Fin the carrier of b1
   st b2 is not empty
for b3 being Element of the carrier of b1 holds
      b3 = PosetMin b2
   iff
      b3 in b2 & b3 is_minimal_wrt b2,the InternalRel of b1;

:: BAGORDER:funcnot 12 => BAGORDER:func 11
definition
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  let a2 be Element of Fin the carrier of a1;
  assume a2 is not empty;
  func PosetMax A2 -> Element of the carrier of a1 means
    it in a2 & it is_maximal_wrt a2,the InternalRel of a1;
end;

:: BAGORDER:def 15
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2 being Element of Fin the carrier of b1
   st b2 is not empty
for b3 being Element of the carrier of b1 holds
      b3 = PosetMax b2
   iff
      b3 in b2 & b3 is_maximal_wrt b2,the InternalRel of b1;

:: BAGORDER:funcnot 13 => BAGORDER:func 12
definition
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  func FinOrd-Approx A1 -> Function-like quasi_total Relation of NAT,bool [:Fin the carrier of a1,Fin the carrier of a1:] means
    dom it = NAT &
     it . 0 = {[b1,b2] where b1 is Element of Fin the carrier of a1, b2 is Element of Fin the carrier of a1: (b1 = {} or b1 <> {} &
      b2 <> {} &
      PosetMax b1 <> PosetMax b2 &
      [PosetMax b1,PosetMax b2] in the InternalRel of a1)} &
     (for b1 being natural set holds
        it . (b1 + 1) = {[b2,b3] where b2 is Element of Fin the carrier of a1, b3 is Element of Fin the carrier of a1: b2 <> {} &
         b3 <> {} &
         PosetMax b2 = PosetMax b3 &
         [b2 \ {PosetMax b2},b3 \ {PosetMax b3}] in it . b1});
end;

:: BAGORDER:def 16
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2 being Function-like quasi_total Relation of NAT,bool [:Fin the carrier of b1,Fin the carrier of b1:] holds
      b2 = FinOrd-Approx b1
   iff
      dom b2 = NAT &
       b2 . 0 = {[b3,b4] where b3 is Element of Fin the carrier of b1, b4 is Element of Fin the carrier of b1: (b3 = {} or b3 <> {} &
        b4 <> {} &
        PosetMax b3 <> PosetMax b4 &
        [PosetMax b3,PosetMax b4] in the InternalRel of b1)} &
       (for b3 being natural set holds
          b2 . (b3 + 1) = {[b4,b5] where b4 is Element of Fin the carrier of b1, b5 is Element of Fin the carrier of b1: b4 <> {} &
           b5 <> {} &
           PosetMax b4 = PosetMax b5 &
           [b4 \ {PosetMax b4},b5 \ {PosetMax b5}] in b2 . b3});

:: BAGORDER:th 36
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2, b3 being Element of Fin the carrier of b1 holds
   [b2,b3] in union proj2 FinOrd-Approx b1
iff
   (b2 <> {} &
    (b2 <> {} & b3 <> {} & PosetMax b2 <> PosetMax b3 implies not [PosetMax b2,PosetMax b3] in the InternalRel of b1) implies b2 <> {} &
    b3 <> {} &
    PosetMax b2 = PosetMax b3 &
    [b2 \ {PosetMax b2},b3 \ {PosetMax b3}] in union proj2 FinOrd-Approx b1);

:: BAGORDER:th 37
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2 being Element of Fin the carrier of b1
      st b2 <> {}
   holds not [b2,{}] in union proj2 FinOrd-Approx b1;

:: BAGORDER:th 38
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2 being Element of Fin the carrier of b1 holds
   b2 \ {PosetMax b2} is Element of Fin the carrier of b1;

:: BAGORDER:th 39
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr holds
   union proj2 FinOrd-Approx b1 is total reflexive antisymmetric transitive Relation of Fin the carrier of b1,Fin the carrier of b1;

:: BAGORDER:funcnot 14 => BAGORDER:func 13
definition
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  func FinOrd A1 -> total reflexive antisymmetric transitive Relation of Fin the carrier of a1,Fin the carrier of a1 equals
    union proj2 FinOrd-Approx a1;
end;

:: BAGORDER:def 17
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr holds
   FinOrd b1 = union proj2 FinOrd-Approx b1;

:: BAGORDER:funcnot 15 => BAGORDER:func 14
definition
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  func FinPoset A1 -> reflexive transitive antisymmetric RelStr equals
    RelStr(#Fin the carrier of a1,FinOrd a1#);
end;

:: BAGORDER:def 18
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr holds
   FinPoset b1 = RelStr(#Fin the carrier of b1,FinOrd b1#);

:: BAGORDER:funcreg 9
registration
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  cluster FinPoset a1 -> non empty reflexive transitive antisymmetric;
end;

:: BAGORDER:th 40
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
for b2, b3 being Element of the carrier of FinPoset b1 holds
   [b2,b3] in the InternalRel of FinPoset b1
iff
   ex b4, b5 being Element of Fin the carrier of b1 st
      b2 = b4 &
       b3 = b5 &
       (b4 <> {} &
        (b4 <> {} & b5 <> {} & PosetMax b4 <> PosetMax b5 implies not [PosetMax b4,PosetMax b5] in the InternalRel of b1) implies b4 <> {} &
        b5 <> {} &
        PosetMax b4 = PosetMax b5 &
        [b4 \ {PosetMax b4},b5 \ {PosetMax b5}] in FinOrd b1);

:: BAGORDER:funcreg 10
registration
  let a1 be non empty reflexive transitive antisymmetric connected RelStr;
  cluster FinPoset a1 -> reflexive transitive antisymmetric connected;
end;

:: BAGORDER:funcnot 16 => BAGORDER:func 15
definition
  let a1 be non empty connected RelStr;
  let a2 be non empty set;
  assume a1 is well_founded & a2 c= the carrier of a1;
  func MinElement(A2,A1) -> Element of the carrier of a1 means
    it in a2 & it is_minimal_wrt a2,the InternalRel of a1;
end;

:: BAGORDER:def 19
theorem
for b1 being non empty connected RelStr
for b2 being non empty set
   st b1 is well_founded & b2 c= the carrier of b1
for b3 being Element of the carrier of b1 holds
      b3 = MinElement(b2,b1)
   iff
      b3 in b2 & b3 is_minimal_wrt b2,the InternalRel of b1;

:: BAGORDER:funcnot 17 => BAGORDER:func 16
definition
  let a1 be non empty RelStr;
  let a2 be Function-like quasi_total Relation of NAT,the carrier of a1;
  let a3 be Element of NAT;
  func SeqShift(A2,A3) -> Function-like quasi_total Relation of NAT,the carrier of a1 means
    for b1 being Element of NAT holds
       it . b1 = a2 . (b1 + a3);
end;

:: BAGORDER:def 20
theorem
for b1 being non empty RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1
for b3 being Element of NAT
for b4 being Function-like quasi_total Relation of NAT,the carrier of b1 holds
      b4 = SeqShift(b2,b3)
   iff
      for b5 being Element of NAT holds
         b4 . b5 = b2 . (b5 + b3);

:: BAGORDER:th 41
theorem
for b1 being non empty RelStr
for b2 being Function-like quasi_total Relation of NAT,the carrier of b1
for b3 being Element of NAT
      st b2 is descending(b1)
   holds SeqShift(b2,b3) is descending(b1);

:: BAGORDER:th 42
theorem
for b1 being non empty reflexive transitive antisymmetric connected RelStr
      st b1 is well_founded
   holds FinPoset b1 is well_founded;