Jo Devriendt
You were good at high-school math, regularly use spreadsheet formulas.
So you know about
arithmetic formulas and function application.
How would you go about this?
A friendly, small, simple (??) combinatorial programming language
Basic building blocks:
values
bool, int, string
total functions
type* -> type
FINDING...
FOUND WORLD
define color as {("BE","g"), ("DE","b"), ("FR","r"),
("LU","y"), ("NL","r")} default unknown.
declare color: string -> {"r", "g", "b", "y"}.
color("NL") != color("BE"). color("NL") != color("DE").
color("BE") != color("LU"). color("BE") != color("DE").
color("BE") != color("FR"). color("FR") != color("LU").
color("FR") != color("DE"). color("LU") != color("DE").
declare color: string -> {"r", "g", "b", "y"}.
// declare border: string, string -> bool.
decdef border as {("NL","BE"), ("NL","DE"),
("BE","LU"), ("BE","DE"), ("BE","FR"),
("FR","LU"), ("FR","DE"), ("LU","DE")}.
all [ color(x)!=color(y) for x,y where border(x,y) ].
"Fold-Map-Filter" expression
all [ color(x)!=color(y) for x,y where border(x,y) ].
Filter: select all x,y
where border(x,y)
holds
Fold: reduce those
color(x)!=color(y)
to true
iff all
are true
Map: map those x,y
to
color(x)!=color(y)
all
any
none
count
sum
product
min
max
distinct
same
odd
even
Done
To do
find |
count |
intersect |
inferences
- | @maximize | @minimize | @mode |
objectives
(3-valued) expression evaluation
true
true
false
0
18
implies
>=
drinksAlcohol()
age()
18
· · age() [0]
· >= [false]
· · 18
implies [true]
· drinksAlcohol() [true].
detailed UNSAT explanation
declare color: string -> {"r", "g", "b", "y"}.
decdef border as {("NL","BE"), ("NL","DE"),
("BE","LU"), ("BE","DE"), ("BE","FR"),
("FR","LU"), ("FR","DE"), ("LU","DE")}.
all [
color(x)!=color(y)
for x,y where border(x,y) ].
FOUND UNSATISFIABILITY
DETAILED BLOCKERS
Line 7: not color("BE")=color("DE")
Line 7: not color("BE")=color("FR")
Line 7: not color("BE")=color("LU")
Line 7: not color("DE")=color("FR")
Line 7: not color("DE")=color("LU")
Line 7: not color("FR")=color("LU")
FOUND UNSATISFIABILITY
BLOCKERS
Line 7: all[not color(x)=color(y) for x,y where border(x,y)]
Backend solver: Exact
Running
Learning