describe periodic (juggling) patterns in first-order logic and find models via constraint programming
OTHER License
Contents of a pattern description file (examples/simple.lj)
persons 4
period 3
forall throw t : height t == time 3 || height t == time 4
forall person p : exactly 1 throw t : p == from t && self t && height t == time 3
atmost 5 throw t : height t == time 4
Building the console version:
stack install
Running the console version:
logical-juggling-console examples/simple.lj
will output this:
A : 3->D , 3 , 3->D ,
B : 3 , 3->C , 4->A ,
C : 4->B , 4->A , 3 ,
D : 3->C , 3 , 3->B ,
t
has four parameters:
from t
: the person it comes from,begin t
: the time it is thrown,to t
: the person it goes to,end t
: the time it is caught.These restrictions are not inherent to the method (they could be lifted, given some effort and determination) but we have to start somewhere.
Of course (first-order) predicate logic is the most clear, most natural, etc., specification language. The challenge is to make it "more practical" (for this application), which presumably means to move it more towards natural language, without destryoing its nice semantical and syntactical properties.
For instance, people might want to say, "each person throws (at least) one pass". This is (conceptually) shorter than the exact formal specification
for each person p : exists throw t : p == from t && pass t
because of
p
, t
) are implicitexists throw t
) are implicitfrom t
) are implicitBut try making a formal specification for such a language! I think "Description Logics" https://arxiv.org/abs/1201.4089 does something similar, at least superficially. They avoid variables not just for convenience in notation, but mainly in order to stay in a decidable fragment - which is irrelevant for us since we have a finite universe anyway.
I welcome proposals for improving the language. Use this project's issue tracker.