Dimitri Bohlender
https://bohlender.pro/blog/
Thoughts on formal methods, computer science, art & society
Hugo  gohugo.io
engb
© Dimitri Bohlender
Wed, 21 Aug 2019 17:23:49 +0200

Generating Crosswords via SAT/SMT
https://bohlender.pro/blog/generatingcrosswordswithsatsmt/
Sat, 24 Oct 2020 00:00:00 +0000
Dimitri Bohlender
SAT
Puzzle
https://bohlender.pro/blog/generatingcrosswordswithsatsmt/
<p>Recently I got interested in designing personalised crosswords as a way to spice up photo book presents.
This made me realise how hard generating <q>highquality</q> crosswords actually is.
Trying to create a crossword from a set of words – or a subset thereof – I checked out several tools but found all of them to be based on heuristics and yield rather sparse crosswords.</p>
<p>In line with the general theme of my previous posts, this one illustrates how we can leverage <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">SAT solving</a> to solve this problem.
In contrast to related approaches, which assume a fixed grid structure and search for fitting words, we consider word placement as part of the problem and eventually end up with an integrated solution to generating crosswords of adjustable quality.</p>

Playing Hard Mastermind Games with a SATbased AI
https://bohlender.pro/blog/playinghardmastermindgameswithasatbasedai/
Thu, 12 Mar 2020 00:00:00 +0000
Dimitri Bohlender
SAT
AI
Puzzle
https://bohlender.pro/blog/playinghardmastermindgameswithasatbasedai/
<p>Back in the day, <a href="https://en.wikipedia.org/wiki/Mastermind_(board_game)">Mastermind</a> was a popular two player codebreaking game, and many <a href="https://en.wikipedia.org/wiki/Mastermind_(board_game)#Variations">variations thereof</a> still exist as both standalone games and puzzles within other games.
Although it is difficult for a human player to make <em>optimal guesses</em> of the secret code, or at least guesses that do not conflict with the provided clues, the setting is usually simple enough for an AI to find such candidates via explicit exploration of the <a href="https://en.wikipedia.org/wiki/Game_tree">game tree</a>.</p>
<p>However, such approaches becomes unfeasible when the number of possibilities for secret codes grows into the millions.
This post illustrates the problem with standard approaches, and how finding consistent candidates can be approached with <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">SAT</a> solving – yielding an AI that can handle ordersofmagnitude harder Mastermind instances.</p>

Solving a Logic Synthesis Puzzle via SAT/SMT
https://bohlender.pro/blog/solvingalogicsynthesispuzzleviasatsmt/
Thu, 12 Dec 2019 00:00:00 +0000
Dimitri Bohlender
SAT
SMT
Logic Synthesis
Puzzle
https://bohlender.pro/blog/solvingalogicsynthesispuzzleviasatsmt/
<p>A few weeks ago, I was asked the following riddle:
<q>Design a <a href="https://en.wikipedia.org/wiki/Logic_gate">logic circuit</a> with three inputs and three outputs, such that the outputs are the inverted inputs. You may use arbitrary many AND and OR gates, but at most two NOT gates</q>.
Although the characterisation of this problem as an <a href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories">SMT</a> instance is straightforward, I found it necessary to reduce it to <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">SAT</a> and incorporate further assumptions to achieve reasonable performance.</p>
<p>This post illustrates said process, ranging from the original idea to a standard formulation of SATbased logic synthesis to a problemspecific and more constrained instance.</p>

SMTbased Reasoning About the Fast Inverse Square Root
https://bohlender.pro/blog/smtbasedoptimisationoffastinversesquareroot/
Thu, 26 Sep 2019 00:00:00 +0000
Dimitri Bohlender
SMT
SMTLIB
Software Verification
https://bohlender.pro/blog/smtbasedoptimisationoffastinversesquareroot/
<p>While there is a <a href="https://web.archive.org/web/20160308091758/http://www.daxia.com/bibis/upload/406Fast_Inverse_Square_Root.pdf">mathematical explanation</a> for the choice of <code>0x5F3759DF</code> in the <a href="https://en.wikipedia.org/wiki/Fast_inverse_square_root">famous bitlevel hack</a> for approximating the multiplicative inverse of the square root of a 32bit floatingpoint number, it is not immediately clear to what extent the reasoning is really applicable in the context of machine data types and their peculiarities.
This post illustrates how this, and related aspects, can be investigated with <a href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories">SMT</a>based reasoning about the actual implementation.</p>