guanxi edward kmett...–gandalf the grey, about barliman butterbur “he thinks less than he talks,...
TRANSCRIPT
Edward KmettGUANXI
LOGIC PROGRAMMING A LA CARTE
https://intelligence.org/
Marvin Minsky Aug 9, 1927 - Jan 24, 2016
(MINI)KANRENLOGIC PROGRAMMING IN SCHEME
https://mitpress.mit.edu/books/reasoned-schemer-second-edition
KANREN
vs.
KANREN GUANXI
https://www.youtube.com/watch?v=er_lLvkklsk
–Gandalf the Grey, about Barliman Butterbur
“He thinks less than he talks, and slower; yet he can see
through a brick wall in time (as they say in Bree).”
https://github.com/webyrd/Barliman
LOGICTclass MonadPlus m => MonadLogic m where msplit :: m a -> m (Maybe (a, m a))
reflect :: Maybe (a, m a) -> m areflect Nothing = mzeroreflect (Just (a, as)) = pure a <|> as
msplit >=> reflect = id
LOGICT IS NOT DEPTH-FIRST
PROS
• Like breadth-first, it won’t get lost in a blind alley forever.
CONS
• This means it must keep manual environments around
• Not compatible w/ incremental SMT solvers
• It uses a ton of memory.
TYPED LOGIC VARIABLES IN HASKELLUSE REAL REFERENCES THEN BACKTRACK
https://gup.ub.gu.se/file/207634
• Idea: Learn to avoid where you’ve been. CDCL in SAT solvers does this already.
• Rapid restarts are a huge deal in SMT solving
PROPAGATORSMONOTONE FUNCTIONS BETWEEN JOIN SEMILATTICES
https://www.youtube.com/watch?v=acZkF6Q2XKs
UNION-FINDWORKHORSE OF THE UNIFICATION WORLD
MONOID AND GROUP ACTIONSclass Monoid m => Group m where inv :: m -> m
-- act mempty = id-- act (m <> n) = act m . act nclass Monoid m => MonoidAction m s where act :: m -> s -> s
type GroupAction m s = (Group m, MonoidAction m s)
UNIFICATION MODULO GROUP ACTION
x = act a y
z = act b y
y = act (inv a) x
z = act b (act (inv a)) x = act (b <> inv a) x
USEFUL GROUP ACTIONS
• x = y + c (integer addition)
• x = (id | not) y (two element group)
• x = { +1, -1 } y + b (affine trans. w/ unit scale)
O(1) GROUP ACTIONS ON CONTAINERSMANDATORY FOR OPTIMAL ASYMPTOTIC PERFORMANCE
Monoidal Parsing - Scala World 2017
https://www.youtube.com/watch?v=Txf7swrcLYs
REFLECTION WITHOUT REMORSEFREE MONADS WITH BETTER ASYMPTOTICS SAFE DELIMITED CONTINUATIONS
NATURAL DOMAIN SMTPERFORM CONFLICT DIRECTED CLAUSE LEARNING DIRECTLY IN THE SEMANTIC DOMAIN
Key Observation: Guessing “too early” on some vertex separator can be a massive asymptotic performance win if your constraints are too hard to maintain!
NATURAL DOMAINS
• INTERVALS O(n)
• OCTAGONS O(n^4)
• POLYHEDRA O(2^n)
• PRESBURGER O(2^2^2^n)
OTHER RESULTS
• Pay attention to K-L divergence in sampling. Feeding random bits to an arithmetic decoder beats the baseline strategy NeuralKanren was tested against! We can draw without replacement if I track where in the sample space I’ve been and that can be stored succinctly in 2n + o(n) bits per decision functionally, as the application state! Way smaller than all those environments.
• There is a close connection to property-based testing when you’re trying to find a syntax tree with some property.
• Seminaive evaluation of Datalog offers lessons about topological sorting the propagator network as well as tracking changes since last use rather than directly performing semilattice joins.
• Adding nondeterminism fixes a lot of the headaches of using propagators to describe SAT and many other domains.
• Luby-style rapid restarts are very important for performance
• Use brute force when appropriate! Dancing Links, Dancing with Decision Diagrams.
• Dropping the ‘dancing links’ part of the dancing links algorithm and replacing it with SIMD bit operations makes the tasks easily parallelizable and able to be run on a GPU
• Atze van der Ploeg’s “Key” type makes heterogeneous maps very easy to work with and keeps popping up.
• For the most part this is embarassingly parallel, 1000 machines takes Barliman well below the Doherty threshold.
WANT MORE?
IRC: irc.freenode.net ##coda
Git: http://github.com/ekmett/guanxi
Twitch: http://twitch.tv/ekmett
QUESTIONS?