(* Predicate that takes a vertex with high degree (> K) *)
Definition high_deg (K: nat) (n: node) (adj: nodeset) : bool := K <? S.cardinal adj.
Definition injective {A B} (f : A -> B) := forall x y, f x = f y -> x = y.
Local Open Scope positive_scope.
(* Wigderson's algorithm definition  let G be a graph, |G.v| = k a vertex v is high-degree if deg(v) > k^2 phase1 is selecting the high-degree vertices and coloring their neighborhoods phase2 is coloring the remaining nodes with at most sqrt(k) colors *)
Function selectW (K: nat) (g: graph) {measure M.cardinal g} : list node :=
match S.choose (subset_nodes (high_deg K) g) with
| Some n => n :: selectW K (remove_node n g)
| None => nil
end.

(* If v is in the list returned by selectW then the cardinality of v is indeed high. *)
Lemma select_hi_deg : forall n g v, In v (selectW n g) -> (S.cardinal (adj g v) > n)%nat.