bohlender.pro
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

Turning Studio Headphones Into a Headset
https://bohlender.pro/blog/turningstudioheadphonesintoaheadset/
Sun, 29 Jan 2023 00:00:00 +0000
Dimitri Bohlender
Tinkering
https://bohlender.pro/blog/turningstudioheadphonesintoaheadset/
<p>In a recent virtual meeting a new colleague was surprised to see me using a <a href="https://beyerdynamic.com/dt770pro.html">Beyerdynamic DT 770 PRO</a> <em>headset</em> – a product Beyerdynamic does not even list.
The DT 770 PRO are wellknown studio <em>headphones</em>, and so are all the other entries in Beyerdynamic’s <q>studio</q> line.
Only their <q>gaming</q> line of products features headsets.
So how could I possibly be using a device that does not seem to exist?</p>
<p>The solution is unspectacular if one is aware of “detachable microphones”.
To turn a wired studio headphone into a headset all one needs to do is to make it possible to attach such a microphone.
This post illustrates</p>
<ul>
<li>how replacing the integrated headphone cable by an <a href="https://en.wikipedia.org/wiki/Phone_connector_(audio)">audio jack</a> achieves this,</li>
<li>the concrete implementation using my DT 770 PRO as a test object.</li>
</ul>

Solving the "Seven Segment Search" Puzzle with Z3
https://bohlender.pro/blog/aocsevensegmentsearchwithz3/
Sun, 13 Feb 2022 00:00:00 +0000
Dimitri Bohlender
SMT
Puzzle
Advent of Code
https://bohlender.pro/blog/aocsevensegmentsearchwithz3/
<p>This week I stumbled upon <a href="https://www.reddit.com/r/adventofcode/comments/rbwnh5/2021_day_8_can_it_be_solved_as_a_constraint/">someone wondering</a> whether the <strong>second part</strong> of the recent <a href="https://adventofcode.com/2021/day/8">Advent of Code puzzle “Seven Segment Search”</a> can be expressed as a constraint satisfaction problem.
As attested by the replies: yes, it can.
However, I think the question deserves a more extensive discussion than just a few comments in a thread.
This post tries to provide a more instructive answer and raise awareness for the tradeoffs or solver misuses some solutions put up with.</p>
<p>I assume that the reader is familiar with mathematical notation and</p>
<ul>
<li>just struggles to express the posed problem in a formal, declarative way, <em>or</em></li>
<li>is interested in seeing how the <a href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories">SMT</a> solver <a href="https://github.com/Z3Prover/z3/">Z3</a> can be used to express and solve the problem in several logics.
It takes only few steps to get from a quantifierladen highlevel formulation to what is effectively <a href="https://en.wikipedia.org/wiki/Propositional_logic">propositional logic</a>.</li>
</ul>

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 become 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>