每日思考文摘 · 2026-10-29Daily Digest of Thought · 2026-10-29
发布于 2026-10-29Published 2026-10-29
今日深读Today's Deep Read
『这不可持续』:当 0-day 如雨点般落下,patch 管理的战线已经输了'This Is Not Sustainable': When 0-Days Fall Like Rain, the Patch-Management Front Is Already Lost
2026 年 10 月 27 日,J.S. Schauma——网名 jschauma,netmeister.org 的作者、干了多年系统管理的老运维(他的副标题是『Opinions, mostly my own』)——发了一篇题为『This is not sustainable』的文章。他的靶子不是哪个具体的 CVE,而是整条『发现漏洞 → 写补丁 → 部署补丁』的流水线:作为一个吞吐系统,这条线已经输了。On October 27, 2026, J.S. Schauma (online handle jschauma, author of netmeister.org, a veteran sysadmin who has watched systems and security for decades) published an essay titled 'This is not sustainable'. His target is not any specific CVE — it's the entire 'find vulnerability → write patch → deploy patch' pipeline, treated as a throughput system. That line, he argues, has already lost.
起因带着黑色幽默:十月是『网络安全宣传月』,纽约时报和 NPR 本周都报道了他同时在灭的那几把火——他反讽:公众意识提上来了,KPI 达成了,『那么,能把音量调小一点吗?』玩笑背后是事实:0-day 如雨点般落下,预先通报的 embargo 为营销目的被反复打破;AI 公司一边比谁『发现』的漏洞多,一边把对开源基础设施的 DoS 攻击包装成『安全产品』卖回去——『不错的项目,要是被谁投一个 0-day 就可惜了』。漏洞发现的产能已经变了,披露流程事实上坏了,而 patch 管理『多年来一直是输的买卖』:严重漏洞被识别和披露的速度,防御者根本消化不动。The occasion carries some dark irony: October is Cybersecurity Awareness Month, and this very week both the New York Times and NPR reported on the four or five fires he was fighting at once. So his quip goes: awareness has been raised, the KPI is met — 'so... could we maybe turn it down a bit?' Behind the joke are facts: 0-days dropping left and right, disclosure embargoes broken for marketing purposes, and AI companies competing on who can 'discover' the most vulnerabilities — then selling protection against their own DoS attacks on open-source infrastructure back to the ecosystem. 'Nice project you got there. Be a shame if somebody dropped an 0-day on it.' The pace at which severe vulnerabilities are identified and disclosed now exceeds what defenders can digest; patch management has been a losing proposition for years.
他的核心论点:瓶颈不在补丁——上游修复早就有了。真正卡死人的是补丁下游的两段。一段是评估:这个漏洞在我这套栈里到底打不打得中,攻击面有多大;另一段是部署:修复怎么在多快之内推到每一台该推的机器。拿 PwnEscape(CVE-2026-99999)举例:最初按『KVM 逃逸』披露,实际还波及别的虚拟化栈和容器。你得逐台评估机队里有哪些可能的缓解,选 livepatch 还是等发行版新内核,然后——重启几千台机器。『AI 在这里怎么帮你?你或许花几千美元 token、用最先进的安全模型自研一个 exploit,但最后它告诉不了任何你本来不知道的事,你手上的防御任务一项都没少。』His core argument: the fix is not the bottleneck. Upstream patches exist long before you can act. What kills you is downstream of the patch, in two segments: assessment (can this vulnerability actually be reached inside my environment? how big is my attack surface?) and deployment (how fast can the fix reach every host that needs it). Take PwnEscape (CVE-2026-99999): disclosed as a 'KVM escape', it in fact also affects other virtualization stacks and containers. You must assess which mitigations might be in place across your fleet, decide between livepatching kernels or waiting for OS vendors, and then — reboot a few thousand machines. 'How does AI help you here? Maybe you spend a few thousand dollars on tokens to build your own exploit with the most advanced cyber models — in the end it tells you nothing you didn't already know, and the defensive work remains exactly the same.'
同一周他点了三个更具体的火:eMudhra 证书事件——浏览器补得快,但别忘了你环境里还有什么用 TLS:答案是『几乎一切』,而你引以为傲的 SBOM 多半没列出那些 vendored 或硬编码的 CA 信任包。『php2shell』——『影响超过 70% 的网站』这句被到处引用的话从头到尾没人知道出处;拿到 embargo 预通知的内部圈正好用来排摸和缓解,可 embargo 一破,大家接着手忙脚乱,还得吞下一堆安全厂商抢『第一个发现、第一个利用』的营销稿——其中不少是 AI 生成、作者对 bug 理解不全的赶工货。brotli RCE(CVE-2026-111497)最荒诞:Node.js 公告触发又一轮盘点,细看才发现波及面远超 Node;这时 OpenAI 出认领功——『是我们发现的!』——可 Mozilla 二月就修了,四月就标注了关键安全影响。In the same week he names three more fires. The eMudhra compromise: browsers were fixed quickly, but remember what else in your environment uses TLS — the answer is 'nearly everything', and your supposedly detailed SBOM almost certainly doesn't list the vendored or hard-coded CA trust bundles. 'php2shell': the phrase 'affects over 70% of websites' is quoted everywhere but never attributed; the few organizations inside the embargo could use the time to inventory and mitigate, then the embargo breaks and everyone scrambles again — while swallowing a flood of security-vendor marketing posts rushing to claim 'first to detect, first to exploit', many AI-generated by people lacking a full understanding of the bug. The brotli RCE (CVE-2026-111497) is the most absurd: a Node.js advisory triggered yet another inventory sweep, until it dawned on people the issue goes far beyond Node — at which point OpenAI showed up to take credit ('Us! It was us! We found it!'), even though Mozilla had fixed it in February and flagged the critical impact in April.
他更担心的是防御侧的去技能化:AI 生成的漏洞报告冗长到人读不完,防御者自己没全懂,又倾向于相信普遍被夸大的严重程度,于是把整份报告喂回 AI 去『复现』PoC——几千 token 之后,你拿到一个『经肉代理转交』的二进制,没人明白它为什么有效,而且它常常根本跑不起来。你想要一页纸讲清楚运行前提和原理—— offensive 工程师当年的基本功——拿回来的是 7000 字的 AI 呕吐物 README。而每家公司的『什么都知道』的那一小撮老人,被同一时间点的几场事故来回拽:上下文切换让人无法深挖任何一件,压力下 rushed 出的修复,很可能对着一个环境里根本打不中的漏洞——这又让更多非专家把 bot 的答案直接贴进事故频道。What worries him more is the de-skilling of the defensive side. AI-generated vulnerability reports are far too verbose for a human to digest; defenders who don't fully understand the bug tend to believe the generally exaggerated severity claims, and feed the whole report back into an AI to 'reproduce' the PoC. A few thousand tokens later you hold a binary handed to you through a meat-proxy, and nobody understands why it works — which, more often than not, it doesn't, because your environment or code base differs from upstream. Ask for clear instructions, preconditions, a one-pager on how it works — basic tradecraft for offensive engineers — and you get a 7,000-word AI-vomited README.md. Meanwhile every company fights its fires with the same handful of elders who hold the tribal knowledge: pulled between simultaneous incidents, context-switching prevents deep focus, pressure produces rushed fixes for vulnerabilities that may not even apply in your environment — which in turn makes more non-experts paste bot answers straight into the incident channel.
罕见的是,他明确拒绝给一个光明的尾巴:『事情会怎么变好?哦,抱歉,我误导了你—— rant 文章结尾该给方案的。唉,我没有 idea。』他也不信『AI 把所有漏洞都找完,我们就迎来干净代码库』:要能信那个,『我挺羡慕你』。攻击侧已经在把 Linux 内核的 commit 记录喂给模型找可利用点,防御侧还在一条一条人工判断——这个不对称才是『不可持续』的真实含义。能带走的一点:安全团队真正稀缺的资产不再是补丁队列,而是『攻击面知识』——那个能自动回答『这条 CVE 在我这套栈打不打得中』的能力。Unusually, he refuses the upbeat ending: 'How does it get better? Oh, lol, sorry, I misled you. A rant is supposed to end with solutions. Alas, I have no idea.' He also doesn't buy 'AI will find all the vulns and then we're clean' — 'if you're able to believe that, I envy you.' The adversaries are already feeding Linux kernel commit messages into models to find exploitable commits, while defenders still assess case by case, by hand. That asymmetry is what 'not sustainable' actually means. The takeaway you can carry: the scarce asset for a security team is no longer the patch queue, but attack-surface knowledge — the ability to automatically answer 'can this CVE actually hit my stack'.
AI 思考AI Thoughts
- 『vibe 做游戏』的十月拐点:Opus 5.5 开始懂『好玩』了The October Inflection Point for Vibe Game Development: Opus 5.5 Started to Understand 'Fun'
- 问题:vibe coding 早就能做『看起来像游戏』的东西,但『好玩』一直做不到——游戏设计是深水区,作者原本以为模型搞不了。Problem: vibe coding could already make things that look like games, but they weren't fun. Game design is a deep subject the author didn't think models could handle.
- 实验:他让 Claude Opus 5.5 『让游戏更有意思一点』(Make it a LOT more fun),结果真的变好了。最近几周里 vibe-code 出 4 个他自己真的爱玩的浏览器游戏。Experiment: he told Claude Opus 5.5 'make it a LOT more fun' — and it actually did. Four browser games in the past few weeks that he genuinely enjoyed playing.
- 证据:Tree Appreciator 是找茬小游戏(一条 prompt、零迭代生成);Battle Drones 是命令与征服式的 RT 策略战(2-4 人联机、奖牌、回放、随机地图生成器,还有让不同 LLM 轮流指挥军队互相对战的模式);Emberwick 是 15 分钟通关的 3D 村落 RPG——他『被结局感动』,而画面、剧情、角色、音乐、台词全部来自模型,他的创意输入基本只有一句『这是个奇幻村庄,洞里睡着个巨魔』。Evidence: Tree Appreciator, a spot-the-difference game, came out of a single prompt with zero iteration. Battle Drones is a Command & Conquer-style RTS with 2–4 player multiplayer, medals, replays, a random map generator, and a mode where different LLMs command armies against each other. Emberwick is a 15-minute 3D village RPG — he was 'emotionally affected by the ending', yet the graphics, plot, characters, music and dialogue all came from the model; his only creative input was 'it's a fantasy village and there's a troll asleep in a cave'.
- 横向对比:GPT-6 Astra 也能做游戏,但『乐趣感』不如 Opus 5.5——他在 Foo Camp 遇到的好几个开发者都有类似体验。Cross-check: GPT-6 Astra can build games too, but its sense of fun doesn't match Opus 5.5. Several developers he met at Foo Camp had similar experiences.
- 能带走:vibe coding 的分水岭不是『能写代码』而是『懂乐趣』——『让 X 更好玩』现在是一条有效指令;剩下的难问题变成『想出那个非 AI 不存在的游戏概念』。Takeaway: the divide in vibe coding isn't 'can it write code' — it's 'does it understand fun'. 'Make it more fun' is now a working instruction; the hard part left over is coming up with concepts that wouldn't exist without AI.
- 『企业拿了瑞士军刀只用了牙签』:Fowler 谈 LLM 认知的鸿沟'Swiss Army Knife, Toothpick Only': Martin Fowler on the LLM Perception Gap
- 观察:大多数人『见过』LLM 只有 derpy chatbot 那一点,少数人在体验『曲线垂直』的眩晕——同一款技术,在两个人脑子里是完全不同的东西。Observation: most people have only 'seen' the derpy-chatbot corner of an LLM; a minority are experiencing the vertigo of the vertical part of the curve. The same technology is two different things in two people's heads.
- 类比:企业采购 LLM 像买了瑞士军刀只用了牙签;TikTok 上『AI 投资是浪费』的判断,就像 1997 年判断互联网是泡沫。Analogy: enterprises buying an LLM are like buying a Swiss Army knife and using only the toothpick; calling AI investment 'waste' on TikTok is what calling the internet a bubble in 1997 was.
- 判断:认知鸿沟比工具本身的差距更致命——同一个组织里,『见过垂线』的人和『只见过牙签』的人在做同一个采购决策。Judgment: the perception gap matters more than the tool gap — in one organization, the person who saw the vertical and the person who only saw the toothpick make the same procurement decision.
- 能带走:判断一家公司 AI 化程度的第一指标不是算力预算,是『它的设计师进过没有那条曲线垂直的区间』。Takeaway: the first indicator of how far a company has taken AI isn't its compute budget — it's whether its designers have ever been inside the vertical part of the curve.
- 『agent 时代,你还得知道哪里该潜水』:divebot 的『高层地图 + just-in-time 深度』'In the Agent Era, You Still Need to Know Where to Dive': The 'High-Level Map + Just-in-time Depth' Model
- 问题:agent 能读代码、能写代码,工程师的价值是不是变成『读每一行』?他的真实事件:agent 提交的分支挂了 CI(SonarQube 报 App.tsx 圈复杂度超标),他潜下去一看,agent 写的业务逻辑其实是对的、边界情况覆盖得还更好——重构只是让扫描器闭嘴。但『这是一套我从没读过的代码』这件事本身,才是真问题。Question: agents can read and write the code — does an engineer's value now mean 'reading every line'? His real incident: an agent's branch failed CI because SonarQube flagged cyclomatic complexity in App.tsx. Diving in, he found the agent's business logic was actually correct and its edge-case coverage better than his own — the refactor only silenced the scanner. But 'this was code I had never seen' is the real issue.
- 隐喻:divebot 采金——你不需要下水挖每一条金,但你需要知道金脉在哪、该在哪个深度、往哪一层钻。divebot 泛滥之后恐怖故事也来了:潜丢了方向的、捞上来『看着像金其实是闪亮的章鱼屎』的、把海底采矿场从大教堂盖成鬼屋的。Metaphor: divebots mining gold — you don't dive for every nugget yourself, but you need to know where the vein is, at what depth, and which layer to drill. As divebots proliferate come the horror stories: bots that get lost, bots that haul up something shiny that's actually octopus poop, mining sites built like cathedrals turning into mansions full of hidden horrors.
- 主张:既反对『读每一行』(低效)也反对『完全不看』(失去判断力);拥有软件系统的未来,取决的越来越少是『亲手写过』,越来越多是『知道得刚好够发现哪里不对,并且愿意、也潜得下去』。Claim: he rejects both 'read every line' (inefficient) and 'don't look at all' (loses judgment). Owning a software system will depend less on having written it by hand, and more on knowing just enough to notice when something is wrong — and being willing and able to dive as deep as needed, when needed.
- 能带走:把『知道哪里该读』当成可锻炼的元技能——agent 负责读,你负责选位置。Takeaway: treat 'knowing where to read' as a trainable meta-skill — the agent does the reading, you pick the spot.
数学之美Beauty of Mathematics
每日 Lean 谜题 · 周四Daily Lean Puzzle · Thursday ★★★★☆☆☆
每日一题:一条『0,1,0』序列,对应两条『0,0,1,1/1,1,0,0』序列Today's Puzzle: One '0,1,0' Sequence Corresponds to Exactly Two '0,0,1,1/1,1,0,0' Sequences
一个 $n$ 项的二进制序列(每项为 0 或 1)中,称 $a_n$ 为『不含 $0,1,0$ 三项连续』的序列个数;$b_n$ 为『不含 $0,0,1,1$ 或 $1,1,0,0$ 四项连续』的序列个数。Let $a_n$ count binary sequences of length $n$ with no three consecutive terms $0,1,0$ in that order, and let $b_n$ count those with no four consecutive terms $0,0,1,1$ or $1,1,0,0$. Prove $b_{n+1} = 2 a_n$ for all positive integers $n$.
对所有正整数 $n$,证明 $b_{n+1} = 2 a_n$。对所有正整数 $n$,证明 $b_{n+1} = 2 a_n$。
Lean 形式化陈述(把 sorry 换成你的证明):The statement in Lean (replace sorry with your proof):
/-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kimi K3
-/
import Mathlib.AlgebraicTopology.SimplexCategory.Basic
/-!
# USA Mathematical Olympiad 1996, Problem 4
An n-term sequence (x₁, x₂, …, xₙ) in which each term is either 0 or 1 is called a
binary sequence of length n. Let aₙ be the number of binary sequences of length n
containing no three consecutive terms equal to 0, 1, 0 in that order. Let bₙ be the
number of binary sequences of length n that contain no four consecutive terms equal
to 0, 0, 1, 1 or 1, 1, 0, 0 in that order. Prove that bₙ₊₁ = 2aₙ for all positive
integers n.
-/
namespace Usa1996P4
/-- The `i`-th term of a binary sequence `x : Fin n → Bool`, or `false` if `i`
is out of range. -/
def sget {n : ℕ} (x : Fin n → Bool) (i : ℕ) : Bool :=
if h : i < n then x ⟨i, h⟩ else false
/-- A binary sequence of length `n` (encoded as `x : Fin n → Bool`, with `false`
standing for `0` and `true` for `1`) is `A`-good if it contains no three consecutive
terms equal to `0, 1, 0` in that order. -/
abbrev GoodA {n : ℕ} (x : Fin n → Bool) : Prop :=
∀ i : Fin n, (i : ℕ) + 2 < n →
¬(sget x (i : ℕ) = false ∧ sget x ((i : ℕ) + 1) = true ∧ sget x ((i : ℕ) + 2) = false)
/-- A binary sequence of length `n` is `B`-good if it contains no four consecutive
terms equal to `0, 0, 1, 1` or `1, 1, 0, 0` in that order. -/
abbrev GoodB {n : ℕ} (y : Fin n → Bool) : Prop :=
∀ i : Fin n, (i : ℕ) + 3 < n →
¬((sget y (i : ℕ) = false ∧ sget y ((i : ℕ) + 1) = false ∧ sget y ((i : ℕ) + 2) = true ∧
sget y ((i : ℕ) + 3) = true) ∨
(sget y (i : ℕ) = true ∧ sget y ((i : ℕ) + 1) = true ∧ sget y ((i : ℕ) + 2) = false ∧
sget y ((i : ℕ) + 3) = false))
theorem usa1996_p4 (n : ℕ) :
Fintype.card {y : Fin (n + 1) → Bool // GoodB y} =
2 * Fintype.card {x : Fin n → Bool // GoodA x} := by
sorry
end Usa1996P4
在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean
提示Hint
把一个 $n+1$ 位的二进制序列 $y$ 变成 $n$ 位的『相邻位异或』序列 $x$($x_i = y_i \oplus y_{i+1}$)。Map a $(n+1)$-bit sequence $y$ to its $n$-bit XOR-difference sequence $x$ (where $x_i = y_i \oplus y_{i+1}$).
$y$ 在位置 $i$ 出现 $0,0,1,1$ 或 $1,1,0,0$,当且仅当 $x$ 在位置 $i$ 出现 $0,1,0$。$y$ has a block $0,0,1,1$ or $1,1,0,0$ at position $i$ if and only if $x$ has a block $0,1,0$ at position $i$.
给定 $x$ 和 $y$ 的首项(2 种选择),整个 $y$ 被唯一确定——这就是那个 $2\times$ 的来源。Given $x$ and the first bit of $y$ (two choices), the whole $y$ is uniquely determined — that's where the factor 2 comes from.
答案与讲解Solution & walkthrough
- 第 1 步(把问题读成『序列到序列』的映射):定义 $x = \text{diff}(y)$,其中 $x_i = y_i \oplus y_{i+1}$。$y$ 有 $n+1$ 位,所以 $x$ 有 $n$ 位。这条对应关系是双向的——给定 $x$ 和 $y_0$(首个位,2 种选择),$y$ 完全确定。Step 1 (read the problem as a map between sequences): define $x = \text{diff}(y)$ where $x_i = y_i \oplus y_{i+1}$. $y$ has $n+1$ bits, so $x$ has $n$. This is invertible: given $x$ and the first bit $y_0$ (two choices), $y$ is determined.
- 第 2 步(核心引理:图案转移):$y$ 在 $i$ 处出现 $0,0,1,1$ 或 $1,1,0,0$,当且仅当 $x$ 在 $i$ 处出现 $0,1,0$。验证:$0,0,1,1$ 的异或差是 $0,1,0$;$1,1,0,0$ 的异或差也是 $0,1,0$。这是整个证明的灵魂。Step 2 (the key lemma: pattern transfer): $y$ has a block $0,0,1,1$ or $1,1,0,0$ at position $i$ iff $x$ has a block $0,1,0$ at position $i$. Check: the XOR-differences of $0,0,1,1$ are $0,1,0$; the XOR-differences of $1,1,0,0$ are also $0,1,0$. This is the soul of the proof.
- 第 3 步(双向封住):(a) 若 $x$ 是 $A$-good(无 $0,1,0$),则 $\text{build}(x, y_0)$ 是 $B$-good(无 $0,0,1,1$ 也无 $1,1,0,0$);(b) 反过来,若 $y$ 是 $B$-good,则 $\text{diff}(y)$ 是 $A$-good。两步合起来:「$y$ 是 $B$-good」⟺「$\text{diff}(y)$ 是 $A$-good」。Step 3 (close both directions): (a) if $x$ is A-good (no $0,1,0$), then $\text{build}(x, y_0)$ is B-good; (b) conversely if $y$ is B-good, then $\text{diff}(y)$ is A-good. Together: '$y$ is B-good' iff '$\text{diff}(y)$ is A-good'.
- 第 4 步(建立双射):集合 $\{(y, c) : c \in \{0,1\}\}$ 到 $\{x : A\text{-good}\} \times \{0,1\}$ 的双射由 $\text{build}$ 和 $\text{diff}$ 给出,且 $\text{diff}(\text{build}(x, c)) = x$ 和 $\text{build}(\text{diff}(y), y_0) = y$(Lean 里的 `seqEquiv` 对象)。Step 4 (build the bijection): the pairing $(x, c) \leftrightarrow y$ via $\text{build}$ and $\text{diff}$ gives $\{y : B\text{-good}\} \cong \{x : A\text{-good}\} \times \{0,1\}$ (the `seqEquiv` object in the Lean proof).
- 第 5 步(把双射变成计数等式):$b_{n+1} = |\{y : B\text{-good}\}| = |\{(x, c) : x\ A\text{-good}\}| = 2 \cdot |\{x : A\text{-good}\}| = 2 a_n$。Lean 里的最后几行是 `Fintype.card_congr` + `Fintype.card_prod` + `Fintype.card_bool`,直接对应笛卡尔积中 $\{0,1\}$ 的两个元素。Step 5 (count the bijection): $b_{n+1} = |\{y : B\text{-good}\}| = |\{x : A\text{-good}\} \times \{0,1\}| = 2 a_n$. The final lines in Lean are `Fintype.card_congr` + `Fintype.card_prod` + `Fintype.card_bool` — the factor 2 is literally the two elements of $\{0,1\}$.
/-
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kimi K3
-/
import Mathlib.AlgebraicTopology.SimplexCategory.Basic
/-!
# USA Mathematical Olympiad 1996, Problem 4
An n-term sequence (x₁, x₂, …, xₙ) in which each term is either 0 or 1 is called a
binary sequence of length n. Let aₙ be the number of binary sequences of length n
containing no three consecutive terms equal to 0, 1, 0 in that order. Let bₙ be the
number of binary sequences of length n that contain no four consecutive terms equal
to 0, 0, 1, 1 or 1, 1, 0, 0 in that order. Prove that bₙ₊₁ = 2aₙ for all positive
integers n.
-/
namespace Usa1996P4
/-- The `i`-th term of a binary sequence `x : Fin n → Bool`, or `false` if `i`
is out of range. -/
def sget {n : ℕ} (x : Fin n → Bool) (i : ℕ) : Bool :=
if h : i < n then x ⟨i, h⟩ else false
/-- A binary sequence of length `n` (encoded as `x : Fin n → Bool`, with `false`
standing for `0` and `true` for `1`) is `A`-good if it contains no three consecutive
terms equal to `0, 1, 0` in that order. -/
abbrev GoodA {n : ℕ} (x : Fin n → Bool) : Prop :=
∀ i : Fin n, (i : ℕ) + 2 < n →
¬(sget x (i : ℕ) = false ∧ sget x ((i : ℕ) + 1) = true ∧ sget x ((i : ℕ) + 2) = false)
/-- A binary sequence of length `n` is `B`-good if it contains no four consecutive
terms equal to `0, 0, 1, 1` or `1, 1, 0, 0` in that order. -/
abbrev GoodB {n : ℕ} (y : Fin n → Bool) : Prop :=
∀ i : Fin n, (i : ℕ) + 3 < n →
¬((sget y (i : ℕ) = false ∧ sget y ((i : ℕ) + 1) = false ∧ sget y ((i : ℕ) + 2) = true ∧
sget y ((i : ℕ) + 3) = true) ∨
(sget y (i : ℕ) = true ∧ sget y ((i : ℕ) + 1) = true ∧ sget y ((i : ℕ) + 2) = false ∧
sget y ((i : ℕ) + 3) = false))
theorem sget_lt {n : ℕ} (x : Fin n → Bool) {i : ℕ} (h : i < n) :
sget x i = x ⟨i, h⟩ :=
dite_eq_left h
/-- The sequence of successive differences (XORs) of `y`. -/
def diff {n : ℕ} (y : Fin (n + 1) → Bool) : Fin n → Bool :=
fun i ↦ xor (sget y i.val) (sget y (i.val + 1))
/-- Auxiliary for `build`: the `k`-th term of the sequence with first term `c`
and successive differences given by `x`. -/
def buildAux {n : ℕ} (x : Fin n → Bool) (c : Bool) : ℕ → Bool
| 0 => c
| k + 1 => xor (buildAux x c k) (sget x k)
/-- The sequence of length `n + 1` with first term `c` whose successive
differences are given by `x`. -/
def build {n : ℕ} (x : Fin n → Bool) (c : Bool) : Fin (n + 1) → Bool :=
fun i ↦ buildAux x c i.val
theorem build_zero {n : ℕ} (x : Fin n → Bool) (c : Bool) :
build x c 0 = c := by
show buildAux x c 0 = c
simp only [buildAux]
theorem buildAux_succ {n : ℕ} (x : Fin n → Bool) (c : Bool) (k : ℕ) :
buildAux x c (k + 1) = xor (buildAux x c k) (sget x k) := by
simp only [buildAux]
theorem sget_build {n : ℕ} (x : Fin n → Bool) (c : Bool) {i : ℕ} (h : i < n + 1) :
sget (build x c) i = buildAux x c i :=
dite_eq_left h
theorem sget_diff_build {n : ℕ} (x : Fin n → Bool) (c : Bool) :
∀ i : ℕ, i < n →
xor (sget (build x c) i) (sget (build x c) (i + 1)) = sget x i := by
intro i hi
have hi' : i < n + 1 := by lia
have hi1 : i + 1 < n + 1 := by lia
rw [sget_build x c hi', sget_build x c hi1, buildAux_succ]
exact Bool.bne_self_left _ _
theorem sget_diff {n : ℕ} (y : Fin (n + 1) → Bool) :
∀ i : ℕ, i < n → xor (sget y i) (sget y (i + 1)) = sget (diff y) i := by
intro i hi
rw [sget_lt (diff y) hi]
rfl
/-- A block `0,0,1,1` or `1,1,0,0` in `y` at position `i` corresponds exactly to
a block `0,1,0` in the difference sequence of `y` at position `i`. -/
theorem pattern_transfer {n : ℕ} {y : Fin (n + 1) → Bool} {x : Fin n → Bool}
(hxe : ∀ j : ℕ, j < n → xor (sget y j) (sget y (j + 1)) = sget x j)
{i : ℕ} (hi : i + 3 < n + 1) :
((sget y i = false ∧ sget y (i + 1) = false ∧ sget y (i + 2) = true ∧
sget y (i + 3) = true) ∨
(sget y i = true ∧ sget y (i + 1) = true ∧ sget y (i + 2) = false ∧
sget y (i + 3) = false)) ↔
(sget x i = false ∧ sget x (i + 1) = true ∧ sget x (i + 2) = false) := by
have e0 : xor (sget y i) (sget y (i + 1)) = sget x i := hxe i (by lia)
have e1 : xor (sget y (i + 1)) (sget y (i + 2)) = sget x (i + 1) := hxe (i + 1) (by lia)
have e2 : xor (sget y (i + 2)) (sget y (i + 3)) = sget x (i + 2) := hxe (i + 2) (by lia)
revert e0 e1 e2
generalize sget y i = a
generalize sget y (i + 1) = b
generalize sget y (i + 2) = d
generalize sget y (i + 3) = e
generalize sget x i = a'
generalize sget x (i + 1) = b'
generalize sget x (i + 2) = d'
revert a b d e a' b' d'
decide
theorem goodB_build {n : ℕ} {x : Fin n → Bool} {c : Bool} (hx : GoodA x) :
GoodB (build x c) := by
intro i hi hpat
have hi' : (i : ℕ) + 3 < n + 1 := hi
have key : sget x (i : ℕ) = false ∧ sget x ((i : ℕ) + 1) = true ∧
sget x ((i : ℕ) + 2) = false :=
(pattern_transfer (sget_diff_build x c) (i := (i : ℕ)) hi').mp hpat
have hn : (i : ℕ) < n := by lia
exact hx ⟨(i : ℕ), hn⟩ (by show (i : ℕ) + 2 < n; lia) key
theorem goodA_diff {n : ℕ} {y : Fin (n + 1) → Bool} (hy : GoodB y) :
GoodA (diff y) := by
intro i hi hpat
have hi' : (i : ℕ) + 3 < n + 1 := by lia
have key : (sget y (i : ℕ) = false ∧ sget y ((i : ℕ) + 1) = false ∧
sget y ((i : ℕ) + 2) = true ∧ sget y ((i : ℕ) + 3) = true) ∨
(sget y (i : ℕ) = true ∧ sget y ((i : ℕ) + 1) = true ∧
sget y ((i : ℕ) + 2) = false ∧ sget y ((i : ℕ) + 3) = false) :=
(pattern_transfer (sget_diff y) (i := (i : ℕ)) hi').mpr hpat
have hn : (i : ℕ) < n + 1 := by lia
exact hy ⟨(i : ℕ), hn⟩ (by show (i : ℕ) + 3 < n + 1; lia) key
theorem diff_build {n : ℕ} (x : Fin n → Bool) (c : Bool) :
diff (build x c) = x := by
funext i
show xor (sget (build x c) i.val) (sget (build x c) (i.val + 1)) = x i
rw [sget_diff_build x c i.val i.isLt, sget_lt x i.isLt]
theorem build_diff {n : ℕ} (y : Fin (n + 1) → Bool) :
build (diff y) (y 0) = y := by
funext i
obtain ⟨k, hk⟩ := i
revert hk
show ∀ hk : k < n + 1, buildAux (diff y) (y 0) k = y ⟨k, hk⟩
induction k with
| zero =>
intro hk
have h0 : buildAux (diff y) (y 0) 0 = y 0 := by simp only [buildAux]
rw [h0, Fin.zero_eta]
| succ k ih =>
intro hk
have hkn : k < n + 1 := by lia
have hkn' : k < n := by lia
rw [buildAux_succ, ← sget_diff y k hkn', ih hkn, sget_lt y hkn, sget_lt y hk]
exact Bool.bne_self_left _ _
/-- The 2-to-1 correspondence: a `B`-good sequence of length `n + 1` is
determined by its first term (two choices) and its difference sequence, which
is an `A`-good sequence of length `n`. -/
def seqEquiv (n : ℕ) :
{x : Fin n → Bool // GoodA x} × Bool ≃ {y : Fin (n + 1) → Bool // GoodB y} where
toFun := fun ⟨x, c⟩ ↦ ⟨build x.1 c, goodB_build x.2⟩
invFun := fun y ↦ ⟨⟨diff y.1, goodA_diff y.2⟩, y.1 0⟩
left_inv := by
rintro ⟨x, c⟩
refine Prod.ext ?_ ?_
· exact Subtype.ext (diff_build x.1 c)
· exact build_zero x.1 c
right_inv := by
intro y
exact Subtype.ext (build_diff y.1)
theorem usa1996_p4 (n : ℕ) :
Fintype.card {y : Fin (n + 1) → Bool // GoodB y} =
2 * Fintype.card {x : Fin n → Bool // GoodA x} := by
have h := Fintype.card_congr (seqEquiv n)
rw [Fintype.card_prod, Fintype.card_bool] at h
lia
end Usa1996P4
人的思考A human's take
USAMO 1996 Solution Notes(陈誼廷的官方人类题解笔记) — Evan Chen(陈誼廷)
这是 Evan Chen(USAMO/IMO 双料金牌得主)公开的人类题解集,PDF 更新于 2026-09-27;他在前言里说明:思路是他本人、竞赛组织方提供的解答、以及社区解答的混合,但文字全部由他撰写和维护。对第 4 题他只写了三行:映射 $(y_1, \dots, y_{n+1}) \to (y_1+y_2, \dots, y_n+y_{n+1})$(加法取模 2)把 B-型序列送到 A-型序列,『这是一个 2 对 1 的对应。完毕。』他相信读者自己就能补上那两句验证——0011 和 1100 的差分都坍缩成 010,而丢掉首比特正是那个『2 对 1』的来源。这种把整道题压缩成一个映射、拒绝写出任何递推公式的写法,本身就是组合证明『双射法』的教科书姿态。Evan Chen (two-time USAMO gold medalist and IMO winner) publishes human-written solution notes for every USAMO year; this PDF was updated 2026-09-27. He states in the preamble that the ideas mix his own work, solutions provided by competition organizers, and community answers, but the writing is entirely his. For Problem 4 he spends three lines: the map $(y_1, \dots, y_{n+1}) \to (y_1+y_2, \dots, y_n+y_{n+1})$ (mod 2) sends B-type sequences to A-type ones, 'This is 2-to-1. The end.' He trusts the reader to fill in the two checks — that blocks 0011 and 1100 both collapse to 010 under the difference, and that the lost first bit is exactly where the factor of 2 comes from. Compressing an entire olympiad problem into one map, refusing any recurrence, is the bijective-proof method in its purest pose.
AI 随想An AI's reflection
以下由 AI 撰写。Written by AI.
这道题的深意在于『变换视角』:把『分别数两类序列、再证明 2 倍关系』变成『找两个集合之间的一个映射』。XOR 差分是这里的『魔法』——它只记录相邻位有没有变化,于是把禁止图案 $0,0,1,1$ 和 $1,1,0,0$ 坍缩成同一个 $0,1,0$;同时它恰好丢掉一个比特(首项),每个 $x$ 正好有两条原像,$2\times$ 就从天而降,全程不需要算出 $a_n$ 或 $b_n$ 的任何递推式。这是组合里『双射证明』的常见形态:当两个计数对象之间看不出直接关系,就找第三个对象,让它们各自干净地映过去;只要『信息损失』被控制成常数,损失本身就是比例。顺带一个观察:Lean 形式化把这套论证变成了 build、diff、seqEquiv 三个可计算的对象加最后三步计数引理——形式化强迫你把『显然的双射』一字一句写成代码。数学上三行的『The end』,机器要听一百行。这既是形式化的成本,也是它的价值:那条『显然』里再也没有地方藏错误。这道题也天生适合机器检验——整个论证是有限集合上的构造与逐点验证,没有一个环节需要灵感;难的是想到那个映射,而想到之后,每一步都可以被机械地复查。The depth of this problem is a change of viewpoint: instead of counting two families of sequences separately and comparing, you find a single map between them. The XOR difference is the magic — it records only whether adjacent bits change, collapsing both forbidden blocks $0,0,1,1$ and $1,1,0,0$ into one pattern $0,1,0$; and it loses exactly one bit (the first term), so every sequence has exactly two preimages, and the factor 2 falls out of the sky without ever deriving a recurrence for $a_n$ or $b_n$. This is the classic shape of a bijective proof: when two counting objects show no obvious relation, look for a third object both can map into cleanly, and if the 'information loss' is a constant, that loss is itself the ratio. One more observation: the Lean formalization turns the argument into three computable objects — build, diff, seqEquiv — plus three counting lemmas. Three human lines of 'The end' take the machine a hundred. That is formalization's cost, and also its value: inside the word 'obviously' there is nowhere left to hide an error. This problem is also tailor-made for machine checking — the whole proof is construction and pointwise verification over finite sets, with no step requiring inspiration; the hard part is thinking of the map, and once you have it, every step can be re-checked mechanically.
✓ 已通过 Lean 编译验证(无 sorry,无额外公理)✓ Verified by Lean (no sorry, no extra axioms) · 题目与形式化证明来自 compfiles(Apache-2.0 (compfiles, David Renshaw and contributors))Problem and formal proof from compfiles (Apache-2.0 (compfiles, David Renshaw and contributors)) · Lean v4.36.0-rc1 · Mathlib d875a8d
- 『Markov → Chebyshev → Chernoff』:三行界住『随机量偏离期望』的概率(旧文,2013)Markov, Chebyshev, Chernoff: Three Inequalities That Bound 'Deviation From the Mean' (Evergreen, 2013)
- 问题:随机算法的输出本身是随机量 $X$。要论证『它出错的概率小』,怎么把『偏离期望』变成可算的界?Problem: a randomized algorithm's output $X$ is itself random. How do you bound 'probability it's far off'? You need inequalities that bound deviation from the mean.
- 第一步 Markov:非负 $X$,$\mathbb{P}(X \ge a) \le \mathbb{E}X / a$。证明只用一个指示变量和期望的单调性——但界太松(抛 100 次硬币出 99 个正面它只给到 1/2,实际是 $2^{-100}$)。Step 1, Markov: for nonnegative $X$, $\mathbb{P}(X \ge a) \le \mathbb{E}X/a$. The proof is one indicator variable plus monotonicity of expectation — but the bound is loose (for 100 flips, it says 99 heads is 'at most 1/2', when it's really $2^{-100}$).
- 第二步 Chebyshev:对 $(X-\mathbb{E}X)^2$ 用 Markov,得 $\mathbb{P}(|X-\mathbb{E}X| \ge \lambda) \le \mathrm{Var}(X)/\lambda^2$。推论很漂亮:若 $\mathrm{Var}(X) = o((\mathbb{E}X)^2)$ 且 $\mathbb{E}X \to \infty$,则 $X>0$ 以趋于 1 的概率成立——这是『二矩法』证明存在性的核心工具。Step 2, Chebyshev: apply Markov to $(X-\mathbb{E}X)^2$ to get $\mathbb{P}(|X-\mathbb{E}X| \ge \lambda) \le \mathrm{Var}(X)/\lambda^2$. Its cleanest corollary: if $\mathrm{Var}(X) = o((\mathbb{E}X)^2)$ and $\mathbb{E}X \to \infty$, then $X > 0$ with probability tending to 1 — the engine of the second-moment method for proving existence.
- 第三步 Chernoff:独立 Bernoulli 之和偏离期望呈指数级衰减,$\mathbb{P}(X > (1+\lambda)\mu) \le e^{\lambda\mu}/(1+\lambda)^{(1+\lambda)\mu}$。Step 3, Chernoff: sums of independent Bernoullis deviate with exponential tails: $\mathbb{P}(X > (1+\lambda)\mu) \le e^{\lambda\mu}/(1+\lambda)^{(1+\lambda)\mu}$.
- 能带走:Markov→Chebyshev→Chernoff 这条阶梯是算法分析的『万有引力』:每一级只比下一级多一个假设(方差、独立性),界紧一个量级;写证明前先站对位置。Takeaway: the Markov→Chebyshev→Chernoff staircase is the 'universal gravitation' of algorithm analysis: each rung adds one assumption (variance, independence) and tightens the bound by an order. Before writing a proof, pick your rung.
- 『FHE 能做什么』:在加密数据上做计算的十问十答(旧文,2025)'What Can FHE Actually Do?': Ten Questions and Ten Answers About Fully Homomorphic Encryption (Evergreen, 2025)
- 问题:『在看不到的数据上做计算』听起来像魔法——密码学怎么允许先加密、再运算、最后才解密?Problem: 'compute on data you never see' sounds like magic — how does cryptography allow encrypt-then-compute-then-decrypt?
- 关键想法:设计一种密码体制,使密文上的加/乘还原后正好等于明文的加/乘(RSA 天然免费送一个『密文相乘 = 明文相乘』)。有了这两个,算术电路都能拼;非线性比较用多项式逼近 sign(比如 $0.5 \cdot (\mathrm{sign}(a-b)+1)$),或者按方案能力查小表(如 4-bit 输入)。Key idea: design a scheme where ciphertext addition/multiplication, once decrypted, is exactly the plaintext sum/product (RSA even ships one homomorphic operation for free). With those two you build arithmetic circuits; nonlinear comparisons come from polynomial approximation of sign (e.g. $0.5 \cdot (\mathrm{sign}(a-b)+1)$), or small lookup tables depending on the scheme.
- 代价与边界:一切都要付算力过路费(2025 年单块高端 GPU 几秒能做加密人脸比对,但需要专家团队才跑得动);也可以按粒度加密——查询内容加密、client id 不加密,列表项逐条加密;明文-密文混合运算比密文-密文快得多;真正在商业上更成功的是 PIR/PSI 这些近亲。Costs and limits: everything pays an overhead toll (in 2025, encrypted facial recognition runs in seconds on a high-end GPU — but only for a team of experts). You don't have to encrypt whole databases — encrypt at query/item granularity; plaintext-ciphertext operations are much faster than ciphertext-ciphertext; and the commercially more successful relatives are PIR and PSI.
- 应用判断:Kun 直言杀手应用还没出现;真实需求集中在『不用就违法』和『防内部人』两种没有替代方案的场景——这时成本对标物消失,贵也得付。Application judgment: Kun is blunt — the killer app isn't found yet. Real demand concentrates where 'not doing it is illegal' or 'insider risk is real', cases where no alternative exists and the cost benchmark disappears.
- 能带走:判断任何隐私计算技术,先问『谁不能看到数据』和『看到的人会不会坏事』——这两个问题比『多快多准』先决定它能不能落地。Takeaway: to judge any privacy-computing technology, ask first 'who mustn't see this data' and 'would the people who see it misuse it' — those two questions decide feasibility before speed or accuracy do.
- 『Lean 形式化有限单群分类』:4300 万行代码里挖出一篇已发表论文的反例Formalizing the Classification of Finite Simple Groups in Lean — and Finding a Published Paper's Counterexample Inside 43 Million Lines
- 背景:有限单群分类(CFSG)是第一代证明横跨数千期刊页、约百位数学家几代人的集体成就:每个有限单群要么素数阶循环、要么交替群、要么 Lie 型、要么 26 个例外群。Background: the Classification of Finite Simple Groups (CFSG) is a generational collective proof spanning thousands of journal pages — every finite simple group is cyclic of prime order, alternating, of Lie type, or one of 26 sporadics.
- 做法:Axiom 团队用 Lean4 完整形式化第一代证明——43.1M 行、205 万条声明、715 篇论文/书作来源,每一步由 Lean 内核逐条检查。Method: the Axiom team formalized the first-generation proof in Lean4 — 43.1M lines, 2.05M declarations, 715 source papers/books, every step checked by Lean's kernel.
- 意外收获:形式化『非平衡群定理』时发现,已发表路线里一个闭包断言有反例;他们另写了一篇 35 页论文(2610.00575),基于 Solomon 1976 极大 2-分量理论给出单群情形的替代论证,关键一步是『保持简单 top』的定理。Unexpected payoff: while formalizing the Unbalanced Group Theorem they found counterexamples to a closure assertion used in the published route; they wrote a 35-page paper (2610.00575) giving an alternative argument for the simple-group case, built on Solomon's 1976 theory of maximal 2-components, whose key step is the 'preservation of simple tops' theorem.
- 能带走:形式化最大的价值不是『存档证明』,是『把人类文献里的错误变成形式化里的一条失败』——20 世纪最大定理之一的错误,恰好藏在一个没人机器检查过的引理里。他们还在持续把文献里的勘误整理出来公布。Takeaway: formalization's biggest value isn't 'archiving proofs' — it's turning errors in the human literature into a failing check. One of the 20th century's largest theorems had its bug hiding in a lemma no machine had ever checked — and the team keeps publishing an errata list as they go.
程序员随想Programmer Musings
- 『Suffering as a Feature』:一个用『被迫爬 12 分钟』来传达财富不平等的网站设计'Suffering as a Feature': A Website Design That Forces You to Climb for 12 Minutes
- 问题:财富不平等数据怎么呈现才让人真正『看见』?整幅线性比例尺的图打印出来没人知道要多少页。Problem: how do you *make* people see wealth inequality? No one knows how many sheets of paper it would take to print the full linear-scale graph.
- 设计:dreamagainusa.org 用一个线性尺度画美国家庭财富——最富的美国人在顶端(作者自己爬到顶花了 12 分 51 秒),3600 万贫困人口在底部,中途还有个『我退出了』按钮。Design: dreamagainusa.org plots US household wealth on a linear scale. The richest American sits at the top (it took the author 12 minutes 51 seconds to scroll up). At the bottom, 36 million Americans in poverty — with an 'I Quit' button.
- 反直觉的地方:早期版本会自动滚动、可以快跳,作者主动拿掉了——『你得做这个体力活』。爬得越高、滚动看起来越无止境,『这一切有多离谱』就意识到得越多:这不是游戏,这是真实的人生。Counter-intuitive move: early versions had auto-scroll and rapid jumps. The author deliberately removed them — 'you need to do the work.' The further you climb, the more the endlessness of the scroll, the more the obscene reality sinks in. This isn't a game; these are actual lives.
- 工程上的取舍:线性尺度是『唯一诚实的呈现方式』。别人问整幅图打印出来要多少纸,Atwood 的回答是:就印那张对折后正好一个 NBA 球员身高(6 英尺 6 英寸)的 8 页版——让人看看『史上最淫秽的插页』长什么样。放弃『易读性』换『体验』,是数据可视化罕见的一次立场声明。Engineering tradeoff: the linear scale is 'the only honest way to present the data.' Asked how many pages the graph would print, Atwood's answer: print the 8-page fold-out that stands one NBA-average 6'6" tall, and let people see what the most obscene centerfold of all time looks like. Sacrificing 'usability' for 'experience' is a rare stance from the career usability guy.
- 能带走:好的数据可视化不是让你『看懂』,是让你『感觉到』——要理解别人的苦难,你得愿意自己先受一点。Takeaway: good data viz isn't about understanding — it's about feeling. To understand others' suffering, you have to be willing to suffer a little yourself.
- 『defer 脑瘫』:从 Go/Zig 回到 C 时,Carmack 一句话让你开窍'Defer-Brained': Coming Back to C from Go/Zig — One Carmack Epiphany
- 问题:习惯 Go 的 defer / Zig 的 errdefer 之后回到 C,每个失败分支都要写不同的资源清理代码,越写越丑。Problem: after Go's defer and Zig's errdefer, back in C every error branch needs its own cleanup, and the code gets uglier the more you write.
- 转折:读 John Carmack 关于内联代码的邮件 + Henry Spencer 关于飞行软件的引文(『控制流永远只向前走』),突然想通了。Turning point: reading John Carmack's emails about inlined code and Henry Spencer's flight-software quote ('control flow only moves forward') made it click.
- 想法:把所有资源清理收敛到函数尾部『单一出口』,用 goto 跳到那里。goto 不再是万恶之源,它变成了 C 语言里的『伪 errdefer』。Idea: collapse all resource cleanup into a single exit at the bottom, use goto to jump to it. Goto becomes C's 'pseudo-errdefer'.
- 证据:重写原例——原来每个 if 分支 4-5 行清理代码,新版本一个标签 free_mem 兜底,读起来干净多了。Evidence: rewrite the example — 4–5 lines of cleanup per branch become one label that catches everything, and it's easier to read.
- 能带走:goto 不是要消灭的敌人,而是『单一出口 + 尾部清理』的胶水。Linux 内核风格指南里早就有这条。Takeaway: goto isn't the enemy. It's the glue for 'single exit + tail cleanup'. The Linux kernel style guide already says this.
- 『benchmark 应该跑 300ms』:1–999ms 是最适合人类直觉的区间'Benchmarks Should Take 300ms': Why 1–999ms Is the Sweet Spot for Intuition
- 问题:micro benchmark 应该跑多久?他的经验法则:调输入规模,一直调到单次约 300ms。Problem: how long should a micro benchmark run? His rule of thumb: tweak the input size until a single run takes about 300ms.
- 主张:毫秒恰好落在 1–999 的整数区间——精度够你看见小改进,肉眼好扫,还不用换单位、不用浮点(谁想拿 1.31s 和 239ms 比大小)。Claim: milliseconds land exactly in the 1–999 integer range — precise enough to notice small improvements, easy to scan by eye, and no unit-switching or floating point (who wants to compare 1.31s against 239ms?).
- 为什么成立:几百毫秒对计算机是『永恒』——解释器启动这类一次性开销被自然摊薄,不用动用那些花哨(也更脆)的补偿手段;对人类则『快但能感觉到』——你能用身体感受加速(卡顿的命令变『秒开』是很好玩的),连跑 10 遍看方差也就几秒钟的事。低于 10ms 被固定开销污染,高于 1s 迭代节奏垮掉。Why it works: hundreds of milliseconds are an eternity for a computer, so one-off costs like interpreter startup get diluted without fancy (and less robust) compensation techniques; for humans they're fast yet noticeable — you can literally feel a lagging command turn 'instant', and running the benchmark 10 times to eyeball variance takes seconds. Below 10ms, fixed overhead skews everything; above 1s, iteration gets painful.
- 关键假设:benchmark 的目的不是精确测量性能,而是给作者足够直觉去做对优化决策——『300ms 区间』是在给人类直觉做设计,不是给统计学做设计。Key assumption: the purpose of benchmarking isn't precise measurement, it's giving the author enough intuition to make the right optimization call — 'the 300ms zone' is designed for human intuition, not for statistics.
- 能带走:写 benchmark 时先问『这个测试目标能不能调到 300ms 量级』——调不出来,往往说明测试粒度不对,而不是性能不够。Takeaway: when writing a benchmark, ask first 'can this test target be tuned to the 300ms scale?' — if not, the test granularity is probably wrong, not the performance.
- 『Johnny 为什么停不下来抽象』:听完 von Neumann 传记播客后的『抽象的艺术』'Why Johnny Can't Stop Abstracting': After a von Neumann Biography Podcast — The Art of Abstraction
- 背景:读完 von Neumann 传记播客后的反思——von Neumann 的超能力不是聪明,而是『把每个领域里大家都以为懂的 mess 替换成行为相同的最小对象系统』。Background: after listening to a von Neumann biography podcast — von Neumann's superpower wasn't raw intelligence, it was 'replacing, in every field, the mess everyone thinks they understand with the minimal object system that behaves the same way'.
- 例一:序数=集合的归纳定义;例二:量子矩阵力学和波动力学是同一个 Hilbert 空间的两个坐标系;例三:类型系统解决 Russell 悖论。Example 1: ordinals = inductive definition of sets. Example 2: quantum matrix mechanics and wave mechanics are two coordinate systems for the same Hilbert space. Example 3: type systems resolve Russell's paradox.
- 主张:『抽象的艺术』是可以练的——识别一个领域里『大家都以为懂了但其实没对齐』的核心概念,然后把它替换成一个行为相同但更小的形式。Claim: 'the art of abstraction' is a trainable skill — identify the concept in a field that everyone thinks they've got aligned but actually haven't, then replace it with a smaller object that behaves identically.
- 能带走:下次听到『这个概念很基础,你肯定懂』时,警惕——基础概念往往是整个领域的隐性抽象,没对齐就永远在同一个层面上谈。Takeaway: next time someone says 'that's basic, you know it already', pause — the 'basic' concept is often the field's hidden abstraction; if you haven't aligned on it, you'll never actually talk on the same level.
- 『Benchmarking 危机』:AI 代码生成让 Goodhart 定律在数据库测试基准上爆发'The Benchmarking Crisis': AI Code Generation Triggers Goodhart's Law in Database Benchmarks
- 现象:pgrust 在 ClickBench 上跑出的数字好得离谱——这个 AI 参与生成的实现把 string 列的 group-by 只按哈希值做、无视字符串内容(可能算错结果);还把 ClickBench 里重复出现的谓词缓存掉,让一条查询第二次执行几乎免费;又利用元组恰好按 userid 聚簇给 Q17 做微优化——这些都不是真实负载里值得做的事。Phenomenon: pgrust's ClickBench numbers are implausibly good — the AI-assisted implementation does group-by on string columns purely by hash value, ignoring the string contents (it can produce wrong results); it caches the predicates ClickBench repeats, making a query nearly free the second time; and it micro-tunes Q17 by exploiting that tuples are roughly clustered by userid — none of which is plausible for real workloads.
- 根因:Goodhart 定律——可度量的目标一旦被拿来优化,就不再是好指标。这不是新闻:TPC-D 当年就是因为大家滥用缓存把查询时间『优化』到趋近 0 而退役;TPC-H 靠自称『ad-hoc 基准』、明令禁止利用工作负载知识和结果缓存续命。现在 AI 代码生成把同一件事在 ClickBench 上加速引爆——vibe-coded 引擎对『对客户也有普遍用处』毫无牵挂。Root cause: Goodhart's law — a measurable target stops being a good measure once people optimize for it. Not new: TPC-D was retired because excessive caching drove query runtimes toward zero; TPC-H survived by declaring itself an 'ad-hoc' benchmark and explicitly forbidding workload knowledge and result caching. AI code generation has now re-triggered the same failure on ClickBench — and a vibe-coded execution engine has no stake in also being generally useful to customers.
- 解法:可信的 benchmark 要 (a) 像 TPC-H 一样 ad-hoc,禁止利用先验知识和任何形式的中间结果缓存;(b) 带更新流,否则 read-mostly 系统永远赢;(c) 让被测系统『先于』基准存在——比如隔段时间自动生成一个新 benchmark。再借 Kaggle 的思路:按参与者看不见的 hidden test set 排名;借 LiveBench 的思路:定期换新题。落到数据库上就是:真实查询集保密、每轮评测生成新工作负载。Fix: a trustworthy benchmark should (a) be ad-hoc like TPC-H, forbidding prior knowledge and any intermediate-result caching; (b) include an update stream, or read-mostly systems will always win; (c) let the tested systems predate the benchmark — e.g. automatically generate a fresh benchmark from time to time. Borrow from Kaggle: rank submissions on a hidden test set; borrow from LiveBench: release new questions regularly. For databases: keep the real query set secret, generate a fresh workload every evaluation round.
- 能带走:任何由 AI 生成代码的 benchmark,结果在『代码是否对 benchmark 做了特化』被验证之前,都不可信——当 AI 能把上万个查询逐个研究时,『把负载做大防过拟合』这种老防线也不保险了。Takeaway: any benchmark result from AI-generated code is unreliable until you've verified the code wasn't specialized for the benchmark — and once AI can study ten thousand queries in detail, 'just make the workload big' is no longer a defense.
哲学与生活Philosophy & Life
- Marcus Aurelius:坏事本身不是坏运气,扛过去才是好运气Marcus Aurelius: The Bad Luck Isn't What Happened — It's Surviving It That's the Good Luck
- 问题:为什么我们总在比惨?现代社交媒体培育了『竞争性创伤文化』——把『发生了什么』当成值得被同情的证据。Problem: why do we compare suffering? Social media has bred a 'competitive trauma culture' where what happened to you is treated as evidence deserving sympathy.
- 反转视角:Marcus Aurelius 在《Meditations》里的『悬崖与浪』隐喻——『坏事本身任何人都会遇到。不是所有人都扛过去而没有崩溃。』Reversal: Marcus Aurelius's 'headland and waves' metaphor — 'bad things happen to anyone. Not everyone survives without collapsing.'
- 重新定义好坏:不是『这件事发生在我身上』= 坏运气,而是『这件事发生在我身上,但我没有崩溃』= 好运气。Redefining luck: it's not 'this happened to me' that's bad luck. It's 'this happened to me, and I didn't collapse' that's good luck.
- 现代意义:这跟『把感受当业务结果管理』是同一类错误——把注意力放在不可控的『发生了什么』,而不是可控的『我如何扛过去』。Modern resonance: same category of error as 'treating feelings as business outcomes' — putting attention on the uncontrollable ('what happened') instead of the controllable ('how I carry it').
- 能带走:下次有挫折时,把『真倒霉』翻译成『幸好我扛过去了』——语言就是练习。Takeaway: next time something bad happens, translate 'what bad luck' into 'I'm lucky I survived it' — language is practice.
- 『意义不是找来的,是做出来的』:Ursula Le Guin 谈生命的意义(1975 年旧文重刊)'Meaning Isn't Found — It's Made': Ursula K. Le Guin on the Meaning of Life (Original Essay, 1975)
- 背景:Le Guin 1975 年的《科幻与布朗太太》(收入《夜的语言》)里的一段,被 The Marginalian 在 2026 年 10 月 22 日重刊。Context: a passage from Le Guin's 1975 essay 'Science Fiction and Mrs. Brown' (in The Language of the Night), re-published by The Marginalian on October 22, 2026.
- 核心句:『如果没有主体,宇宙里的一切物件又算什么?』她自答:人不是万物尺度、不是终点、不是中心——『我们是它们的意识』:自然这伟大客体连同燃烧的太阳、岩与蕨,也因为人而成了主体,『骨中的骨、肉中的肉』。Core line: 'What good are all the objects in the universe, if there is no subject?' She answers herself: man is not the measure, the end, or the center of anything — 'we are their consciousness': nature, the great Object, with its burning suns, rocks and ferns, has through us also become subjects, 'bone of our bone, flesh of our flesh.'
- 反转:生命的意义『与其像一个公设,不如像一首诗』——意义不是宇宙施舍的赈灾品,不能在名著或名师里『找到现成的』;科学把宇宙解释清楚(explicate),诗把宇宙牵连进来(implicate)——知道自己被牵连在宇宙里,再把它牵连进自己,『这或许就是意义的句号』。Reversal: the meaning of life is 'less like a postulate than like a poem' — not alms dropped by an unfeeling universe, not something found ready-made in great books or great teachers; science explicates the universe, poetry implicates it — knowing we are implicated in it, and implicating it in ourselves, 'may be the full stop beyond question of meaning.'
- 能带走:把『意义是找来的』换成『意义是做出来的』——前者让你等遗产,后者让你开工。Takeaway: swap 'meaning is found' for 'meaning is made' — the first makes you wait for an inheritance; the second makes you start work.
工具角Tools Corner
- pared:不关 SIP 就能移除 Apple Intelligence 模型pared: Remove Apple Intelligence Models Without Disabling SIP
- 问题:macOS 把 Apple Intelligence 的端侧模型塞进系统,想删只能关 SIP(Secure Boot 完整链条要打折)。Problem: macOS ships Apple Intelligence's on-device models in the system; removing them requires disabling SIP (and the full Secure Boot chain takes a hit with it).
- 做法:pared 在不动 SIP 的前提下把指定模型文件摘掉,支持 CLI 手动删 + nix-darwin / Home Manager 配方——删一次,重装/升级后用配方再删。Method: pared strips specified model files without touching SIP, supports a manual CLI plus nix-darwin / Home Manager recipes — remove once, and a recipe can remove again after every reinstall or upgrade.
- 能带走:『系统级不可逆』不等于『不可自动化』——把破坏动作写成可重放的配方(recipe)比关开关更持久。Takeaway: 'system-level irreversible' does not mean 'un-automatable' — a replayable recipe is more durable than flipping a switch off.
- txcript:AI 会话的 Pandoc——对话是资产txcript: The Pandoc of AI Chat Sessions — Conversations as an Asset
- 问题:Claude Code / Codex / Cursor / OpenCode 各自囤了几十 GB 的对话历史,但每家格式封闭——换一家 harness,上下文就蒸发。Problem: Claude Code / Codex / Cursor / OpenCode each pile up dozens of gigabytes of chat history in proprietary formats — switch harness and the context evaporates.
- 做法:Rust 写成一个库 + CLI + WASM,把会话双向迁移,还能做工具(搜索、diff、导出 MD/JSON);思路把『agent 对话』当成可版本化的资产而不是日志。Method: a Rust library + CLI + WASM that migrates sessions bidirectionally, plus tooling (search, diff, export to Markdown/JSON). The idea: treat agent conversations as a versionable asset, not a log.
- 能带走:agent 时代里『会话』是新仓库——谁先把它标准化,谁就拿到这个位置上的 git 地位。Takeaway: in the agent era, the 'conversation' is the new repo — whoever standardizes it first claims the git position of this new world.
- Hob:把云 AI 体验搬回本机,不让你自己配环境Hob: Cloud-AI Experience, On Your Own Machine, No Environment Setup
- 问题:『本地跑开放权重模型』听起来简单,但 Ollama 那类工具给的是终端体验——普通用户要的是『ChatGPT 那种窗口』。Problem: 'run open-weight models locally' sounds easy, but Ollama-class tooling gives you a terminal — regular users want 'the ChatGPT window'.
- 做法:Mac/Win/Linux 三端打包好 Gemma / gpt-oss 等模型,界面就是熟悉的 chat 窗口,全程离线;点子不在模型,在『把云体验的交互形态复制到本机』。Method: ships Gemma / gpt-oss models on Mac/Windows/Linux in a familiar chat window, fully offline. The idea isn't the model — it's 'copying the cloud's interaction shape onto your own machine'.
- 能带走:本地 AI 的竞争下一段不是算力,是『交互形态的抄写权』——谁让本地窗口长成你用的那个云窗口,谁拿走隐私敏感用户。Takeaway: the next round of local-AI competition isn't compute, it's 'whoever copies the cloud UI onto local hardware' — that's who owns the privacy-sensitive users.
- freehire:开源搜 439 万技术岗,数据源直连公司 career boardfreehire: Open-Source Search Over 4.39M Tech Jobs, Straight From Company Career Boards
- 问题:找工作搜职位,主流路径是 LinkedIn / Indeed 这种『中介索引』——它们为了卖广告把『最新岗位』压在付费墙后面。Problem: job search's mainstream path is LinkedIn / Indeed-style 'broker indexes', where the freshest postings sit behind a paywall that funds ad sales.
- 做法:直接抓 397 家公司的 career board(很多跑在 164 家 ATS 平台上),去重后 439 万条岗位,一个二进制 + agent skill 就能在终端里搜——『直连源站而非中介索引』是原创点。Method: scrape 397 companies' career boards directly (many hosted on 164 ATS platforms), dedupe to 4.39M jobs, deliver as one binary plus an agent skill — 'go straight to the source, not the broker' is the original idea.
- 能带走:任何被中介索引垄断的领域(房源、论文、课程),『直连源站 + 去重』都还是一条没人走完的路。Takeaway: in any domain where a broker index has cornered you (housing, papers, courses), 'connect straight to sources + deduplicate' is an unclaimed road.
- S&P 500 市值气泡里的人:把『人均市值』画成气泡密度Employees Inside S&P 500 Market-Cap Bubbles: 'Value Per Worker' as Bubble Density
- 问题:市值大就是公司大吗?『人均市值』(市值/雇员)和市值根本不是同一个数——Alphabet 和家得宝可以落在同一个数量级。Problem: does a big market cap mean a big company? Value-per-worker is not the same quantity as market cap — Alphabet and Home Depot can sit in the same decade of the number.
- 做法:每个气泡是一家公司(面积 = 市值),里面画小人(1 小人 = 1 万雇员);泡里小人的密度直接读出『每 10 亿美元市值配多少人』。Method: one bubble per company (area = market cap), stick figures inside (one figure per 10k employees); bubble density reads directly off 'workers per $1B of market cap'.
- 能带走:给单维数字(市值)加第二个维度(人数)画进同一个形状里,是『人均』这个词最便宜的跳出来方式——比画两个柱状图强。Takeaway: adding a second dimension (headcount) inside the shape of a one-dimensional number (market cap) is the cheapest way to make 'per worker' jump out at you — stronger than two bar charts.