Software Projects
Open source, hosted on gitlab.llama.gs. The commercial side of this work lives at llama-logic.com.
Most of these answer a question by searching for the answer with a decision procedure rather than by guessing well. The difference shows up in what comes back: not a good answer, but the best one, with a proof that nothing better exists — or a proof that there is no answer at all.
Three Questions About a Circuit
Designing a circuit, testing a manufactured one, and working out what broke in a failed one are sold as three separate kinds of tool. They are the same search over the same model, differing only in which variables are quantified and how. Here they are three programs over one netlist representation and one solver, which is why one person can maintain all of them.
-
Demonstrand — Exact Circuit Synthesis
Does there exist a circuit such that, for every input, it computes this specification? That question has one quantifier too many for SAT, so it goes to a QBF solver instead. What comes back is provably minimal, or provably impossible at that size. The five-gate full-subtractor shown here is one of its results, against the textbook seven.
Exact synthesis cannot run on a whole design, so it runs on windows of one: partition a large circuit, exactly re-solve each window, splice back any improvement, and formally verify equivalence at every step. Optimality is given up globally and kept locally. The cost function is pluggable, which matters more than it sounds — minimizing lookup-table count gives exact technology mapping, validated to LUT6 against a real FPGA, while minimizing AND count with XOR free gives multiplicative complexity — the metric that governs how fast a computation runs under homomorphic encryption, and one no production synthesis tool optimizes.
-
Propagandum — Provably Minimal Test Generation
Does there exist a set of k input vectors that would expose every possible manufacturing fault? Drive k down until the solver proves there is no such set, and the last one that worked is the shortest test program that exists. Commercial ATPG compacts heuristically and cannot tell you how close it got. On the 74182 carry-lookahead generator, 67 stuck-at faults collapse to 10 vectors, each proven necessary.
Test time is billed by the second, per die, for the life of the part, so a vector removed is a cost removed from every chip ever shipped. PODEM and the D-algorithm are here too, for the circuits the exact search cannot yet reach — which is most large ones, and is the honest limitation of the approach today.
-
ldiag — Circuit Fault Diagnosis
Which smallest set of components, if faulty, would account for what was observed? The third corner, and the oldest idea of the three — model-based diagnosis is what the continuous-systems work further down this page descends from. A scenario language records what was injected, what was observed, and which diagnoses explain it, with priors on component health for ranking candidates by probability rather than count alone. Currently the language and the data model; the solving engines are being folded in from an earlier codebase.
The Shared Foundation
The three tools above are thin. Nearly all the work is here: in getting the representations and the conversions between them right once, and in the solvers underneath.
-
llogic — Boolean Logic Library
Every representation of propositional logic anyone needs, and one pipeline between them: a hierarchical circuit language for people, flattened to a netlist for tools, lowered to a Boolean formula, and from there to the conjunctive normal form a solver eats. Also DNF, BDDs, quantified variants of all of them, and Quine-McCluskey minimization. Most arrows run both ways, so anything expressible as a Boolean function — a truth table, a formula, a Python function — joins the pipeline at the top.
-
llq — QBF Solver
A solver for quantified Boolean formulas, which is the engine exact synthesis actually runs on. It works by expansion rather than by search, delegating to CaDiCaL, Kissat or Lingeling underneath, and splits hard instances across cores by cube and conquer. That design choice is load-bearing: on the unsatisfiable queries that prove a circuit cannot be smaller — the ones a minimality claim rests on entirely — it measured roughly two orders of magnitude faster than a conventional search-based QBF solver. pyllq binds it to Python.
-
lcfgen — Circuit Generators
Benchmark suites are small, fixed and finite; a tool that only ever sees them learns their quirks. This generates circuits instead — adders, Wallace-tree multipliers, dividers, multiplexers, bitonic sorters — at any width, each with a known-correct reference, so a synthesis or test tool can be pushed along a size sweep until it breaks and the breaking point can be reported honestly.
-
lmodulo — SMT Solver
An SMT solver for quantifier-free integer arithmetic, by eager bit-blasting: the arithmetic becomes circuitry and a SAT solver does the rest, with no theory-propagation loop anywhere. Beyond satisfiability it enumerates every solution and minimizes an objective by binary search. Rectangle packing, N-queens and Sudoku come worked out in full.
Getting In and Out of a Real Flow
A circuit a solver invented is worth nothing if it cannot be taped out, and a circuit the industry already has is worth nothing to a solver it cannot be read into. Both directions, and a round trip checked for equivalence.
-
llogic2verilog — Circuit to Verilog
Compiles the circuit domain-specific language to Verilog, so a design written for a solver can be simulated, synthesized, or put on an FPGA like any other. The module hierarchy survives the trip: nothing is flattened, instantiations stay instantiations, and flip-flops acquire the clock the source language has no word for.
-
verilog2llogic — Verilog to Circuit
The same road in the other direction, so existing Verilog can be reasoned about rather than only run. Structural Verilog is parsed and rewritten into circuits, with expression trees broken back down into gates. Every circuit that makes the round trip is checked by a SAT solver to still compute what it did before.
Diagnostics and Prognostics
The same question as ldiag asks of a circuit, asked of a machine: given how it is behaving, what is wrong with it? A model of the equipment that includes models of its failures is what makes the answer a named fault with evidence rather than an anomaly score. These four cover the middle of that lifecycle — getting data off real hardware, and turning it into a diagnosis.
-
Lydia — Diagnosis Compiler
A compiler for a modelling language that describes not only what a system does, but what it does once parts of it have broken. From one such model it derives the diagnostic reasoning itself — given what a system was observed to do, which set of components failing would account for it. The original, and what everything else in this section descends from.
-
Lydia-NG — Continuous Systems Diagnosis
The diagnosis compiler above, rebuilt in modern C++ and widened from discrete circuits to systems that behave continuously. It simulates a model through an ODE solver, estimates the parameters a fault would have to have, and searches the space of failure candidates exhaustively or greedily as the size of the problem demands.
-
Psycho-Killer — Fault Diagnosis Toolkit
Trains and compares diagnostic engines against simulated sensor data. A model of a physical system — an ODE, a DAE with index reduction, or an FMI co-simulation, so a model built in Modelica or Simulink plugs straight in — is simulated under nominal and fault conditions, then used to train and evaluate seven regression models against three nonlinear filters (Extended Kalman, Unscented Kalman, particle) that isolate which fault is present from sensor readings alone.
Running the statistical and the physics-based approaches against each other, on one model and one dataset, is the point rather than an accident: which of them a given machine actually needs is an empirical question, and nobody can answer it from the armchair. A Qt desktop application browses simulations, features, spectrograms and results, so the engineer who knows the equipment does not have to be the one who knows Python.
-
Ex-Parrot — Condition-Based Monitoring Platform
An instrumentation and data-collection platform for condition-based monitoring, applicable across equipment classes — HVAC, refrigeration, and others. It handles the physical side: custom firmware, a purpose-built sensor network, a daemon streaming readings into a database, and a fleet interface an operator rather than a programmer can drive. Transport is moving to CoAP, which is what Thread and Matter networks already carry, so the next generation of nodes can be wireless and the existing ones keep working through a bridge.
The underrated part is the experiment scheduler. A diagnostic engine has to be trained on data from a system that is actually broken, and faults are rare in the field — so this drives equipment into fault conditions deliberately, repeatedly, and records the result. That is what makes the toolkit above trainable at all: one side manufactures the evidence, the other reasons from it. A temperature sensor is the first node of the new generation, currently in prototype.