The Unit Gap: How Sharing Works in Boolean Circuits

This paper establishes that the size difference between optimal Boolean circuits and formulas over the AIG basis is strictly limited to 0 or 1, characterizing the precise conditions under which sharing occurs and proving that any non-zero gap arises exclusively from a single gate with fan-out 2.

Kirill Krinkin

Published Tue, 10 Ma
📖 5 min read🧠 Deep dive

Imagine you are a master architect tasked with building a machine to solve a specific logic puzzle. You have two blueprints to choose from:

  1. The "Tree" Blueprint (Formula): This is a strict, one-way street. Every time you build a component (a logic gate), you can only use it once. If you need that same component again later, you have to build a brand new, identical copy from scratch. It's like baking a cake where every time you need an egg, you have to crack a new one, even if you just cracked one a second ago.
  2. The "Forest" Blueprint (Circuit): This is a flexible network. You can build a component once and then pipe its output to multiple places. It's like cracking one egg and using it in both the batter and the frosting. This "sharing" usually saves you a lot of work (gates).

For decades, computer scientists wondered: How much work can you actually save by sharing? In some complex worlds, sharing can save you a massive amount of work—turning a mountain of bricks into a pebble.

But this paper, by Kirill Krinkin, looks at a very specific, modern type of machine (called an AIG or And-Inverter Graph) used in real-world chip design. The author asks: In this specific world, how much can sharing actually help?

The Big Discovery: The "Unit Gap"

The author proves a surprising and simple rule: In this specific world, sharing can save you either 0 bricks or exactly 1 brick. Never more.

Think of it like this:

  • If you build a "Tree" machine, it might take 100 steps.
  • If you build a "Forest" machine (sharing parts), it might take 99 steps.
  • It will never take 50 steps. The savings are capped at a single unit.

This is called the Unit Gap Theorem. It means that for these specific machines, the "Tree" blueprint is almost always perfect. You only need to switch to the "Forest" blueprint if you can save exactly one tiny step.

When Does Sharing Even Happen?

The paper also finds a "Threshold" for when sharing is even possible.

  • The Rule: You can't share anything unless your machine is complex enough to have at least as many "essential ingredients" (variables) as the number of steps it takes to build.
  • The Analogy: Imagine trying to share a tool in a workshop. If you only have 2 tools and 2 workers, you don't need to share; everyone has their own. But if you have 5 workers and only 4 tools, someone has to share.
  • The Finding: If your machine is very small (3 steps or fewer), sharing is impossible. You must use the Tree blueprint. Sharing only kicks in once the machine gets big enough (at least 4 steps).

How Does the Saving Happen? (The Two Tricks)

If you do manage to save that one precious brick, how do you do it? The author found there are only two magic tricks used in the entire universe of these machines:

  1. The "Double-Flip" Trick (Dual-Polarity):
    Imagine you build a component, but you need to use it once as "ON" and once as "OFF." In a Tree blueprint, you'd have to build two separate components. In the Forest, you build one, and you just flip the switch on one of the wires leading out of it. It's like having a light switch that controls two lights: one bright, one dim, using the same bulb.

    • Result: You save 1 brick.
  2. The "Copy-Paste" Trick (Common Subexpression):
    Imagine you build a complex sub-machine, and two different parts of your main machine need to use it exactly the same way. In a Tree, you build it twice. In a Forest, you build it once and send the signal to both places.

    • Result: You save 1 brick.

The paper proves that no other tricks exist. You can't save 2 bricks, and you can't use a third, weirder method to save 1 brick. It's strictly these two moves.

Why Should You Care?

This might sound like a tiny detail (saving just 1 brick), but it's actually huge for how computers are designed today.

  1. Predictability: Chip designers use software to optimize circuits. Knowing that the "Tree" version is almost always the best, and that the "Forest" version can only ever be one step better, makes the optimization problem much simpler. The software doesn't need to look for massive shortcuts; it just needs to check for these two specific "one-step" tricks.
  2. Structure over Size: The paper shows that the structure of these machines is very rigid. They are "atomic." You can't have a complex web of sharing; it's usually just one single point where two paths merge.
  3. The "Free Constant" Secret: The reason this works is that in this specific system, the number "1" is free (it costs nothing to have a constant "true" signal). This allows for a mathematical trick that collapses the gap. If you change the rules (remove the free "1"), the gap could explode again.

The Bottom Line

Think of this paper as a map for a very specific, tiny island.

  • Old Map: "The island is huge, and you might find a shortcut that cuts your journey in half!"
  • New Map: "Actually, the island is small. The only shortcut you can find is a single step to the left. And there are only two specific places on the island where you can take that step."

It turns a chaotic, complex problem into a clean, predictable rule: In modern chip design, sharing is rare, it's limited to saving exactly one step, and it happens in only two very specific ways.