Color Any Map With Only 4 Colors (and Logical Programming)


Details
In this meeting, I'll try to showcase a different way to look at programming. In the past, with Sudoku solvers, we've looked at constraint programming with a more procedural approach. In this meeting though, I want to show off logical (or declarative) programming.
Some of you may already be familiar with this style, as SQL borrows from it. But the idea is that instead of programming based on the order of solving an expression, you instead "declare" the logical relationships between entities and then query those relationships to see if they hold. So for instance if I know that Alice is the mother of Bob, and Bob is the father of Chris, then I know Alice is Chris's grandmother as long as I've defined grandmother to be the female parent of either of an individual's parents.
As an example of how this works, we'll be looking at the Four Color Theorem (https://en.wikipedia.org/wiki/Four_color_theorem) which states that any planar map can be filled in with only four colors and never have two bordering shapes with the same color. I'll be showing off how this looks using logical programming and see if it's any more elegant than the constraint alternative.

Color Any Map With Only 4 Colors (and Logical Programming)