(* 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.
(* Phase 1 of Wigderson *)
(* Let: - k: bound for degree of vertices - c: color currently used - g: graph - f: coloring - H: proof that g is 3-colorable - H1: proof that f is a complete coloring of g - Hf: proof that f is a 3-coloring  phase1(g,c): if a high degree vertex in g exists: v := select a high-degree vertex in g nbhd := neighborhood of v in g coloring_of_nbhd := 2-coloring of nbhd using c+1 and c+2 g' := remove nbhd from g return union(coloring_of_nbhd, phase1(g',c+2)) else: return empty coloring  *)
(* Two-coloring of neighborhood *)
Definition two_color_nbd (g : graph) (v : node) (c1 c2 : positive) : option coloring.
Admitted.

Lemma two_color_nbd_fail_n3_col : forall (g : graph) (v : node) c1 c2 c3,
c1 <> c2 ->
c1 <> c3 ->
c2 <> c3 ->
no_selfloop g ->
undirected g ->
M.In v g ->
two_color_nbd g v c1 c2 = None ->
~ (exists m, M.find v m = Some c3 /\ coloring_complete (SP.of_list [c1;c2;c3]) g m).