(* 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 a node m is removed from the graph then the cardinality of the adj set of a vertex v is decreasing. *)
Lemma cardinal_remove : forall g v m,
(S.cardinal (adj (remove_node m g) v) <= S.cardinal (adj g v))%nat.