
theorem
  for G being with_max_degree _Graph
  holds G is with_max_in_degree or G is with_max_out_degree
proof
  let G be with_max_degree _Graph;
  consider v being Vertex of G such that
    A1: v.degree() = G.supDegree() and
    for w being Vertex of G holds w.degree() c= v.degree() by Th79;
  set a = v.inDegree(), b = v.outDegree();
  per cases;
  suppose a c= b & b is infinite;
    then v.degree() = b by CARD_2:76;
    then A2: G.supOutDegree() c= v.outDegree() by A1, Th40;
    v.outDegree() c= G.supOutDegree() by Th35;
    hence thesis by A2, Lm5, XBOOLE_0:def 10;
  end;
  suppose b c= a & a is infinite;
    then v.degree() = a by CARD_2:76;
    then A3: G.supInDegree() c= v.inDegree() by A1, Th39;
    v.inDegree() c= G.supInDegree() by Th35;
    hence thesis by A3, Lm4, XBOOLE_0:def 10;
  end;
  suppose a is finite & b is finite;
    then reconsider a, b as Nat;
    now
      defpred P[Nat] means ex u being Vertex of G st u.inDegree() = $1;
      A4: for k being Nat st P[k] holds k <= a+b
      proof
        let k be Nat;
        given u being Vertex of G such that
          A5: u.inDegree() = k;
        A6: u.inDegree() c= G.supInDegree() by Th35;
        G.supInDegree() c= G.supDegree() by Th39;
        then Segm u.inDegree() c= Segm(a+`b) by A1, A6, XBOOLE_1:1;
        hence thesis by A5, NAT_1:39;
      end;
      A7: ex k being Nat st P[k]
      proof
        take a, v;
        thus thesis;
      end;
      consider k being Nat such that
        A8: P[k] & for n being Nat st P[n] holds n <= k
        from NAT_1:sch 6(A4,A7);
      consider u being Vertex of G such that
        A9: u.inDegree() = k by A8;
      take u;
      let w be Vertex of G;
      A10: w.inDegree() c= G.supInDegree() by Th35;
      G.supInDegree() c= G.supDegree() by Th39;
      then w.inDegree() c= a+`b by A1, A10, XBOOLE_1:1;
      then reconsider d = w.inDegree() as Nat;
      Segm d c= Segm k by A8, NAT_1:39;
      hence w.inDegree() c= u.inDegree() by A9;
    end;
    hence thesis;
  end;
end;
