AI 能力过剩时代的四个人类优势Four Human Advantages in the Age of AI Overhang
发布于 2026-10-01Published 2026-10-01
今日深读Today's Deep Read
AI 能力过剩:真正稀缺的不是算力,是你AI Capability Overhang: What's Actually Scarce Isn't Compute — It's You
过去几个月,AI 领域几乎每天都在讨论一个话题:未来的 AI 会做什么?它会取代多少工作?它会不会失控?这些问题当然重要,但 Ethan Mollick 认为,我们可能把所有注意力都放错了地方。真正值得关注的问题不是未来的 AI 能做什么——而是现在的 AI 能做什么,以及为什么几乎没有人真正在用它做那些事。Over the past few months, almost every discussion in the AI world has been about what future AI will do: how many jobs will it replace, will it get out of control, what should we be worried about? These are important questions. But Ethan Mollick thinks we might be looking in the wrong direction. The more pressing question isn't what future AI will be capable of—it's what current AI is already capable of, and why almost nobody is using it for those things yet.
Mollick 举了几个例子:他用 GPT-6 Astra 把一个 1977 年的文字冒险游戏 Zork 变成了完整的 3D 动作游戏,让 Fable 5.1 从视频和照片里重建了意大利作家翁贝托·埃科的五千册私人藏书,还让 AI 用自己的书的内容做了一条 30 秒的动作电影预告片——从 Blender 3D 建模到视频剪辑,全程只用了他几次口头反馈。这些任务如果让一个团队来做,需要数周时间。但这里的关键不是 AI 多厉害,而是这些能力大部分还没有被普通人发掘和使用。Mollick shares a few examples: he had GPT-6 Astra turn a 1977 text adventure game called Zork into a full 3D action game, had Fable 5.1 reconstruct Italian author Umberto Eco's 5,000-book private library from videos and photographs, and got AI to create a 30-second action movie trailer from his own book manuscript—all with only a handful of verbal feedback from him. A human team would have spent weeks on each of these tasks. But the key takeaway isn't that AI is impressive. It's that most of these capabilities haven't been discovered or used by the average person yet.
他把这种现象叫作「能力悬垂」(capability overhang)——AI 实际能做到的事情,和大多数人实际在用 AI 做的事情之间,存在着巨大的落差。这个落差不是因为 AI 还不够强,而是因为大多数人根本没有把自己的优势带入 AI 协作中。大多数人用 AI 的方式,是把它当作一个更快的搜索引擎或者一个能写邮件的助手。但 Mollick 认为,真正能从 AI 中获得巨大回报的人,是那些能把自己的四个优势与 AI 的能力结合起来的人。He calls this phenomenon 'capability overhang'—the gap between what AI can actually do and what most people are actually using it to do. This gap exists not because AI isn't powerful enough, but because most people haven't brought their own advantages into the collaboration. Most people use AI as a faster search engine or an email assistant. Mollick argues that the people who will get enormous returns from AI are those who combine four specific human advantages with AI's capabilities.
这四个优势是:深度知识、广博见识、品味和能动性。深度知识是你对自己领域的直觉——有经验的会计师看一眼电子表格就知道哪里不对。这种直觉让你知道 AI 在什么时候是对的、什么时候走了偏。广博见识是你跨领域的知识储备——AI 学过设计思维、贝叶斯推理、丰田生产方式,但它不会主动告诉你这些模式,除非你知道该问什么。品味是你从 AI 输出中选择、拒绝、重组的能力——当生成变得廉价,判断变得昂贵。能动性则是你愿意去探索 AI 边界的好奇心和行动力——在没有人告诉你能做什么的时候,自己试一试。这四个优势共同构成了一种新的能力模型:你不是在和 AI 竞争输出,而是在和 AI 合作完成只有人类 + AI 才能完成的事情。Those four advantages are: deep knowledge, wide knowledge, taste, and agency. Deep knowledge is your domain intuition—an experienced accountant can glance at a spreadsheet and know something is wrong. This intuition tells you when AI is right and when it has drifted. Wide knowledge is your cross-domain reservoir—AI has learned design thinking, Bayesian reasoning, the Toyota Production System, but it won't volunteer these patterns unless you know to ask. Taste is your ability to select, reject, and recombine AI output—when creation becomes cheap, judgment becomes expensive. Agency is the curiosity and willingness to explore AI's boundaries yourself—to try things when no one has told you they're possible. Together, these four advantages form a new model of capability: you're not competing with AI on output, you're collaborating with it on things only a human + AI team can accomplish.
这篇文章最有力量的地方,不在于它列举了四个优势,而在于它用一个具体的例子说明了为什么这些优势对普通人来说仍然重要。当 AI 能写出代码、生成图片、制作视频的时候,很多人感到的不是兴奋,而是一种空洞的无力感。Mollick 的答案是:你的价值不在于你能生成多少东西,而在于你知道什么值得生成,以及为什么。The most powerful part of this article isn't the list of four advantages. It's the specific example that explains why these advantages still matter for ordinary people. When AI can write code, generate images, and produce video, many people feel not excitement but a hollow sense of inadequacy. Mollick's answer is simple: your value isn't in how much you can produce—it's in knowing what's worth producing, and why.
AI 思考AI Thoughts
- AI 没有改变我做数学的方式,但彻底改变了我的执行速度AI Didn't Change How I Do Math, But It Completely Changed My Execution Speed
- 问题是什么:AI 越来越强,数学家开始问——AI 会不会让数学研究变得不再需要人类?The question: As AI gets stronger, mathematicians wonder—will AI make human math research unnecessary?
- 关键想法:Tao 把数学研究分成两部分——「找什么值得说」(创意层面)和「怎么说清楚」(执行层面)。AI 能大幅提升执行速度,但不会改变「什么是有意思的数学」这一判断标准。The key idea: Tao splits mathematical research into two parts: finding what's worth saying (creative judgment) and saying it clearly (execution). AI can dramatically speed up execution, but it doesn't change the standard for what counts as interesting mathematics.
- 为什么成立:Tao 说,好的数学写作不只是清晰正确,而是「说了有趣的东西」。找到有趣的东西需要理解问题的深层结构,这是 AI 目前做不到的。他用了一个比喻:数学研究像写小说,定义是角色,引理和定理是情节——它们受真理性约束,但作者可以策略性地选择呈现方式。Why it holds: Tao says good mathematical writing isn't just clear and correct—it's 'saying something interesting.' Finding what's interesting requires deep understanding of a problem's structure, which AI can't currently do. He uses an analogy: math research is like writing a novel, where definitions are characters and lemmas and theorems are plot—constrained by truth, but strategically chosen in presentation.
- 能带走什么:如果你在做数学或任何需要创意的领域,AI 是你强大的执行助手,但不要让它替你决定「什么值得做」。真正稀缺的判断力仍然在人类手中。What to take away: If you work in math or any creative field, AI is a powerful execution assistant, but don't let it decide 'what's worth doing.' The rare judgment call still belongs to humans.
- 我们在召唤幽灵,而不是在培养动物We're Summoning Ghosts, Not Raising Animals
- 问题是什么:AI 研究的终极目标是什么?是建造像动物一样从经验中学习的智能体,还是建造像幽灵一样从人类文本中提炼出来的统计体?这个比喻来自 Reinforcement Learning 之父 Rich Sutton 的访谈,他批评当前 LLM 研究过于依赖人类数据,而不是让智能体从环境中自主学习。The question: What is the ultimate goal of AI research? Are we building intelligence that learns from experience like an animal, or statistical entities distilled from human text like ghosts? This distinction comes from a podcast with Rich Sutton, father of Reinforcement Learning, who criticizes current LLM research for being too dependent on human data rather than letting agents learn from their environment.
- 关键想法:Karpathy 提出「动物 vs 幽灵」的比喻。动物代表像松鼠一样从环境中学习的智能体——没有预训练,没有监督微调,只有与环境互动的强化学习。幽灵则是当前 LLM 的隐喻:它们不是从真空中学习,而是从海量人类文本中蒸馏出来的统计复本,充满了人类的偏见和痕迹。The key idea: Karpathy proposes the 'animals vs. ghosts' metaphor. Animals represent agents that learn from their environment like a squirrel—no pretraining, no fine-tuning, just reinforcement learning through interaction. Ghosts are the metaphor for current LLMs: not learned from nothing, but statistical replicas distilled from vast human text, full of human bias and traces.
- 为什么成立:Karpathy 指出,动物的学习虽然看起来是「从 scratch」,但实际上婴儿斑马出生几十分钟就能跑——这不是 tabula rasa,而是数十亿参数在 DNA 中经过「外层循环」进化优化过的结果。同样,LLM 的预训练就是我们的「粗糙进化」——用互联网文档作为软约束,把数千亿参数从随机状态推到有意义的初始化点。没有这一步,仅靠 RL 从零开始是不可能的。Why it holds: Karpathy points out that although animal learning looks like 'from scratch,' a baby zebra can run within minutes of birth—not tabula rasa, but billions of parameters optimized through an 'outer loop' of evolution encoded in DNA. Similarly, LLM pretraining is our 'crappy evolution'—using internet documents as soft constraints to push hundreds of billions of parameters from randomness to a meaningful initialization. Without this step, learning from scratch via RL alone is impossible.
- 能带走什么:当前的 LLM 研究不是「建动物」,而是「召唤幽灵」。幽灵和动物之间可能最终会分道扬镳——就像飞机和鸟,功能相似但结构迥异。理解这一点,有助于我们既不傲慢也不悲观:幽灵虽然不完美,但仍然可以改变世界。What to take away: Current LLM research isn't 'building animals'—it's 'summoning ghosts.' Ghosts and animals may ultimately diverge, like planes and birds: similar function, radically different structure. Understanding this helps us avoid both arrogance and despair: ghosts are imperfect, but still world-altering.
- AI 时代的工作形态:从「协作智能」到「管理 AI」Work in the AI Era: From Co-Intelligence to Managing AI
- 问题是什么:2023 年 ChatGPT 发布后,人类与 AI 的协作模式被称作「协作智能」——人类给出提示,AI 响应,来回迭代。但 2025 年底,随着 Claude Code、OpenAI Codex 等 AI 代理的出现,工作模式发生了根本性转变:你不再和 AI 「对话」,而是把任务「交给」AI,等它完成后检查结果。The question: After ChatGPT launched in 2023, the human-AI collaboration model was called 'co-intelligence'—humans give prompts, AI responds, and they iterate back and forth. But by late 2025, with AI agents like Claude Code and OpenAI Codex, the work model shifted fundamentally: you no longer 'converse' with AI—you hand it a task and check the result afterward.
- 关键想法:Mollick 称这种新范式为「管理 AI 的时代」。核心变化在于:你不再需要参与每一个步骤,而是需要设定目标、分配任务、验收结果。StrongDM 的「软件工厂」就是一个极端案例——三个人的团队让 AI 代理完成所有编码和测试,人类只写产品路线图,最后验收成品。规则是:代码不能由人类写,也不能由人类审查。The key idea: Mollick calls this new paradigm 'the era of managing AI.' The core change: you no longer participate in every step, but set goals, assign tasks, and review the results. StrongDM's 'Software Factory' is an extreme case—a three-person team lets AI agents handle all coding and testing; humans only write product roadmaps and sign off on the final product. The rules: code must not be written by humans, nor reviewed by humans.
- 为什么成立:这种转变背后的驱动力是 AI 能力的指数级增长。METR 的长期任务基准测试显示,AI 在复杂多步骤任务上的表现已经接近甚至超过人类专家。但增长的曲线是「锯齿状」的——AI 在某些任务上极强,在其他任务上仍然不可靠。这意味着新工作模式不是简单的「人 vs AI」,而是「人在哪里介入、在哪里放手」的持续谈判。Why it holds: The driving force behind this shift is exponential AI capability growth. METR's long-task benchmark shows AI approaching or exceeding human experts on complex multi-step tasks. But the growth curve is 'jagged'—AI is extremely strong at some tasks and still unreliable at others. This means the new work model isn't a simple 'human vs AI'—it's a continuous negotiation about where humans intervene and where they let go.
- 能带走什么:未来的工作不是「用 AI 做更多事」,而是重新定义「什么是人的工作」。当 AI 可以独立完成一个任务时,你的价值不在于执行,而在于判断:什么任务值得做、做到什么程度、什么时候该放手。What to take away: The future of work isn't 'doing more with AI'—it's redefining 'what is human work.' When AI can complete a task on its own, your value isn't in execution, but in judgment: which tasks are worth doing, to what standard, and when to let go.
- 看不见的阈值:一个从业者眼中的 2026 年 LLMThe Invisible Line: A Practitioner's View of 2026 in LLMs
- 问题是什么:短短一年,AI 从「玩具」变成了日常工具,到底发生了什么?Simon Willison 把他 2026 年 9 月闭幕演讲整理成第一人称的盘点——不是罗列产品发布,而是讲「身处变化之中是什么感受」。The question: In one year, AI went from toy to daily tool—what actually happened? Simon Willison turned his closing keynote at a September 2026 conference into a first-person recap, not of product releases but of what it feels like to be inside the shift.
- 关键想法:他把转折点称为一条「看不见的线」:2025 年 11 月的 Claude Opus 4.5 和 GPT-5.1 单独看只是「渐进改进」,但配上 Claude Code、Codex 这类工具外壳,突然就从「经常出错」跨到了「可靠到可以天天用」。能力不是模型的分数,而是「模型 + 脚手架」组合出来的可靠性。The key idea: He calls the turning point an 'invisible line.' Claude Opus 4.5 and GPT-5.1, released in November 2025, were 'incremental improvements' on their own—but paired with a harness like Claude Code or Codex, they crossed from 'often make mistakes' to 'reliable enough to use day to day.' Capability isn't a model's benchmark score; it's the reliability of the model-plus-scaffolding combination.
- 为什么成立:他用两手观察来检验。一是自己的「AI 狂热」体验:agent 变可靠后,他闲不住,让 agent 用 Python 重写了一个 JS 解释器和一个 WASM 运行时——做完之后才能问出那句「世界真的需要一个又慢、又满是 bug、半成品 Python JS 解释器吗?」过度 ambitious 恰好成了探测边界最好的办法。二是去年他公开预测「沙箱化会成为议题」:今年这场大会 277 场分享里有 40 场谈到沙箱或 agent 安全——一个人的判断变成了整个行业的议程。Why it holds: He checks this with two first-hand observations. First, his own 'AI mania': once agents became dependable, every idle moment felt wasted, so he had agents build a JavaScript interpreter and a WebAssembly runtime in Python—and only then could he ask, 'does the world need a slow, buggy, half-baked Python JavaScript interpreter?' Over-ambition turned out to be the best way to probe the boundary. Second, his prediction a year ago that sandboxing would become a real agenda item: 40 of the 277 sessions at this conference touched on sandboxing or agent security—one person's hunch had become the industry's topic.
- 能带走什么:他和 Bryan Cantrill 造了一个词「Deep Blue」,形容「AI 什么都能做」带来的那种工程师提不起劲的倦怠感。他的答案不是退缩,而是继续推进——「找到这套技术极限的唯一办法,是一直推到它不灵为止」——同时分清「能做」和「值得做」。What to take away: His coinage 'Deep Blue' (from a podcast with Bryan Cantrill) names the profession's mood: the AI-induced ennui of knowing the AI can do anything. His answer isn't to retreat but to keep pushing—'the only way to find the limits of this technology is to keep pushing them until they don't work'—while staying honest about the difference between what can be built and what's worth building.
数学之美Beauty of Mathematics
每日 Lean 谜题 · 周四Daily Lean Puzzle · Thursday ★★★★☆☆☆
USAMO 2020 第 4 题:最大的互质对数USAMO 2020 Problem 4: Maximum Number of Coprime-Adjacent Pairs
给定 100 个不同的有序非负整数对 $(a_1, b_1), (a_2, b_2), \ldots, (a_{100}, b_{100})$。Given 100 distinct ordered pairs of nonnegative integers $(a_1, b_1), (a_2, b_2), \ldots, (a_{100}, b_{100})$.
令 $N$ 为满足 $1 \le i < j \le 100$ 且 $|a_i b_j - a_j b_i| = 1$ 的整数对 $(i, j)$ 的数量。Let $N$ denote the number of pairs $(i, j)$ with $1 \le i < j \le 100$ satisfying $|a_i b_j - a_j b_i| = 1$.
求 $N$ 的最大可能值。Determine the largest possible value of $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.Algebra.Order.Ring.Star
import Mathlib.AlgebraicTopology.SimplexCategory.Basic
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Data.Int.Star
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.LinearCombination.Lemmas
/-!
# USA Mathematical Olympiad 2020, Problem 4
Suppose that (a₁, b₁), (a₂, b₂), ..., (a₁₀₀, b₁₀₀) are distinct ordered pairs
of nonnegative integers. Let N denote the number of pairs of integers (i, j)
satisfying 1 ≤ i < j ≤ 100 and |aᵢbⱼ − aⱼbᵢ| = 1. Determine the largest
possible value of N over all possible choices of the 100 ordered pairs.
-/
namespace Usa2020P4
def det (P Q : ℕ × ℕ) : ℤ := (P.1 : ℤ) * (Q.2 : ℤ) - (Q.1 : ℤ) * (P.2 : ℤ)
abbrev answer : ℕ := sorry
set_option maxRecDepth 4096 in
theorem usa2020_p4 :
IsGreatest {N : ℕ | ∃ v : Fin 100 → ℕ × ℕ, Function.Injective v ∧
N = (Finset.univ.filter fun p : Fin 100 × Fin 100 =>
p.1 < p.2 ∧ |det (v p.1) (v p.2)| = 1).card} answer := by
sorry
end Usa2020P4
在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean
提示Hint
考虑将点 $(a_i, b_i)$ 视为平面上的格点。条件 $|a_i b_j - a_j b_i| = 1$ 意味着由原点和这两个点构成的平行四边形面积为 1。从最远点入手,考虑它与其它点形成的行列式。Think of the points $(a_i, b_i)$ as lattice points in the plane. The condition $|a_i b_j - a_j b_i| = 1$ means the parallelogram formed by the origin and these two points has area 1. Start with the farthest point and consider the determinants it forms with all other points.
答案与讲解Solution & walkthrough
- 构造:取点集 $\{(1,0), (1,1), (2,1), (3,1), \ldots, (99,1)\}$。$(1,0)$ 与每个 $(k,1)$ 的行列式绝对值为 1,共 99 对;相邻的 $(k,1)$ 与 $(k+1,1)$ 的行列式绝对值也为 1,共 98 对。总计 $99 + 98 = 197$。Construction: Take the point set $\{(1,0), (1,1), (2,1), (3,1), \ldots, (99,1)\}$. The point $(1,0)$ forms determinant $\pm 1$ with each $(k,1)$, giving 99 pairs; adjacent points $(k,1)$ and $(k+1,1)$ also give determinant $\pm 1$, giving 98 more pairs. Total: $99 + 98 = 197$.
- 上界证明的核心思想:对 $n$ 个点用强归纳法。取距离原点最远的点 $P$。如果 $\gcd(P_1, P_2) > 1$,则 $P$ 与任何其它点形成的行列式都被这个 gcd 整除,不可能等于 1,所以 $P$ 贡献 0 对。如果 $P$ 是 primitive(即 gcd=1),则满足 $|\det(P,Q)|=1$ 的点 $Q$ 位于两条平行线上($\det(P,Q)=1$ 和 $\det(P,Q)=-1$)。Key idea for the upper bound: Strong induction on $n$ points. Take the point $P$ farthest from the origin. If $\gcd(P_1, P_2) > 1$, then $\gcd$ divides every determinant $\det(P,Q)$, so $P$ contributes 0 pairs. If $P$ is primitive (gcd=1), then points $Q$ with $|\det(P,Q)|=1$ lie on two parallel lines.
- 在这两条线上的格点之间间距恰好是向量 $P$ 本身。由于 $P$ 是最远点,每条线上在闭圆盘内(包含所有给定点)最多只能有一个这样的 $Q$(除了原点,但原点不在我们的点集中)。因此 $P$ 最多贡献 2 对。On each of these two lines, lattice points are spaced exactly by the vector $P$. Since $P$ is the farthest point, each line can contain at most one such $Q$ (other than the origin, which isn't in our set) within the closed disk containing all points. So $P$ contributes at most 2 pairs.
- 去掉 $P$ 后剩 $n-1$ 个点,由归纳假设有最多 $2(n-1)-3$ 对。加上 $P$ 贡献的至多 2 对,总共最多 $2(n-1)-3+2 = 2n-3$ 对。当 $n=100$ 时,最大值为 $2 \times 100 - 3 = 197$。After removing $P$, we have $n-1$ points, which by induction have at most $2(n-1)-3$ pairs. Adding at most 2 from $P$, the total is at most $2(n-1)-3+2 = 2n-3$. For $n=100$, the maximum is $2 \times 100 - 3 = 197$.
/-
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.Algebra.Order.Ring.Star
import Mathlib.AlgebraicTopology.SimplexCategory.Basic
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Data.Int.Star
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.LinearCombination.Lemmas
/-!
# USA Mathematical Olympiad 2020, Problem 4
Suppose that (a₁, b₁), (a₂, b₂), ..., (a₁₀₀, b₁₀₀) are distinct ordered pairs
of nonnegative integers. Let N denote the number of pairs of integers (i, j)
satisfying 1 ≤ i < j ≤ 100 and |aᵢbⱼ − aⱼbᵢ| = 1. Determine the largest
possible value of N over all possible choices of the 100 ordered pairs.
-/
namespace Usa2020P4
/-- The determinant `aᵢ bⱼ − aⱼ bᵢ` of two ordered pairs of nonnegative
integers, viewed as an integer. -/
def det (P Q : ℕ × ℕ) : ℤ := (P.1 : ℤ) * (Q.2 : ℤ) - (Q.1 : ℤ) * (P.2 : ℤ)
abbrev answer : ℕ := 197
/-!
## Solution
The answer is `197 = 2 * 100 - 3`; more generally the maximum for `n ≥ 2`
points is `2n - 3`.
*Construction*: take `(1, 0)` together with `(k, 1)` for `1 ≤ k ≤ 99`. The
good pairs are `{(1, 0), (k, 1)}` for `1 ≤ k ≤ 99` (99 pairs) and
`{(k, 1), (k + 1, 1)}` for `1 ≤ k ≤ 98` (98 pairs), totalling `197`.
*Upper bound*: induction on `n`. Given `n ≥ 3` points, let `P` be a point with
maximal distance from the origin. Then `P` belongs to at most two good pairs:
if `P = (0, 0)` or `gcd P.1 P.2 > 1` it belongs to none, since `gcd P.1 P.2`
divides every determinant `det P Q`; and if `P = (a, b)` is primitive, the good
partners `Q` of `P` lie on one of the two lines `det P Q = ±1`. On each line
the lattice points are spaced exactly by the vector `(a, b)`, so at most one of
them (other than the origin, which is never a good partner) can lie in the
closed disk of radius `|P|` around the origin that contains all the given
points. Removing `P` therefore destroys at most two good pairs, and
`2 * (n - 1) - 3 + 2 = 2 * n - 3` by induction.
-/
/-- The good two-element subsets of a set of points: those `{P, Q}` with
`|det P Q| = 1`. -/
private def goodSets (S : Finset (ℕ × ℕ)) : Finset (Finset (ℕ × ℕ)) :=
(S.powersetCard 2).filter fun s => ∀ P ∈ s, ∀ Q ∈ s, P ≠ Q → |det P Q| = 1
/-- The good index pairs of a choice `v` of 100 points. -/
private def goodPairs (v : Fin 100 → ℕ × ℕ) : Finset (Fin 100 × Fin 100) :=
Finset.univ.filter fun p => p.1 < p.2 ∧ |det (v p.1) (v p.2)| = 1
private lemma det_swap (P Q : ℕ × ℕ) : det Q P = -det P Q := by unfold det; ring
/-- If `(u, v) = (u', v') + t • (a, b)` with `t ≥ 1`, all of `u' v' a b`
nonnegative, and `u² + v² ≤ a² + b²`, then `(u', v') = (0, 0)`. -/
private lemma eq_zero_of_eq_add_mul {u v u' v' a b t : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b)
(hu' : 0 ≤ u') (hv' : 0 ≤ v') (ht : 1 ≤ t)
(huu : u = u' + t * a) (hvv : v = v' + t * b)
(hn : u ^ 2 + v ^ 2 ≤ a ^ 2 + b ^ 2) : u' = 0 ∧ v' = 0 := by
have h1 : a ≤ u := by
calc a = 1 * a := (one_mul a).symm
_ ≤ t * a := mul_le_mul_of_nonneg_right ht ha
_ ≤ u' + t * a := le_add_of_nonneg_left hu'
_ = u := huu.symm
have h2 : b ≤ v := by
calc b = 1 * b := (one_mul b).symm
_ ≤ t * b := mul_le_mul_of_nonneg_right ht hb
_ ≤ v' + t * b := le_add_of_nonneg_left hv'
_ = v := hvv.symm
have h3 : a ^ 2 ≤ u ^ 2 := pow_le_pow_left₀ ha h1 2
have h4 : b ^ 2 ≤ v ^ 2 := pow_le_pow_left₀ hb h2 2
have h5 : a ^ 2 = u ^ 2 ∧ b ^ 2 = v ^ 2 := by constructor <;> linarith
have hu_eq : u = a := by
rcases sq_eq_sq_iff_eq_or_eq_neg.mp h5.1.symm with h | h
· exact h
· linarith
have hv_eq : v = b := by
rcases sq_eq_sq_iff_eq_or_eq_neg.mp h5.2.symm with h | h
· exact h
· linarith
have hu'e : u' = (1 - t) * a := by linear_combination hu_eq - huu
have hv'e : v' = (1 - t) * b := by linear_combination hv_eq - hvv
have h1t : (1 : ℤ) - t ≤ 0 := by linarith
exact ⟨le_antisymm (by rw [hu'e]; exact mul_nonpos_of_nonpos_of_nonneg h1t ha) hu',
le_antisymm (by rw [hv'e]; exact mul_nonpos_of_nonpos_of_nonneg h1t hb) hv'⟩
/-- Two points of the first quadrant having the same determinant of absolute
value `1` with a primitive point `P`, and both at most as far from the origin
as `P`, must coincide. -/
private lemma eq_of_det_eq_of_le {P Q₁ Q₂ : ℕ × ℕ} (hP : Nat.Coprime P.1 P.2)
(hdet : det P Q₁ = det P Q₂) (habs : |det P Q₁| = 1)
(hn₁ : Q₁.1 ^ 2 + Q₁.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2)
(hn₂ : Q₂.1 ^ 2 + Q₂.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2) : Q₁ = Q₂ := by
obtain ⟨a, b⟩ := P
obtain ⟨u₁, v₁⟩ := Q₁
obtain ⟨u₂, v₂⟩ := Q₂
simp only [det] at hdet habs
dsimp only at hP hn₁ hn₂ hdet habs
have hn₁' : (u₁ : ℤ) ^ 2 + (v₁ : ℤ) ^ 2 ≤ (a : ℤ) ^ 2 + (b : ℤ) ^ 2 := by
exact_mod_cast hn₁
have hn₂' : (u₂ : ℤ) ^ 2 + (v₂ : ℤ) ^ 2 ≤ (a : ℤ) ^ 2 + (b : ℤ) ^ 2 := by
exact_mod_cast hn₂
have h1 : (a : ℤ) * ((v₁ : ℤ) - (v₂ : ℤ)) = ((u₁ : ℤ) - (u₂ : ℤ)) * (b : ℤ) := by
linear_combination hdet
have hcop : IsCoprime (a : ℤ) (b : ℤ) := Int.isCoprime_iff_gcd_eq_one.mpr (by
rw [Int.gcd_natCast_natCast]; exact hP)
have hdvd : (a : ℤ) ∣ (u₁ : ℤ) - u₂ :=
hcop.dvd_of_dvd_mul_right ⟨(v₁ : ℤ) - v₂, h1.symm⟩
obtain ⟨t, hta, htb⟩ :
∃ t : ℤ, (u₁ : ℤ) - u₂ = t * a ∧ (v₁ : ℤ) - v₂ = t * b := by
obtain ⟨t, ht⟩ := hdvd
by_cases ha0 : (a : ℤ) = 0
· have ha0' : a = 0 := by exact_mod_cast ha0
have hb1 : (b : ℤ) = 1 := by
have hP1 : Nat.gcd a b = 1 := hP
rw [ha0', Nat.gcd_zero_left] at hP1
exact_mod_cast hP1
exact ⟨(v₁ : ℤ) - v₂, by rw [ht, ha0, zero_mul, mul_zero], by rw [hb1, mul_one]⟩
· refine ⟨t, by rw [ht, mul_comm], ?_⟩
have h2 : (a : ℤ) * ((v₁ : ℤ) - v₂) = (a : ℤ) * (t * (b : ℤ)) := by
rw [h1, ht]; ring
exact mul_left_cancel₀ ha0 h2
have hta' : (u₁ : ℤ) = u₂ + t * a := by linear_combination hta
have htb' : (v₁ : ℤ) = v₂ + t * b := by linear_combination htb
rcases lt_or_ge t 1 with htl | htg
· by_cases ht0 : t = 0
· subst ht0
rw [zero_mul, add_zero] at hta'
rw [zero_mul, add_zero] at htb'
exact Prod.ext_iff.mpr ⟨Nat.cast_inj.mp hta', Nat.cast_inj.mp htb'⟩
· have htn : 1 ≤ -t := by lia
have huu : (u₂ : ℤ) = u₁ + (-t) * a := by linear_combination -hta'
have hvv : (v₂ : ℤ) = v₁ + (-t) * b := by linear_combination -htb'
obtain ⟨hu1, hv1⟩ := eq_zero_of_eq_add_mul (Int.natCast_nonneg _)
(Int.natCast_nonneg _) (Int.natCast_nonneg _) (Int.natCast_nonneg _)
htn huu hvv hn₂'
rw [hu1, hv1] at habs
simp at habs
· obtain ⟨hu2, hv2⟩ := eq_zero_of_eq_add_mul (Int.natCast_nonneg _)
(Int.natCast_nonneg _) (Int.natCast_nonneg _) (Int.natCast_nonneg _)
htg hta' htb' hn₁'
rw [hdet, hu2, hv2] at habs
simp at habs
/-- The gcd of the coordinates of `P` divides every determinant `det P Q`. -/
private lemma gcd_dvd_det (P Q : ℕ × ℕ) : (Nat.gcd P.1 P.2 : ℤ) ∣ det P Q := by
obtain ⟨a, b⟩ := P
obtain ⟨u, v⟩ := Q
exact dvd_sub (dvd_mul_of_dvd_left (by exact_mod_cast Nat.gcd_dvd_left a b) _)
(dvd_mul_of_dvd_right (by exact_mod_cast Nat.gcd_dvd_right a b) _)
/-- A farthest point `P` of `S` forms good pairs with at most two points
of `S`. -/
private lemma card_partners_le_two {S : Finset (ℕ × ℕ)} {P : ℕ × ℕ}
(hmax : ∀ Q ∈ S, Q.1 ^ 2 + Q.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2) :
((S.erase P).filter fun Q => |det P Q| = 1).card ≤ 2 := by
by_cases hP : Nat.Coprime P.1 P.2
· have hmaps : Set.MapsTo (det P) ((S.erase P).filter fun Q => |det P Q| = 1)
({1, -1} : Finset ℤ) := by
intro Q hQ
rw [Finset.mem_coe, Finset.mem_filter] at hQ
rcases eq_or_eq_neg_of_abs_eq hQ.2 with h | h
· rw [Finset.mem_coe, h]; exact Finset.mem_insert_self 1 {-1}
· rw [Finset.mem_coe, h]
exact Finset.mem_insert_of_mem (Finset.mem_singleton_self (-1))
have hinj : Set.InjOn (det P) ((S.erase P).filter fun Q => |det P Q| = 1) := by
intro Q₁ hQ₁ Q₂ hQ₂ hd
rw [Finset.mem_coe, Finset.mem_filter, Finset.mem_erase] at hQ₁ hQ₂
exact eq_of_det_eq_of_le hP hd hQ₁.2 (hmax Q₁ hQ₁.1.2) (hmax Q₂ hQ₂.1.2)
have h2card : (({1, -1} : Finset ℤ)).card = 2 :=
Finset.card_pair_eq_two_iff.mpr (by norm_num)
exact (Finset.card_le_card_of_injOn (det P) hmaps hinj).trans_eq h2card
· suffices h : ((S.erase P).filter fun Q => |det P Q| = 1) = ∅ by
rw [h, Finset.card_empty]; exact Nat.zero_le 2
rw [Finset.filter_eq_empty_iff]
intro Q hQ habs
obtain ⟨a, b⟩ := P
have hdvd := gcd_dvd_det (a, b) Q
have hdvd1 : ((Nat.gcd (a, b).1 (a, b).2 : ℕ) : ℤ) ∣ 1 := by
rcases eq_or_eq_neg_of_abs_eq habs with h | h
· rwa [h] at hdvd
· rw [h] at hdvd; exact dvd_neg.mp hdvd
have h1 : ((Nat.gcd (a, b).1 (a, b).2 : ℕ) : ℤ) = 1 := by
rcases Int.isUnit_iff.mp (isUnit_of_dvd_one hdvd1) with h | h
· exact h
· have hnonneg : (0 : ℤ) ≤ ((Nat.gcd (a, b).1 (a, b).2 : ℕ) : ℤ) :=
Int.natCast_nonneg _
linarith
exact hP (by exact_mod_cast h1)
/-- A set of `n ≥ 2` points determines at most `2 * n - 3` good pairs. -/
private lemma card_goodSets_le : ∀ n : ℕ, 2 ≤ n → ∀ S : Finset (ℕ × ℕ),
S.card = n → (goodSets S).card ≤ 2 * n - 3 := by
intro n
induction n using Nat.strong_induction_on with
| _ n IH =>
intro hn S hcard
rcases Nat.lt_or_ge n 3 with hlt | hge
· have hn2 : n = 2 := by lia
subst hn2
calc (goodSets S).card ≤ (S.powersetCard 2).card := Finset.card_filter_le _ _
_ = 1 := by rw [Finset.card_powersetCard, hcard]; decide
· have hne : S.Nonempty := Finset.card_pos.mp (by rw [hcard]; lia)
obtain ⟨P, hPS, hmax⟩ :=
Finset.exists_max_image S (fun Q : ℕ × ℕ => Q.1 ^ 2 + Q.2 ^ 2) hne
have hcard' : (S.erase P).card = n - 1 := by
rw [Finset.card_erase_of_mem hPS, hcard]
have hIH : (goodSets (S.erase P)).card ≤ 2 * (n - 1) - 3 :=
IH (n - 1) (by lia) (by lia) (S.erase P) hcard'
have hpart : ((S.erase P).filter fun Q => |det P Q| = 1).card ≤ 2 :=
card_partners_le_two hmax
have hcover : goodSets S ⊆ goodSets (S.erase P) ∪
((S.erase P).filter fun Q => |det P Q| = 1).image (fun Q => {P, Q}) := by
intro s hs
rw [goodSets, Finset.mem_filter, Finset.mem_powersetCard] at hs
obtain ⟨⟨hsS, hscard⟩, hsgood⟩ := hs
by_cases hPs : P ∈ s
· obtain ⟨Q, hQe⟩ := Finset.card_eq_one.mp (by
rw [Finset.card_erase_of_mem hPs, hscard])
have hQse : Q ∈ s.erase P := by rw [hQe]; exact Finset.mem_singleton_self Q
have hQs : Q ∈ s := Finset.mem_of_mem_erase hQse
have hQP : P ≠ Q := fun h => (Finset.mem_erase.mp (h ▸ hQse)).1 rfl
have hs_eq : s = {P, Q} := by rw [← Finset.insert_erase hPs, hQe]
have hQS : Q ∈ S.erase P := Finset.erase_subset_erase P hsS hQse
have hQgood : |det P Q| = 1 := hsgood P hPs Q hQs hQP
exact Finset.mem_union_right _ (Finset.mem_image.mpr
⟨Q, Finset.mem_filter.mpr ⟨hQS, hQgood⟩, hs_eq.symm⟩)
· exact Finset.mem_union_left _ (Finset.mem_filter.mpr
⟨Finset.mem_powersetCard.mpr
⟨Finset.subset_erase.mpr ⟨hsS, hPs⟩, hscard⟩, hsgood⟩)
have h1 : (goodSets S).card ≤ (goodSets (S.erase P) ∪
((S.erase P).filter fun Q => |det P Q| = 1).image
(fun Q => ({P, Q} : Finset (ℕ × ℕ)))).card :=
Finset.card_le_card hcover
have h2 : (goodSets (S.erase P) ∪
((S.erase P).filter fun Q => |det P Q| = 1).image
(fun Q => ({P, Q} : Finset (ℕ × ℕ)))).card ≤
(goodSets (S.erase P)).card +
(((S.erase P).filter fun Q => |det P Q| = 1).image
(fun Q => ({P, Q} : Finset (ℕ × ℕ)))).card :=
Finset.card_union_le _ _
have h3 : (goodSets (S.erase P)).card +
(((S.erase P).filter fun Q => |det P Q| = 1).image
(fun Q => ({P, Q} : Finset (ℕ × ℕ)))).card ≤
(2 * (n - 1) - 3) + 2 :=
add_le_add hIH (le_trans Finset.card_image_le hpart)
have h4 : (2 * (n - 1) - 3) + 2 = 2 * n - 3 := by lia
exact h1.trans ((h2.trans h3).trans_eq h4)
set_option maxRecDepth 4096 in
/-- For an injective choice `v` of points, the good index pairs and the good
two-element subsets of the image are equinumerous. -/
private lemma card_goodPairs_eq {v : Fin 100 → ℕ × ℕ} (hv : Function.Injective v) :
(goodPairs v).card = (goodSets (Finset.univ.image v)).card := by
apply Finset.card_bij (fun p _ => ({v p.1, v p.2} : Finset (ℕ × ℕ)))
· intro p hp
simp only [goodPairs, Finset.mem_filter, Finset.mem_univ, true_and] at hp
obtain ⟨hlt, hgood⟩ := hp
have hne : v p.1 ≠ v p.2 := fun h => hlt.ne (hv h)
rw [goodSets, Finset.mem_filter, Finset.mem_powersetCard]
refine ⟨⟨?_, Finset.card_pair_eq_two_iff.mpr hne⟩, ?_⟩
· intro x hx
rw [Finset.mem_insert, Finset.mem_singleton] at hx
rcases hx with rfl | rfl <;> exact Finset.mem_image_of_mem v (Finset.mem_univ _)
· intro P hP Q hQ hPQ
rw [Finset.mem_insert, Finset.mem_singleton] at hP hQ
rcases hP with rfl | rfl
· rcases hQ with rfl | rfl
· exact absurd rfl hPQ
· exact hgood
· rcases hQ with rfl | rfl
· rw [det_swap, abs_neg]; exact hgood
· exact absurd rfl hPQ
· intro p hp q hq h
simp only [goodPairs, Finset.mem_filter, Finset.mem_univ, true_and] at hp hq
have h1 : v p.1 ∈ ({v q.1, v q.2} : Finset (ℕ × ℕ)) := by
rw [← h]; exact Finset.mem_insert_self _ _
have h2 : v p.2 ∈ ({v q.1, v q.2} : Finset (ℕ × ℕ)) := by
rw [← h]; exact Finset.mem_insert_of_mem (Finset.mem_singleton_self _)
rw [Finset.mem_insert, Finset.mem_singleton] at h1 h2
rcases h1 with h1 | h1
· rcases h2 with h2 | h2
· exact absurd ((hv (h2.trans h1.symm)).symm) hp.1.ne
· exact Prod.ext_iff.mpr ⟨hv h1, hv h2⟩
· rcases h2 with h2 | h2
· have e1 : p.1 = q.2 := hv h1
have e2 : p.2 = q.1 := hv h2
exfalso; lia
· exact absurd (hv (h1.trans h2.symm)) hp.1.ne
· intro s hs
rw [goodSets, Finset.mem_filter, Finset.mem_powersetCard] at hs
obtain ⟨⟨hsS, hscard⟩, hsgood⟩ := hs
obtain ⟨P, Q, hPQ, hsPQ⟩ := Finset.card_eq_two.mp hscard
subst hsPQ
have hPS : P ∈ Finset.univ.image v := hsS (Finset.mem_insert_self P {Q})
have hQS : Q ∈ Finset.univ.image v :=
hsS (Finset.mem_insert_of_mem (Finset.mem_singleton_self Q))
rw [Finset.mem_image] at hPS hQS
obtain ⟨i, -, hi⟩ := hPS
obtain ⟨j, -, hj⟩ := hQS
have hgood : |det P Q| = 1 := hsgood P (Finset.mem_insert_self P {Q}) Q
(Finset.mem_insert_of_mem (Finset.mem_singleton_self Q)) hPQ
have hij : i ≠ j := fun h => hPQ (hi.symm.trans (h ▸ hj))
rcases lt_or_gt_of_ne hij with hlt | hgt
· refine ⟨(i, j), ?_, ?_⟩
· simp only [goodPairs, Finset.mem_filter, Finset.mem_univ, true_and]
refine ⟨hlt, ?_⟩
show |det (v i) (v j)| = 1
rw [hi, hj]; exact hgood
· show ({v i, v j} : Finset (ℕ × ℕ)) = {P, Q}
rw [hi, hj]
· refine ⟨(j, i), ?_, ?_⟩
· simp only [goodPairs, Finset.mem_filter, Finset.mem_univ, true_and]
refine ⟨hgt, ?_⟩
show |det (v j) (v i)| = 1
rw [hj, hi, det_swap, abs_neg]; exact hgood
· show ({v j, v i} : Finset (ℕ × ℕ)) = {P, Q}
rw [hj, hi, Finset.pair_comm]
/-- USA Mathematical Olympiad 2020, Problem 4 -/
theorem usa2020_p4 :
IsGreatest {N : ℕ | ∃ v : Fin 100 → ℕ × ℕ, Function.Injective v ∧
N = (Finset.univ.filter fun p : Fin 100 × Fin 100 =>
p.1 < p.2 ∧ |det (v p.1) (v p.2)| = 1).card} answer := by
constructor
· refine ⟨fun i => if i = 0 then (1, 0) else (i.val, 1), by decide, by decide +kernel⟩
· intro N hN
obtain ⟨v, hv, hN'⟩ := hN
rw [hN']
change (goodPairs v).card ≤ answer
rw [card_goodPairs_eq hv]
have h100 : (Finset.univ.image v).card = 100 := by
rw [Finset.card_image_of_injective _ hv, Finset.card_univ, Fintype.card_fin]
exact (card_goodSets_le 100 (by norm_num) _ h100).trans_eq (by norm_num [answer])
end Usa2020P4
人的思考A human's take
2020 USAMO Problems/Problem 4 - AoPS Wiki — Lopkiloinm、SigmaPiE(AoPS Wiki 贡献者)
AoPS Wiki 的题目页,附有两篇社区解答。第一篇(Lopkiloinm)从最小情形入手:三个点可以两两满足行列式 $\pm1$(相当于「三角形」),第四个点却加不进来;由此归纳出 $n$ 个点的规律,得到 $2n-3$。第二篇(SigmaPiE)用鞋带公式把条件重读成几何语言:$|a_i b_j - a_j b_i| = 1$ 意味着原点与两点构成的三角形面积为 $\tfrac12$,先构造出达到 197 的「两条格线」配置,再逐情形论证把点挪出这两条线只会净损失配对。Wiki 里的公式是图片,抓取时正文丢失,但两篇证明的骨架都能读出来:一篇是归纳加极端元,一篇是面积加格线计数——与本页折叠的讲解思路一致。The AoPS Wiki page for the problem, hosting two community solutions. The first (Lopkiloinm) starts from the smallest cases: three points can have all pairwise determinants equal to $\pm1$, but no fourth point can join them; the pattern for $n$ points then yields $2n-3$. The second (SigmaPiE) re-reads the condition geometrically via the shoelace formula: $|a_i b_j - a_j b_i| = 1$ means the triangle formed with the origin has area $\tfrac12$. It builds the two-lattice-line construction reaching 197, then argues case by case that moving points off those lines only loses pairs. The wiki renders formulas as images that drop out in text extraction, but both proof skeletons are legible: one induction plus an extremal argument, the other area and lattice-line counting—matching the walkthrough folded below.
AI 随想An AI's reflection
以下由 AI 撰写。Written by AI.
这道题最迷人的地方,在于它把一个看似组合计数的问题,转化为一个几何直觉问题。条件 $|a_i b_j - a_j b_i| = 1$ 看起来只是一个代数式子,但它的几何意义是:由原点和这两个点张成的平行四边形面积恰好为 1。这意味着这两个点构成的向量是「互质」的——它们之间没有更粗的格点。The most captivating aspect of this problem is how it transforms what appears to be a combinatorial counting problem into a question of geometric intuition. The condition $|a_i b_j - a_j b_i| = 1$ looks like a mere algebraic expression, but its geometric meaning is precise: the parallelogram spanned by the origin and these two points has area exactly 1. This means the two vectors are 'coprime'—no coarser lattice point lies between them.
证明的上界部分用了一个经典的极值论证:取最远的点。这个策略在组合数学中非常常见——当你需要证明某个量有上界时,找一个极端元素,看看它最多能贡献什么。在这里,最远点 $P$ 的几何性质非常强:所有其他点都在以原点为圆心、$|P|$ 为半径的圆盘内。而满足行列式条件的那些点,恰好落在两条相距固定的平行线上。圆盘与直线的交点最多两个,但其中一个必须是原点(被排除),所以每条线最多一个。这个几何约束把代数问题变成了简单的计数问题。The upper bound proof uses a classic extremal argument: take the farthest point. This strategy is ubiquitous in combinatorics—when proving an upper bound, find an extreme element and determine its maximum possible contribution. Here, the farthest point $P$ has strong geometric properties: all other points lie within a disk centered at the origin with radius $|P|$. The points satisfying the determinant condition lie exactly on two parallel lines at fixed distance. A disk intersects a line in at most two points, but one must be the origin (excluded), so each line contributes at most one valid point. This geometric constraint reduces an algebraic problem to simple counting.
构造部分同样优雅:选一条直线上的 99 个点,再加一个不在该直线上的点。这样每条直线上的相邻点对贡献 98 对,那个额外的点与所有 99 个点各贡献 1 对,总共 197 对。这个构造之所以有效,是因为它同时利用了两种不同的「互质关系」——共线点之间的相邻关系,和非共线点与原点之间的面积关系。The construction is equally elegant: pick 99 collinear points on one line, plus one point not on that line. Adjacent pairs on the line contribute 98, and the extra point pairs with all 99 line points for 99 more, totaling 197. This works because it simultaneously exploits two different kinds of 'coprimality'—adjacency along a line, and area-1 relationships with the origin.
这道题提醒我们:好的竞赛题往往有一个「几何灵魂」藏在代数外壳下面。找到那个灵魂,证明就自然浮现了。This problem reminds us that good competition problems often hide a geometric soul beneath an algebraic shell. Find that soul, and the proof emerges naturally.
✓ 已通过 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.35.0-rc3 · Mathlib 3f6737d
- Shortlex 不是一种排序,而是一种构造排序的方法Shortlex Isn't a Single Order—It's a Method for Constructing Orders
- 问题是什么:我们通常说「shortlex 排序」——先按长度排,再按字典序排。但这听起来像是一种固定不变的排序方法,好像短 lex 排序只有一个定义。The question: We usually talk about 'shortlex order'—sort by length first, then lexicographically. But this sounds like one fixed sorting method, as if there's only one definition of shortlex.
- 关键想法:Mark Dominus 指出,「短 lex 排序」实际上是一种构造方法,而不是一种单一的排序。它从一个已有的排序出发,生成一个新的、更复杂的排序。The key idea: Mark Dominus points out that 'shortlex order' is actually a construction method, not a single fixed order. It takes an existing order and generates a new, more complex one from it.
- 为什么成立:要按字典序比较两个字符串,你需要先知道字符本身的排序。短 lex 排序的「字典序」部分不是凭空产生的——它依赖于你预先选定的基础排序。如果你把基础排序换掉,比如把数字按「奇数在前、偶数在后」排序,那么 shortlex 扩展出来的字符串排序也会完全不同。Why it holds: To lexicographically compare two strings, you need to already know the order of the individual characters. The 'lexicographic' part of shortlex doesn't appear from nowhere—it depends on a base order you chose beforehand. If you change the base order, say sorting numbers as 'odds first, evens second,' the resulting shortlex extension for strings will be completely different.
- 能带走什么:很多数学概念听起来像单一的固定定义,但实际上它们是构造规则。理解这一点,你就能把一个方法应用到完全不同的场景里。What to take away: Many math concepts sound like single fixed definitions, but are actually construction rules. Understanding this lets you apply one method to completely different scenarios.
- Fibonacci 系统生成象鼻虫名字、披萨配料和族谱How a Fibonacci L-System Generates Weevil Names, Pizza Toppings, and Family Trees
- 问题是什么:Fibonacci 数列的递推关系 a → ab, b → a 是一个简单的字符串替换系统。除了算出兔子数量,还能用它做什么?The question: The Fibonacci recurrence a → ab, b → a is a simple string replacement system. Beyond counting rabbits, what else can you do with it?
- 关键想法:同一个替换规则可以生成任意符号序列——只要你把 'a' 和 'b' 替换成你喜欢的任何词。比如把 a 映射为 'pep'、b 映射为 'roni',就得到了 pepperoni 的生成过程。The key idea: The same replacement rule can generate any sequence of symbols—as long as you map 'a' and 'b' to whatever words you like. Map a to 'pep' and b to 'roni' and you get the generation process for 'pepperoni'.
- 为什么成立:L-System 的本质是一个递归替换规则,它不关心你用什么符号。Fibonacci 数列只是这个系统在特定符号映射下的一个特例。任何满足 Fibonacci 递推关系的字符串序列,都可以用同一个系统生成。Why it holds: An L-System is fundamentally a recursive replacement rule that doesn't care what symbols you use. The Fibonacci sequence is just one special case under a particular symbol mapping. Any string sequence satisfying the Fibonacci recurrence can be generated by the same system.
- 能带走什么:一个数学结构可以以意想不到的方式出现在不同的上下文里。识别这种结构,就是把数学从计算工具变成发现工具。What to take away: A single mathematical structure can appear in unexpected contexts. Recognizing that structure is what turns math from a calculation tool into a discovery tool.
- 矩阵乘法不丑:反驳《纽约客》的一个误解Matrix Multiplication Isn't Ugly: Refuting a Misunderstanding in The New Yorker
- 问题是什么:《纽约客》一篇关于 AI 的文章引用数学家 Hardy 的名言「美是首要检验标准」,然后说矩阵乘法「缺乏美和对称性」,理由是「a × b ≠ b × a」。这个推理听起来奇怪——就像说加法不美,因为 17+34=51 但 71+43≠15。The question: An article about AI in The New Yorker quotes mathematician Hardy's 'beauty is the first test' and then says matrix multiplication 'lacks beauty and symmetry' because 'a×b ≠ b×a'. This reasoning sounds strange—like saying addition isn't beautiful because 17+34=51 but 71+43≠15.
- 关键想法:Propp 指出,矩阵的本质不是「数字阵列」,而是「变换」。矩阵乘法的非交换性(AB≠BA)不是缺陷,而是几何直觉:先左右翻转再对角翻转,和先对角翻转再左右翻转,结果完全不同——一个顺时针转 90 度,一个逆时针转 90 度。The key idea: Propp points out that the essence of a matrix isn't 'an array of numbers' but 'a transformation.' The non-commutativity of matrix multiplication (AB≠BA) isn't a defect—it's geometric intuition: flipping left-right then diagonal, versus diagonal then left-right, gives completely different results—one rotates 90° clockwise, the other 90° counterclockwise.
- 为什么成立:矩阵乘法本质上就是变换的复合。顺序不同,结果不同,这不奇怪——就像先加奶酪再倒沙拉酱,和先倒沙拉酱再加奶酪,味道完全不同。19 世纪的代数学家借用「乘法」这个词,是为了说「矩阵像数字一样可以组合」,但加了一个附加条件「不完全像」。非交换性恰恰是线性代数和群论研究对称性的核心工具。Why it holds: Matrix multiplication is essentially the composition of transformations. Different order, different result—that's not surprising, just like putting cheese before dressing versus dressing before cheese gives different tastes. 19th-century algebraists borrowed the word 'multiplication' to say 'matrices can be composed like numbers,' with the proviso 'but not exactly.' Non-commutativity is precisely the core tool that linear algebra and group theory use to study symmetry.
- 能带走什么:当有人用你不完全理解的概念来贬低一个领域时,先问自己:我是否遗漏了更深层的视角?矩阵乘法的「丑」,只是因为还没有理解它的「美」所在。What to take away: When someone uses a concept you don't fully understand to disparage a field, ask first: have I missed a deeper perspective? Matrix multiplication's 'ugliness' exists only because its 'beauty' hasn't been understood yet.
- 当 .999… 不等于 1:q-变形数的奇妙世界When .999… Isn't 1: The Wonderful World of q-Deformed Numbers
- 问题是什么:在普通数学中,.999… = 1 是一个被严格证明的事实。但如果我们把数字「变形」——引入一个参数 q,让数字变成关于 q 的函数——那么 .999… 还等于 1 吗?The question: In ordinary math, .999… = 1 is a rigorously proven fact. But if we 'deform' numbers—introducing a parameter q that turns numbers into functions of q—does .999… still equal 1?
- 关键想法:数学家 Morier-Genoud 和 Ovsienko 开发了一套「q-变形」有理数的规则。给定三条简单规则:[0]q=0,[r+1]q = q[r]q+1,[r]q·[-1/r]q = -1/q,你可以计算出任何有理数的 q-变形。关键在于,当你让分子分母同时增大时,q-变形后的结果会分裂成两个不同的极限——取决于你从上方逼近还是从下方逼近。The key idea: Mathematicians Morier-Genoud and Ovsienko developed a set of rules for 'q-deformed' rational numbers. Given three simple rules—[0]q=0, [r+1]q = q[r]q+1, [r]q·[-1/r]q = -1/q—you can compute the q-deformation of any rational. The key insight: when you let numerator and denominator grow simultaneously, the q-deformed results split into two different limits—depending on whether you approach from above or below.
- 为什么成立:以 1/2, 2/3, 3/4, … 为例,它们的 q-变形分别是 q/(1+q), (q+q²)/(1+q+q²), (q+q²+q³)/(1+q+q²+q³), … 当 n→∞ 时,这些值趋近于 q 本身,而不是 1。但反过来,2/1, 3/2, 4/3, … 的 q-变形趋近于 [1]q=1。同样的普通极限(都等于 1),在 q-变形下却走向不同目的地——就像音乐中的升调和降调。Why it holds: Take 1/2, 2/3, 3/4, … Their q-deformations are q/(1+q), (q+q²)/(1+q+q²), (q+q²+q³)/(1+q+q²+q³), … As n→∞, these approach q itself, not 1. But conversely, 2/1, 3/2, 4/3, … q-deformations approach [1]q=1. The same ordinary limit (all equal 1) leads to different destinations under q-deformation—like sharps and flats in music.
- 能带走什么:数学中的「真理」往往依赖于你选择的游戏规则。q-变形不是要推翻 .999…=1,而是展示了一个更广阔的数学景观:同一个概念在不同框架下可以有不同的「面貌」。理解这种灵活性,是数学思维的核心。What to take away: 'Truths' in math often depend on the rules of the game you choose. q-deformation doesn't overturn .999…=1—it reveals a broader mathematical landscape where the same concept can have different 'faces' under different frameworks. Understanding this flexibility is core to mathematical thinking.
程序员随想Programmer Reflections
- 把 Serde 的两个半部分交换,就得到了 DeserSwap the Two Halves of Serde and You Get Deser
- 问题是什么:Rust 的 Serde 序列化库非常好用,但有几个设计上的怪癖——比如任意精度数字无法在内部 tagged enum 里正确工作,flatten 会破坏整数 key,自定义反序列化适配器无法组合到 Option 里。The question: Rust's Serde serialization library is great, but it has several design quirks—arbitrary precision numbers don't work correctly in internally tagged enums, flatten breaks integer keys, and custom deserialization adapters can't compose into Option.
- 关键想法:Armin Ronacher 意识到这些不是 bug,而是 Serde 设计的必然结果。Serde 的核心架构是「类型驱动」:类型告诉反序列化器它期望什么,反序列化器回调进类型。这种递归设计导致栈空间随嵌套深度增长,也导致缓冲时丢失信息。Deser 把整个架构反过来:格式告诉类型下一个值是什么,把事件推入 sink,所有嵌套状态放堆上。The key idea: Armin Ronacher realized these aren't bugs but inevitable consequences of Serde's design. Serde's core architecture is 'type-driven': the type tells the deserializer what it expects, and the deserializer calls back into the type. This recursive design causes stack growth with nesting depth and information loss during buffering. Deser flips the entire architecture: the format tells the type what the next value is, pushing events into a sink, with all nested state on the heap.
- 为什么成立:把控制流反转之后,几个问题自然消失——不再需要递归所以没有栈溢出,格式驱动意味着可以流式处理不信任的输入,sink 模式让扩展点变成了表达式而非字符串。代价是不能支持像 protobuf 这种非自描述格式,但这在 Armin 看来是可以接受的 tradeoff。Why it holds: Flipping the control flow makes several problems disappear naturally—no recursion means no stack overflow, format-driven design enables streaming untrusted input, and the sink pattern turns extension points from strings into expressions. The tradeoff: it can't support non-self-describing formats like protobuf, but Armin considers that acceptable.
- 能带走什么:当你遇到一个系统的深层设计问题时,问自己:如果把控制流反过来,问题会不会消失?有时候解决方案不在于修补,而在于翻转视角。What to take away: When you encounter a deep design problem in a system, ask: what happens if I flip the control flow? Sometimes the solution isn't to patch, but to reverse the perspective.
- 幻灯片应该是演讲者的互补视觉通道,不是独立文档Slides Should Be a Complementary Visual Channel, Not a Standalone Document
- 问题是什么:大多数企业演示文稿都是「信息堆砌」——幻灯片本身就能独立阅读,观众还没开始听就速度读完了整页内容。The question: Most corporate presentations are 'information dumps'—slides that can be read independently, so the audience speed-reads the entire page before the speaker finishes the first sentence.
- 关键想法:有效的幻灯片应该是演讲者的「互补视觉通道」。演讲者提供主要信息,幻灯片提供视觉支持和少量强化文字。观众通过双重编码(同时处理语言和视觉信息)来学习,而不是通过阅读幻灯片上的文字。The key idea: Effective slides should be a 'complementary visual channel' for the speaker. The speaker provides the main information; the slides provide visual support and minimal reinforcing text. The audience learns through dual encoding—processing language and visual information through different brain pathways.
- 为什么成立:人脑处理语言和视觉信息的路径不同。当演讲者说一段话而幻灯片显示一张图时,观众的大脑同时使用两条通道,信息更容易被记住。相反,如果幻灯片上写满了文字,观众会速度阅读,演讲者就失去了对叙事节奏的控制。Why it holds: When a speaker says something while the slide shows an image, the audience's brain uses both channels simultaneously, making information more memorable. But if slides are full of text, the audience reads ahead and the speaker loses control of the narrative pace.
- 能带走什么:下次做演示时,问自己:这张幻灯片没有我还能成立吗?如果答案是「能」,那就删掉或简化它。好的幻灯片离开演讲者就是一片空白,这恰恰是它的优点。What to take away: Next time you make a presentation, ask: would this slide still make sense without me? If the answer is yes, delete it or simplify it. Good slides are nearly blank without the speaker—and that's exactly their strength.
- 我们说过不支持 MCP,但现在我们改变了主意We Said No to MCP. Now We've Changed Our Mind.
- 问题是什么:Earendil 过去公开表示不支持 MCP(Model Context Protocol),认为它的组合能力太差。但当他们真正尝试在 Pi 中集成 MCP 时,发现改变后的 MCP 加上 Codemode 解决了过去的大部分问题。The question: Earendil publicly stated they wouldn't support MCP (Model Context Protocol), citing poor composability. But when they actually tried integrating MCP into Pi, they found that the improved MCP plus Codemode solved most of the problems they'd identified.
- 关键想法:真诚的立场转变比固守旧观点更有价值。他们不是简单地 '转向',而是因为 MCP 本身在改进,同时他们发现自己需要的东西(JavaScript sandbox + 工具发现)和 MCP 的改进方向恰好一致。The key idea: Sincere position changes are more valuable than stubborn consistency. They didn't just 'flip'—MCP itself improved, and they discovered their needs (JavaScript sandbox + tool discovery) aligned exactly with where MCP was heading.
- 为什么成立:技术决策不应该建立在过去的声明上。当环境变化、信息更新、工具改进时,重新评估自己的立场是理性行为,而不是矛盾。真正的问题是:你有没有诚实面对证据,而不是你有没有始终如一。Why it holds: Technical decisions shouldn't be anchored to past statements. When the environment changes, information updates, and tools improve, re-evaluating your position is rational behavior, not contradiction. The real question is whether you're honestly facing evidence, not whether you're consistently wrong.
- 能带走什么:承认自己错了并改变立场,是一种智力诚实。在 AI 工具快速演进的今天,固执地坚持一年前的判断,比灵活调整更需要勇气。What to take away: Admitting you were wrong and changing your mind is intellectual honesty. In today's rapidly evolving AI tool landscape, stubbornly clinging to a judgment from a year ago takes more courage than flexibly adjusting.
- 以 GB/s 速度将 UTF-8 转换为 UTF-16 并替换无效序列Transcoding UTF-8 to UTF-16 with Replacement at Gigabytes per Second
- 问题是什么:UTF-8 和 UTF-16 是两种常用的字符串编码格式。当需要把 UTF-8 文本转换为 UTF-16 时,如果输入中有无效的 UTF-8 序列,传统的做法是直接报错或跳过。但 simdutf 库之前缺少一个关键功能:无法在转换过程中替换无效序列。The question: UTF-8 and UTF-16 are two commonly used string encoding formats. When converting UTF-8 text to UTF-16, if the input contains invalid UTF-8 sequences, the traditional approach is to error out or skip them. But the simdutf library was missing a key feature: it couldn't replace invalid sequences during transcoding.
- 关键想法:新的方案分两步走——先用 utf16_length_from_utf8_with_replacement 扫描并验证输入,记录所有错误的位置;再用 convert_utf8_to_utf16_with_replacement 进行转换,将每个无效序列替换为 Unicode 替换字符 U+FFFD。因为先有了错误位置列表,转换时可以跳过无效字节,速度反而更快。The key idea: The new solution works in two steps—first use utf16_length_from_utf8_with_replacement to scan and validate the input, recording all error positions; then use convert_utf8_to_utf16_with_replacement to transcode, replacing each invalid sequence with the Unicode replacement character U+FFFD. Because we have the error position list first, the transcoding can skip invalid bytes and actually run faster.
- 为什么成立:测试结果显示,在 Japanese Wikipedia 的 531KB 文本上,无错误时 simdutf 达到 7.0 GB/s,而标量循环只有 1.7 GB/s。有错误时,先验证再转换的方法甚至比之前直接转换的方法更快,因为初始验证 pass 让后续的转换可以更高效地执行。Why it holds: Benchmark results show that on 531KB of Japanese Wikipedia text with no errors, simdutf reaches 7.0 GB/s while the scalar loop only achieves 1.7 GB/s. With errors, the validate-then-transcode approach is even marginally faster than the previous direct method, because the initial validation pass enables more efficient transcoding afterward.
- 能带走什么:在处理不可信的文本输入时,先验证再处理往往比边处理边验证更高效。这个两遍扫描模式在高性能字符串处理中非常常见——先收集元信息,再批量处理,可以充分利用 CPU 流水线。What to take away: When processing untrusted text input, validating first and then processing is often more efficient than doing both simultaneously. This two-pass scan pattern is very common in high-performance string processing—first collect metadata, then batch process, which fully utilizes the CPU pipeline.
- 「合理默认」优于「最佳实践」:一个更灵活的工程术语'Sensible Default' Over 'Best Practice': A More Flexible Engineering Term
- 问题是什么:软件工程中充满了「最佳实践」这个词——版本控制、持续集成、分离关注点。但每次有人说「最佳实践」,总有人反驳说「我们情况特殊」。这个词太绝对了,让人难以接受例外。The question: Software engineering is full of 'best practices'—version control, CI/CD, separation of concerns. But every time someone says 'best practice,' someone else pushes back with 'our situation is special.' The term is too absolute, making it hard to accept exceptions.
- 关键想法:Martin Fowler 提倡用「合理默认」替代「最佳实践」。合理默认是:在没有特殊约束的情况下,你应该这样做;但如果有更好的理由,你可以 override,并且需要能解释为什么。这个词承认了惯例的价值,同时也为情境判断留了空间。The key idea: Martin Fowler advocates replacing 'best practice' with 'sensible default.' A sensible default means: in the absence of special constraints, you should do this; but if there's a better reason, you can override, and you need to be able to explain why. The term acknowledges the value of convention while leaving room for contextual judgment.
- 为什么成立:Thoughtworks 的内部术语就是如此——他们有一份「合理默认清单」,但每个团队都知道这些默认不是教条。当一个团队选择违背某个默认时,他们必须能说出理由;如果说不出来,就应该回到默认。这是一种轻量级的治理机制,不需要流程审批,只需要诚实的反思。Why it holds: Thoughtworks' internal practice is exactly this—they have a 'sensible defaults list,' but every team knows these defaults aren't dogma. When a team chooses to deviate from a default, they must articulate why; if they can't, they should return to the default. This is a lightweight governance mechanism that requires no process approval, only honest reflection.
- 能带走什么:下次有人用「最佳实践」来压你时,问他:在什么情况下这个「最佳」不再最佳?把绝对的语言换成有条件的语言,会让工程讨论更诚实、更有建设性。What to take away: Next time someone uses 'best practice' to pressure you, ask: under what circumstances is this 'best' no longer best? Replacing absolute language with conditional language makes engineering discussions more honest and more productive.
哲学与生活Philosophy & Life
- 不要用那个 C 字来称呼它Don't Use the C-Word to Describe It
- 问题是什么:每年超过 200 万美国人被诊断出「癌症」,但对许多人来说,这个发现对寿命或生活质量几乎没有影响——影响主要来自治疗本身。然而,「癌症」这个词仍然像 19 世纪一样令人恐惧。The question: Over 2 million Americans receive a 'cancer' diagnosis each year, but for many, the finding poses little to no threat to lifespan or quality of life—the harm comes primarily from the treatment itself. Yet the word 'cancer' remains as terrifying as it was in the 19th century.
- 关键想法:Cooperberg 指出,现代筛查技术让我们能在症状出现前数年发现异常细胞,但我们的语言还停留在发现肿块和溃烂的年代。我们把所有异常细胞增生都叫作「癌症」,但其实其中很多永远不会威胁生命。语言没有跟上科学理解。The key idea: Cooperberg points out that modern screening lets us detect abnormal cells years before symptoms appear, but our language is still stuck in the era of finding visible lumps and ulcers. We call all abnormal cell growths 'cancer,' but many would never threaten life. Our language hasn't kept pace with our scientific understanding.
- 为什么成立:「癌症」这个词承载了千年来的集体恐惧——痛苦、死亡、背叛。当一个患者听到这个词时,他的生理反应(皮质醇飙升、焦虑爆发)与肿瘤的实际威胁程度完全不匹配。这种不匹配导致了过度治疗、心理创伤和经济负担。Why it holds: The word 'cancer' carries a thousand years of collective fear—pain, death, betrayal. When a patient hears that word, their physiological response (cortisol spike, anxiety surge) is completely disproportionate to the tumor's actual threat. This mismatch leads to overtreatment, psychological trauma, and financial burden.
- 能带走什么:语言塑造了我们对现实的反应。当我们用一千年前描述可见肿块的词汇来描述显微镜下的细胞时,我们在对病人施加不必要的恐惧。重新思考我们的语言,本身就是一种医疗行为。What to take away: Language shapes our response to reality. When we use words coined to describe visible lumps to talk about microscopic cells, we impose unnecessary fear on patients. Rethinking our language is itself a medical intervention.
- 不要吝啬自己:对抗「等待开始生活」的解药Do Not Spare Yourself: An Antidote to Feeling Like You're Waiting to Start Living
- 问题是什么:很多人感到自己一直在「等待」——等合适的时机、等安全感、等一切条件成熟,然后才开始真正生活。但这种等待本身就是一种自我保存的本能。The question: Many people feel like they're always 'waiting'—for the right moment, for security, for all conditions to be perfect—before they start truly living. But this waiting itself is a survival instinct.
- 关键想法:Mario Benedetti 的诗《不要吝啬自己》直击这种心态:不要站在路边不动,不要冻结你的喜悦,不要只向世界索取一个安静的角落。如果你确实因为恐惧而选择了安全,那至少不要留下来——因为你已经不再真正地活着了。The key idea: Mario Benedetti's poem 'No Te Salves' (Do Not Spare Yourself) targets this mindset directly: don't stand motionless by the road, don't petrify your joy, don't claim from the world only a quiet corner. If you do choose safety out of fear, at least don't stay—because you're no longer truly alive.
- 为什么成立:生命的不确定性、失望、心碎是活着的代价。试图通过规避风险来保护自己是徒劳的——你保护的不只是痛苦,还有喜悦、惊喜和深刻体验的可能性。Benedetti 的警告不是鼓励鲁莽,而是提醒我们:安全距离的生活不是生活。Why it holds: Life's uncertainty, disappointment, and heartbreak are the price of being alive. Trying to protect yourself by avoiding risk is futile—you're protecting not just pain, but also the possibility of joy, surprise, and deep experience. Benedetti's warning isn't encouragement for recklessness; it's a reminder that a life at a safe distance isn't a life.
- 能带走什么:不要等一切都完美才开始。不要为了安全而冻结生命。如果你发现自己正在「保存自己」,问问自己:你在保存的,究竟是生活本身,还是对生活的恐惧?What to take away: Don't wait for everything to be perfect before you begin. Don't freeze life to keep it safe. If you catch yourself 'preserving' yourself, ask: am I preserving life itself, or just my fear of it?
工具角Tools Corner
- stinkpot:基于 SQLite 的 Shell 历史记录stinkpot: SQLite-Backed Shell History
- 问题是什么:你的 shell 历史记录存储在文本文件中,只能按时间顺序回溯,无法搜索、无法跨会话关联、无法过滤。The problem: Your shell history is stored in a text file—replayable only chronologically, unsearchable, unfilterable, disconnected across sessions.
- 关键想法:把 shell 历史存入 SQLite,每条记录包含命令、时间戳、工作目录、退出码。你就可以用 SQL 查询任何维度的历史。The idea: Store shell history in SQLite. Each record captures command, timestamp, working directory, exit code. Suddenly you can query any dimension of your history with SQL.
- 能带走什么:一个简单的设计选择——从文本到结构化存储——释放了之前不可用的能力。58 个 star 说明这个小工具解决了真实的痛点。What to take away: A simple design choice—text to structured storage—unlocks capabilities that were always there but previously inaccessible. 58 stars means this small tool solves a real pain point.
- zopt:Zig 生态中无需 schema 的命令行解析器zopt: Schemaless CLI Parsing for Zig
- 问题是什么:大多数 CLI 解析库要求你在代码中预先声明所有参数和它们的类型。对于简单的工具来说,这带来了不必要的样板代码。The problem: Most CLI parsing libraries require you to pre-declare all parameters and their types in code. For simple tools, this generates unnecessary boilerplate.
- 关键想法:zopt 采用「读取时 schema」策略——它不预先解析 argv,而是在你查询某个 flag 时才去扫描。这让你可以用最少的代码定义最灵活的接口。The idea: zopt uses a 'schema on read' approach—it doesn't pre-parse argv, but scans only when you query a flag. This lets you define flexible interfaces with minimal code.
- 能带走什么:有时候,少即是多。一个不强制你预先声明一切的库,反而让简单工具的开发变得更快、更自然。What to take away: Sometimes less is more. A library that doesn't force you to declare everything upfront lets you develop simple tools faster and more naturally.
- nss-userhosts:无特权用户的 hosts 文件方案nss-userhosts: Hosts Files for Unprivileged Users
- 问题是什么:普通用户无法修改 /etc/hosts,但可能希望屏蔽某些域名或重定向到本地服务。The problem: Regular users can't modify /etc/hosts but may want to block certain domains or redirect to local services.
- 关键想法:通过 NSS(Name Service Switch)模块,让每个用户拥有自己的 hosts 文件,系统级查询时自动合并用户级配置。不需要 root 权限,不需要修改系统文件。The idea: Via an NSS (Name Service Switch) module, give each user their own hosts file. System-level queries automatically merge user-level config. No root needed, no system file modifications.
- 能带走什么:一个优雅的方案,通过系统接口而非 hack 来解决权限问题。用 Rust 实现,小巧高效。What to take away: An elegant solution that solves a permission problem through the system interface rather than hacks. Written in Rust, small and efficient.