# Ancient Chinese Logic Solves the Double-Free Bug

Original title: Reconstructing Concurrency Invariants Through Medieval East Asian Logic

> Hacker News story 49653509 · language: en · submitted 2026-09-11
> Web version: https://zeli.app/story/49653509
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 18 · by [gg582](<https://news.ycombinator.com/user?id=gg582>) · 💬 7
[original](<https://oborona.zip/post/a-middle-period-engine-reconstructing-concurrency-invariants-through-east-asian-structural-logic>) · [HN discussion](<https://news.ycombinator.com/item?id=49653509>)

## Summary

A new essay maps 11th–14th century East Asian structural logic—Shao Yong's trigram combinatorics, Qin Jiushao's array algebra, and Su Song's escapement clocks—onto modern concurrent memory reclamation. The result is a precise symbolic vocabulary for preventing double frees and use-after-free races, with four methods (Qian, Kun, Kan, Li) that read like a medieval I Ching for lock-free programming.

## Key quote

> Do not employ Kan: deallocating memory while reference paths remain published creates an invisible dangling pointer.

## HN discussion (7 comments)

### [jrapdx3](<https://news.ycombinator.com/item?id=49675543>)

> This aroused my curiosity. Tried to get the article. Clicking on the item didn't fetch the site, never did connect.

### [gg582](<https://news.ycombinator.com/item?id=49653979>)

> tried a silly crossover mapping memory reclamation invariants (visibility, UAF, CAS) to old trigram structures in c11. surprisingly mapped 1:1 pretty well. put the puzzle and code snippets here

### [gg582](<https://news.ycombinator.com/item?id=49653589>)

> I wrote this post as a bit of an unconventional thought experiment.
>
> The idea was to take the concepts of memory reclamation and pointer visibility (stuff you see in EBR or RCU) and map them onto medieval East Asian state-machine logic—specifically the structural and matrix ideas from the Song-Yuan period.
>
> To keep it grounded in actual code, I set up a small concurrent deallocation puzzle using C11 atomics and mapped four classical trigram patterns (乾, 坤, 坎, 離) directly to real-world memory invariants:
>
> \* Revoking visibility via CAS before freeing (orthodox safe reclamation)
>
> \* Asymmetric pipeline handoffs
>
> \* Classic use-after-free bugs from premature freeing
>
> \* Race conditions caused by blind `memset` zeroing
>
> It's an attempt to see if ancient structural framing can provide an interesting symbolic vocabulary for modern low-level systems programming, without turning it into philosophical fluff. Thought some folks here might find the crossover interesting.

---

## Cite

- Page: https://zeli.app/story/49653509
- Date: 2026-09-11
- Source: oborona.zip (https://oborona.zip/post/a-middle-period-engine-reconstructing-concurrency-invariants-through-east-asian-structural-logic)
- Hacker News: https://news.ycombinator.com/item?id=49653509

## Other languages

- zh: https://zeli.app/zh/story/49653509 · markdown: https://zeli.app/zh/story/49653509.md
- ja: https://zeli.app/ja/story/49653509 · markdown: https://zeli.app/ja/story/49653509.md
- ko: https://zeli.app/ko/story/49653509 · markdown: https://zeli.app/ko/story/49653509.md
- de: https://zeli.app/de/story/49653509 · markdown: https://zeli.app/de/story/49653509.md
- es: https://zeli.app/es/story/49653509 · markdown: https://zeli.app/es/story/49653509.md
- ru: https://zeli.app/ru/story/49653509 · markdown: https://zeli.app/ru/story/49653509.md
