
theorem Th15:
  for n being Ordinal, T being connected TermOrder of n, b1,b2
being bag of n holds min(b1,b2,T) = min(b2,b1,T) & max(b1,b2,T) = max(b2,b1,T)
proof
  let n being Ordinal, T being connected TermOrder of n, b1,b2 being bag of n;
  now
    per cases;
    case
A1:   min(b1,b2,T) = b1;
      now
        per cases by A1,Def4;
        case
A2:       b1 <= b2,T;
          now
            per cases;
            case
              b1 = b2;
              hence min(b2,b1,T) = min(b1,b2,T);
            end;
            case
              b1 <> b2;
              then not b2 <= b1,T by A2,Lm3;
              hence min(b2,b1,T) = min(b1,b2,T) by A1,Def4;
            end;
          end;
          hence min(b1,b2,T) = min(b2,b1,T);
        end;
        case
          b1 = b2;
          hence min(b2,b1,T) = min(b1,b2,T);
        end;
      end;
      hence min(b1,b2,T) = min(b2,b1,T);
    end;
    case
A3:   min(b1,b2,T) <> b1;
A4:   now
        assume not b2 <= b1,T;
        then b1 <= b2,T by Lm5;
        hence contradiction by A3,Def4;
      end;
      thus min(b1,b2,T) = b2 by A3,Th11
        .= min(b2,b1,T) by A4,Def4;
    end;
  end;
  hence min(b1,b2,T) = min(b2,b1,T);
  now
    per cases;
    case
A5:   max(b1,b2,T) = b1;
      now
        per cases by A5,Def5;
        case
A6:       b2 <= b1,T;
          now
            per cases;
            case
              b1 = b2;
              hence max(b2,b1,T) = max(b1,b2,T);
            end;
            case
              b1 <> b2;
              then not b1 <= b2,T by A6,Lm3;
              hence max(b2,b1,T) = max(b1,b2,T) by A5,Def5;
            end;
          end;
          hence thesis;
        end;
        case
          b1 = b2;
          hence max(b2,b1,T) = max(b1,b2,T);
        end;
      end;
      hence thesis;
    end;
    case
A7:   max(b1,b2,T) <> b1;
      now
        per cases by Lm5;
        case
          b1 <= b2,T;
          hence max(b2,b1,T) = b2 by Def5
            .= max(b1,b2,T) by A7,Th12;
        end;
        case
          b2 <= b1,T;
          hence max(b2,b1,T) = max(b1,b2,T) by A7,Def5;
        end;
      end;
      hence max(b2,b1,T) = max(b1,b2,T);
    end;
  end;
  hence thesis;
end;
