存在的艺术:不喊口号的改变The Art of Presence: Change Without Slogans
发布于 2026-11-19Published 2026-11-19
今日深读Today's Deep Read
不喊口号的抵抗:德黑兰街头,每天出门就是一种主张Resistance Without Slogans: On Tehran's Streets, Showing Up Is the Argument
傍晚的德黑兰,Iranshahr 街。年轻女性坐在咖啡馆外的台阶上,头巾滑到肩膀,露出头发、手臂和腰;有人举着手机给朋友拍照,有人只是看来来往往的人。路人经过时会多看两眼——不是因为这里发生了什么,而是因为这里什么都没发生。没有口号,没有标语,没有人发表演讲。It is early evening on Iranshahr Street in Tehran. Young women sit on the steps outside cafés, headscarves slipped down to their shoulders, hair and arms and midriffs in plain view. One is taking a photo of a friend; others are just watching the crowd. Passers-by look twice — not because something is happening, but because, officially, nothing is supposed to.
这条街在伊朗是一个异数。1983 年起,戴头巾是法律义务,道德警察在街头执法;2022 年,22 岁的 Mahsa Amini 因「佩戴不当」被拘留后死亡,引发「女人、生命、自由」运动。按常理,今天街上的这些女性应该是在抗议。但记者 Parisa Khoshnami 问她们,得到的回答是:这只是打扮,「只是为了我自己」。This street is an anomaly in Iran. Since 1983 the headscarf has been a legal obligation, enforced by morality police. In 2022, 22-year-old Mahsa Amini died after being detained for “improper” dress, and “Woman, Life, Freedom” spread across the country. By any normal logic, the women on this pavement are protesting. But when the journalist Parisa Khoshnami asked them, they said it was just dressing up — “only for myself.”
Khoshnami 借用社会学家 Asef Bayat 的概念,把这种现象叫「非运动」(non-movement)——「非集体行动者的集体行动」。它没有领袖、没有纲领、没有组织,每个人只做了一个私人决定:今晚出门,穿我想穿的。但当成千上万人在同一条街上、一个晚上接一个晚上、连续几个月做同一个决定,算术就变了。卡内蒂在《群众与权力》里说,人群要经过「放电」——彼此界限消失的那一瞬——才真正成为群众;而这条街上恰好相反:谁也不认识谁,各自低头看手机、各自喝咖啡,却在做同一件事。这正是「非运动」别扭的地方,它连群众那一下放电都不需要。Khoshnami borrows the sociologist Asef Bayat's term “non-movement”: collective action by non-collective actors. No leader, no platform, no organization. Each person makes a private decision — to go out tonight, to wear what she wants. But when thousands make that decision on the same street, night after night, for months, the arithmetic changes. Canetti, in Crowds and Power, says a crowd only becomes a crowd at the moment of “discharge,” when the boundaries between people collapse. This street is the opposite: nobody knows anybody, each woman is heads-down in her phone or her coffee, and yet they are all doing the same thing. That is the awkward part of a non-movement — it does not even need the discharge.
为什么这种改变难对付?一次游行可以在一夜之间清场。但你没法逮捕「今晚出门喝咖啡」;你只能去关她们聚集的咖啡馆、封她们的账号、派便衣坐进店里。2026 年 8 月,全国至少 42 家店因此被关,70 多个社媒账号被查封。可国家也发现,很多时候它甚至不用真的在场:一个女人只要怀疑这家咖啡馆有人在看,她就会自己收敛。恐惧的成本比警察低。但威慑会自己磨损。Sima 第一次摘下头巾出门时,包里始终备着一条,随时准备应付突发;可每出门一次,就看到更多不戴头巾的女性,那份怕一点点退掉——她说,那让她知道自己不是一个人。Why is that so hard to suppress? A demonstration can be cleared in a night. You cannot arrest “going out for coffee.” You can only close the cafés where people gather, block their accounts, put plainclothes officers in the room. In August 2026 at least 42 businesses were shut and more than 70 social-media accounts seized. But the state also learned it often does not need to be present: a woman who merely suspects she is being watched will police herself. Fear is cheaper than police. But deterrence wears itself down. The first time Sima went out without a headscarf she kept one in her bag, ready to pull out if anything happened; each time she went out she saw more bare heads, and the fear receded a little — she says seeing them told her she was not alone.
更有意思的是国家的两难。2023 年起草、后来通过却从未生效的头巾与贞洁法案;总统在电视上承认自己对这部法律「有很多保留」,因为执行它需要邻里互相举报、出租车司机举报乘客,会先把社会信任毁掉。而废除法律又等于公开认输。于是法律留在纸上,执法退到成本更低的地方。国家真正保护的不是宗教,而是「仍然掌控局面」的形象。The state's dilemma is the more revealing part. A hijab-and-chastity bill drafted in 2023 and passed later has never been brought into force; the president admitted on television that he had “many reservations,” because enforcement would mean neighbours reporting neighbours and taxi drivers reporting passengers — destroying social trust first. Repealing the law, meanwhile, would be a public admission of defeat. So the law stays on the books, unenforced, and enforcement retreats to cheaper targets. What is being protected is not religion but the image of a government still in charge.
这给我们一个不太符合直觉的提醒:改变不一定以胜利的形式到来。没有签字,没有生效日期,没有哪一天宣布结束——但那条街已经和几年前完全不一样了。Bayat 把这叫「存在的艺术」:在约束中创造空间,用现有的东西让自己被看见。单看每个人,这几乎不算策略,只是过日子;但足够多的人坚持过日子,规则就会弯曲。我们习惯的改变是发一个 PR、发一份声明、赢一次辩论;而这里展示的是另一种更慢、更难被回滚的方式——先改变生活,再让规则追上来。The lesson is counterintuitive: change does not always arrive as a victory. There is no signature, no effective date, no day on which it is declared over — yet the street looks nothing like it did a few years ago. Bayat calls this “the art of presence”: making room inside constraints, using what is at hand to be seen. For any one person it barely counts as a strategy; it is just living. But when enough people insist on living that way, the rules bend. We are used to change that looks like a pull request, a statement, a won argument. This is the slower kind, and much harder to roll back: first change how you live, then let the rules catch up.
AI 思考AI Thoughts
- 模型、应用、外壳:AI 的进步是一条锯齿,不是一条斜线Models, Apps, Harnesses: AI Progress Is a Jagged Edge, Not a Straight Line
- Mollick 提议把 AI 拆成三层来看:模型本身、包着模型的产品、以及产品外面那层「外壳」——工具、记忆、循环、权限。用户实际感受到的能力,常常是三层乘出来的结果,而不是模型单独有多聪明。Mollick suggests looking at AI in three layers: the model, the product wrapped around it, and the harness around the product — tools, memory, loops, permissions. What a user experiences is usually the product of all three, not the model's intelligence alone.
- 他做了个测试:让几个模型用代码生成一座从公元前 3000 年演化到公元 3000 年的港口城市。只有 GPT-5.5 Pro 真的让城市随时间变化,用了 20 分钟;另一个模型花了 33 分钟,却没有做到演化。He ran a test: have several models generate, in code, a harbor town evolving from 3000 BCE to 3000 AD. Only GPT-5.5 Pro actually made the town change over time, in 20 minutes; another model took 33 minutes and never got the evolution.
- 文字上也测了:给四个提示和一批旧众筹数据,模型写出一篇「二年级博士生会接受」的论文——文献是真的,统计站得住,但假设无趣,因果推断仍有问题。再给一个提示,它交出 101 页、可玩的 RPG 规则书。He tested writing too. With four prompts and an old crowdfunding dataset, a model produced a paper a second-year PhD student would accept — real literature, sound statistics — but the hypothesis was uninteresting and the causal claims shaky. One more prompt yielded a 101-page playable RPG rulebook.
- 可长篇虚构依然平:句子华丽而空,所有角色用同一种短促的口气说话,连名字都反复用同一个。能写和写得好之间,还隔着东西。Long-form fiction, though, is still flat: ornate sentences that say little, every character speaking in the same clipped voice, the same name reused. Something still separates “can write” from “writes well.”
- 所以结论不是「AI 到了」或「AI 没到」,而是能力边界仍然参差。同一个模型能做出让你惊讶的事,也会在你以为它会的邻域里失败。判断该把任务交给谁,靠的是不断试探这条锯齿,而不是相信一条平滑的曲线。(原文发表于 2026 年 4 月)The conclusion is not “AI is here” or “AI is not here,” but that the frontier is jagged. The same model that astonishes you will fail in a neighboring task you assumed it could do. Deciding what to delegate means probing that edge, not trusting a smooth curve. (Originally published in April 2026.)
- 提示词最重要的技能,是你本来就得懂这件事The Most Important Prompting Skill Is Already Knowing the Subject
- 流行说法是:AI 让所有人都变成通才,所以专业能力不重要了,会写提示词就行。作者不同意——他认为领域专长才是提示词的核心技能,而且人对面的模型越强,这一点越明显。The popular story says AI turns everyone into a generalist, so expertise no longer matters — just write good prompts. Goedecke disagrees: domain expertise is the core prompting skill, and the stronger the model, the more this shows.
- 他拿陶哲轩公开的一段 ChatGPT 对话举例:陶的每句话都很短,模型的回复也短而专业。为什么?因为提问的方式本身在告诉模型「你在跟一个数学家说话」,模型于是切到相应的语域。这些技巧你抄不走,除非你也会数学。He uses a public ChatGPT conversation with Terence Tao. Tao's messages are short; the model's replies are short and professional. Why? The way he asks signals “you are talking to a mathematician,” and the model shifts register. You cannot copy the technique without the mathematics.
- 陶很少直接接受模型的建议,会自己跳出下一步,也会礼貌地施压:「这比我期望的复杂」。要做出这种判断,你得知道问题在哪、什么算简单、哪一步可疑。Tao rarely accepts the model's suggestions outright. He makes his own leaps and applies polite pressure: “this looks more complex than I was hoping for.” That judgment requires knowing where the difficulty is, what counts as simple, and which step smells wrong.
- 写代码同理。懂代码库的人能说「能不能更简单」「我们不是已经有 X 了吗」「用我们熟悉的写法表达」;不懂的人只能接受第一个能跑的答案。系统设计更是被具体细节支配,而细节来自经验。The same holds in code. Someone who knows the codebase can say “can this be simpler?”, “don't we already do X?”, “express it in terms we use.” Someone who does not will accept the first answer that runs. System design is dominated by concrete specifics, and specifics come from experience.
- 所以人常常成为瓶颈,不是因为模型不够强,而是因为「说清楚到底想要什么」本身需要专业知识。信息可能已经在模型里,但需要一个懂行的人把它拽出来。(原文发表于 2026 年 7 月)So the human is often the bottleneck — not because the model is weak, but because stating exactly what you want requires expertise. The information may already be inside the model; it takes an expert to pull it out. (Originally published in July 2026.)
- 别再用聊天框了:agent 真正改变的是工作方式Stop Using the Chat Box: What Agents Really Change Is How You Work
- 怀疑者的论证通常针对「聊天机器人」:它会胡编、它不懂我的代码、生成的东西不能用。Ptacek 说这些批评不够严肃,因为认真用的人早就不用聊天框了。The skeptics' arguments are usually aimed at chatbots: it hallucinates, it does not know my code, the output is unusable. Ptacek says the arguments are not serious, because serious users stopped using the chat box a while ago.
- 今天认真的用法是 agent:它能翻代码库、写文件、跑命令、编译、跑测试、把结果拉回上下文、用 git 和 linter、调工具。让 agent「能动手」的那部分代码不是 AI,是普通的系统代码,和 Makefile 一个性质。The serious setup is an agent: it can read the repo, write files, run commands, compile, run tests, pull results back into context, use git and linters, call tools. The code that lets the agent act is not AI; it is ordinary systems code, the same species as a Makefile.
- 正面理由很朴素:它写掉大量枯燥代码,少了很多查文档,不会累、没有惰性,而且能把你送到「东西快能跑了」的那一刻——那正是最耗人的位置。The positive case is plain: it writes a large share of tedious code, removes much of the documentation hunting, never gets tired or bored, and drops you at the moment when the thing almost works — which is exactly where human energy used to die.
- 「你不知道代码在干什么」也不成立:你本来就要为合并进去的东西负责。花五到十分钟读懂它、改成你的风格。代码不是概率性的,它是可以被认识的。“You do not know what the code does” does not hold either. You were always responsible for what you merge. Spend five or ten minutes reading it and making it your style. Code is not probabilistic; it is knowable.
- 幻觉在工程里大多被循环消掉了:编译、lint、测试。真正稀缺的仍然是判断——做什么、往哪走、什么算好。LLM 吃掉的是 schlep(杂活),不是品味。(原文发表于 2025 年 6 月)In engineering, hallucinations are mostly killed by loops: compile, lint, test. What stays scarce is judgment — what to build, where to go, what counts as good. LLMs eat the schlep, not the taste. (Originally published in June 2025.)
数学之美The Beauty of Math
每日 Lean 谜题 · 周四Daily Lean Puzzle · Thursday ★★★★☆☆☆
每日谜题 ★4:用有理函数逼近立方根Daily Puzzle ★4: Approximating a Cube Root with a Rational Function
设 $k$ 是 $2$ 的实数立方根,也就是 $k^3 = 2$。要在所有非负有理数 $x$ 上,用一个二次分式 $(Ax^2 + Bx + C)/(ax^2 + bx + c)$ 来逼近 $k$,而且要求它比 $x$ 本身更接近 $k$:Let $k$ be the real cube root of $2$, so $k^3 = 2$. We want a quadratic rational function $(Ax^2 + Bx + C)/(ax^2 + bx + c)$ that approximates $k$ better than $x$ itself does, for every non-negative rational $x$:
$|(Ax^2 + Bx + C)/(ax^2 + bx + c) - k| < |x - k|$,其中 $A, B, C, a, b, c$ 都是整数。题目要求找出一组这样的整数。$|(Ax^2 + Bx + C)/(ax^2 + bx + c) - k| < |x - k|$, where $A, B, C, a, b, c$ are integers. The problem asks you to find one such set of integers.
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.Algebra.Order.Star.Real
import Mathlib.Algebra.Ring.IsFormallyReal
import Mathlib.Algebra.Order.Star.Int
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.LinearCombination.Lemmas
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Ring
/-!
# USA Mathematical Olympiad 1972, Problem 4
Let k be the real cube root of 2. Find integers A, B, C, a, b, c such that
|(Ax² + Bx + C)/(ax² + bx + c) − k| < |x − k|
for all non-negative rational numbers x.
-/
namespace Usa1972P4
abbrev IsSolution (A B C a b c : ℤ) (k : ℝ) : Prop :=
∀ x : ℚ, 0 ≤ x →
|((A : ℝ) * (x : ℝ) ^ 2 + (B : ℝ) * (x : ℝ) + (C : ℝ)) /
((a : ℝ) * (x : ℝ) ^ 2 + (b : ℝ) * (x : ℝ) + (c : ℝ)) - k| <
|(x : ℝ) - k|
abbrev solution : ℤ × ℤ × ℤ × ℤ × ℤ × ℤ := sorry
theorem usa1972_p4 (k : ℝ) (hk : k ^ 3 = 2) :
match solution with
| (A, B, C, a, b, c) => IsSolution A B C a b c k := by
sorry
end Usa1972P4
在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean
提示Hint
先不要把六个整数当自由变量去猜。让 $x$ 趋近 $k$:如果左边比 $|x-k|$ 还小,那么在 $x=k$ 处分子必须正好是 $k$ 乘以分母,否则比值会留下一个常数误差。利用 $k^3=2$ 把 $1, k, k^2$ 看成一组基,就能把六个未知数压成三个关系。然后再把分子减去 $k$ 倍分母,因式分解出 $(x-k)$。Do not treat the six integers as free variables to guess. Let $x$ approach $k$: if the left side is smaller than $|x-k|$, the numerator at $x=k$ must equal $k$ times the denominator, or the ratio leaves a constant error. Using $k^3=2$, treat $1, k, k^2$ as a basis and the six unknowns collapse into three relations. Then subtract $k$ times the denominator from the numerator and factor out $(x-k)$.
答案与讲解Solution & walkthrough
- 第一步是看 $x \to k$ 的极限。不等式右边趋于 $0$,所以左边的差也必须趋于 $0$:$Ak^2 + Bk + C = k(ak^2 + bk + c)$。把右边展开,并用 $k^3 = 2$,得到 $Ak^2 + Bk + C = 2a + bk^2 + ck$。因为 $1, k, k^2$ 在有理数上线性无关($k$ 是无理数),比较系数就有 $A = b$,$B = c$,$C = 2a$。Start with the limit as $x \to k$. The right side goes to $0$, so the difference on the left must too: $Ak^2 + Bk + C = k(ak^2 + bk + c)$. Expand the right side and use $k^3 = 2$ to get $Ak^2 + Bk + C = 2a + bk^2 + ck$. Since $1, k, k^2$ are linearly independent over the rationals ($k$ is irrational), comparing coefficients gives $A = b$, $B = c$, $C = 2a$.
- 于是分子减去 $k$ 倍分母可以因式分解:$(bx^2 + cx + 2a) - k(ax^2 + bx + c) = (x-k)((b-ak)x + c - ak^2)$。原不等式就变成:这个一次因子除以分母的绝对值小于 $1$。Now subtract $k$ times the denominator from the numerator and factor: $(bx^2 + cx + 2a) - k(ax^2 + bx + c) = (x-k)((b-ak)x + c - ak^2)$. The original inequality becomes: this linear factor divided by the denominator has absolute value less than $1$.
- 取最简单的一组:$a = 1$,$b = c = 2$,即分式 $(2x^2+2x+2)/(x^2+2x+2)$。此时一次因子是 $(2-k)x + 2-k^2$。因为 $1 < k < 2$,所以 $2-k > 0$ 且 $2-k^2 > 0$;对 $x \ge 0$,整个因子是正的。Take the simplest choice: $a = 1$, $b = c = 2$, giving $(2x^2+2x+2)/(x^2+2x+2)$. The linear factor is $(2-k)x + 2-k^2$. Since $1 < k < 2$, both $2-k$ and $2-k^2$ are positive, and for $x \ge 0$ the whole factor is positive.
- 还要证明它比分母小。分母减去这个因子,正好是 $x^2 + kx + k^2$,其中每一项都非负且 $k^2 > 0$,所以严格大于 $0$。因此因子与分母之比落在 $(0,1)$。两边乘以 $|x-k|$($x$ 是有理数而 $k$ 无理,故不为 $0$),就得到严格小于。It remains to show the factor is smaller than the denominator. Denominator minus factor is exactly $x^2 + kx + k^2$, whose terms are non-negative and whose last term is strictly positive, so the difference is positive. Hence the ratio lies in $(0,1)$. Multiply by $|x-k|$ (nonzero because $x$ is rational and $k$ is not) and the strict inequality follows.
- Lean 里的证明沿着同一条路:先证明 $k$ 不是有理数(用奇偶性做无穷递降),再证 $1 < k < 2$ 与 $k^2 < 2$,用 `linear_combination` 核对因式分解,最后用 `div_lt_one` 和 `mul_lt_mul_of_pos_left` 收尾。解元组就是 $(2,2,2,1,2,2)$。The Lean proof follows the same path: first show $k$ is irrational (parity and infinite descent), then $1 < k < 2$ and $k^2 < 2$; `linear_combination` checks the factorization, and `div_lt_one` plus `mul_lt_mul_of_pos_left` finish. The solution tuple is $(2,2,2,1,2,2)$.
/-
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.Algebra.Order.Star.Real
import Mathlib.Algebra.Ring.IsFormallyReal
import Mathlib.Algebra.Order.Star.Int
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.LinearCombination.Lemmas
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Ring
/-!
# USA Mathematical Olympiad 1972, Problem 4
Let k be the real cube root of 2. Find integers A, B, C, a, b, c such that
|(Ax² + Bx + C)/(ax² + bx + c) − k| < |x − k|
for all non-negative rational numbers x.
-/
namespace Usa1972P4
/-- The property that the integers `A, B, C, a, b, c` solve the problem for the
real cube root `k` of `2`: the rational function `(Ax² + Bx + C)/(ax² + bx + c)`
approximates `k` strictly better than `x` does, for every non-negative
rational number `x`. -/
abbrev IsSolution (A B C a b c : ℤ) (k : ℝ) : Prop :=
∀ x : ℚ, 0 ≤ x →
|((A : ℝ) * (x : ℝ) ^ 2 + (B : ℝ) * (x : ℝ) + (C : ℝ)) /
((a : ℝ) * (x : ℝ) ^ 2 + (b : ℝ) * (x : ℝ) + (c : ℝ)) - k| <
|(x : ℝ) - k|
/-
We follow the solution from
https://prase.cz/kalva/usa/usoln/usol724.html
Take `(A, B, C, a, b, c) = (2, 2, 2, 1, 2, 2)`. Since `k³ = 2`, the numerator
of `(2x² + 2x + 2)/(x² + 2x + 2) − k` factors as
`(2x² + 2x + 2) − (x² + 2x + 2)k = (x − k)((2 − k)x + 2 − k²)`.
For `x ≥ 0`, both `(2 − k)x + 2 − k²` and `x² + 2x + 2` are positive, and the
latter minus the former equals `x² + kx + k² > 0`, so their ratio lies
strictly between `0` and `1`. Multiplying by `|x − k| > 0` (note that `x ≠ k`
because `∛2` is irrational) yields the claim.
-/
/-- There is no rational number whose cube equals `2`. -/
lemma rat_cube_ne_two (q : ℚ) : q ^ 3 ≠ 2 := by
intro hq
have hdq : (q.den : ℚ) ≠ 0 := by exact_mod_cast q.den_nz
rw [← Rat.num_div_den q, div_pow, div_eq_iff (pow_ne_zero 3 hdq)] at hq
-- `hq` states `q.num ^ 3 = 2 * q.den ^ 3`, over `ℚ`.
have h2 : q.num ^ 3 = 2 * (q.den : ℤ) ^ 3 := by exact_mod_cast hq
-- Hence the numerator is even.
have hEvenNum : Even q.num := by
rcases Int.even_or_odd q.num with hE | hO
· exact hE
· exfalso
have hO3 : Odd (q.num ^ 3) := hO.pow
rw [h2] at hO3
obtain ⟨r, hr⟩ := hO3
obtain ⟨s, hs⟩ := (⟨(q.den : ℤ) ^ 3, by ring⟩ : Even (2 * (q.den : ℤ) ^ 3))
lia
have h2dvdnum : (2 : ℤ) ∣ q.num := even_iff_two_dvd.mp hEvenNum
obtain ⟨m, hm⟩ := hEvenNum
-- Hence the denominator is even as well.
have hEvenDenZ : Even (q.den : ℤ) := by
rcases Int.even_or_odd (q.den : ℤ) with hE | hO
· exact hE
· exfalso
have h8 : (q.den : ℤ) ^ 3 = 4 * m ^ 3 := by
have hh : (m + m) ^ 3 = 2 * (q.den : ℤ) ^ 3 := by rwa [← hm]
have h8m : (m + m) ^ 3 = 8 * m ^ 3 := by ring
rw [h8m] at hh
linarith
have hO3 : Odd ((q.den : ℤ) ^ 3) := hO.pow
rw [h8] at hO3
obtain ⟨r, hr⟩ := hO3
obtain ⟨s, hs⟩ := (⟨2 * m ^ 3, by ring⟩ : Even (4 * m ^ 3))
lia
have hEvenDen : Even q.den := by exact_mod_cast hEvenDenZ
-- But the numerator and denominator of a rational number are coprime.
have hdvd : (2 : ℕ) ∣ Nat.gcd q.num.natAbs q.den := by
refine Nat.dvd_gcd ?_ (even_iff_two_dvd.mp hEvenDen)
have h' : (2 : ℤ) ∣ (q.num.natAbs : ℤ) := Int.dvd_natAbs.mpr h2dvdnum
exact_mod_cast h'
rw [q.reduced.gcd_eq_one] at hdvd
norm_num at hdvd
/-- A rational number is never equal to the real cube root of `2`. -/
lemma ratCast_ne_of_cube_eq_two {k : ℝ} (hk : k ^ 3 = 2) (q : ℚ) : (q : ℝ) ≠ k := by
rintro rfl
have h1 : ((q ^ 3 : ℚ) : ℝ) = 2 := by
push_cast
exact hk
exact rat_cube_ne_two q (by exact_mod_cast h1)
/-- The key factorization, using `k³ = 2`:
`(2x² + 2x + 2) − (x² + 2x + 2)k = (x − k)((2 − k)x + 2 − k²)`. -/
lemma cube_eq_two_factor {k x : ℝ} (hk : k ^ 3 = 2) :
2 * x ^ 2 + 2 * x + 2 - (x ^ 2 + 2 * x + 2) * k =
(x - k) * ((2 - k) * x + 2 - k ^ 2) := by
linear_combination -hk
lemma one_lt_of_cube_eq_two {k : ℝ} (hk : k ^ 3 = 2) : 1 < k := by
have h3 : Odd 3 := ⟨1, rfl⟩
rw [← h3.pow_lt_pow, one_pow, hk]
norm_num
lemma lt_two_of_cube_eq_two {k : ℝ} (hk : k ^ 3 = 2) : k < 2 := by
have h3 : Odd 3 := ⟨1, rfl⟩
rw [← h3.pow_lt_pow, hk]
norm_num
lemma sq_lt_two_of_cube_eq_two {k : ℝ} (hk : k ^ 3 = 2) : k ^ 2 < 2 := by
have hk1 : 1 < k := one_lt_of_cube_eq_two hk
have hkpos : 0 < k := zero_lt_one.trans hk1
have h3 : k ^ 3 = k ^ 2 * k := by ring
have hk2eq : k ^ 2 = 2 / k := by
rw [eq_div_iff hkpos.ne', ← h3]
exact hk
rw [hk2eq]
exact div_lt_self (by norm_num) hk1
/-- With `(A, B, C, a, b, c) = (2, 2, 2, 1, 2, 2)`, the required inequality
holds for every non-negative rational number `x`. -/
lemma main_inequality {k : ℝ} (hk : k ^ 3 = 2) (x : ℚ) (hx : 0 ≤ x) :
|(2 * (x : ℝ) ^ 2 + 2 * (x : ℝ) + 2) / ((x : ℝ) ^ 2 + 2 * (x : ℝ) + 2) - k| <
|(x : ℝ) - k| := by
have hkpos : 0 < k := zero_lt_one.trans (one_lt_of_cube_eq_two hk)
have hk2 : k < 2 := lt_two_of_cube_eq_two hk
have hk2sq : k ^ 2 < 2 := sq_lt_two_of_cube_eq_two hk
have hxr : (0 : ℝ) ≤ (x : ℝ) := by exact_mod_cast hx
-- The denominator is positive.
have hD : 0 < (x : ℝ) ^ 2 + 2 * (x : ℝ) + 2 := by
have hsq := sq_nonneg (x : ℝ)
linarith
-- The second factor of the factored numerator is positive.
have hN : 0 < (2 - k) * (x : ℝ) + 2 - k ^ 2 := by
have h1 : 0 ≤ (2 - k) * (x : ℝ) := mul_nonneg (by linarith) hxr
linarith
-- ... and smaller than the denominator, since their difference is
-- `x² + kx + k² > 0`.
have hNltD : (2 - k) * (x : ℝ) + 2 - k ^ 2 < (x : ℝ) ^ 2 + 2 * (x : ℝ) + 2 := by
have hkx : 0 ≤ k * (x : ℝ) := mul_nonneg hkpos.le hxr
have hsq := sq_nonneg (x : ℝ)
have hk2pos : 0 < k ^ 2 := pow_pos hkpos 2
linarith
have habs : 0 < |(x : ℝ) - k| :=
abs_pos.mpr (sub_ne_zero.mpr (ratCast_ne_of_cube_eq_two hk x))
have hDne : (x : ℝ) ^ 2 + 2 * (x : ℝ) + 2 ≠ 0 := hD.ne'
rw [div_sub' hDne, cube_eq_two_factor hk, abs_div, abs_mul, abs_of_pos hN,
abs_of_pos hD, mul_div_assoc]
have h1 : ((2 - k) * (x : ℝ) + 2 - k ^ 2) / ((x : ℝ) ^ 2 + 2 * (x : ℝ) + 2) < 1 :=
(div_lt_one hD).mpr hNltD
exact (mul_lt_mul_of_pos_left h1 habs).trans_eq (mul_one _)
abbrev solution : ℤ × ℤ × ℤ × ℤ × ℤ × ℤ := (2, 2, 2, 1, 2, 2)
theorem usa1972_p4 (k : ℝ) (hk : k ^ 3 = 2) :
match solution with
| (A, B, C, a, b, c) => IsSolution A B C a b c k := by
intro x hx
simp only [Int.cast_ofNat, Int.cast_one, one_mul]
exact main_inequality hk x hx
end Usa1972P4
人的思考A human's take
USAMO 72/4 solution — John Scholes (Kalva archive)
John Scholes 的解法只有几行,但每一步都在减少未知数。他先让 $x$ 趋于 $k$,由不等式右边趋于零,推出 $(Ak^2+Bk+C) = k(ak^2+bk+c)$,于是 $A=b$、$B=c$、$C=2a$——六个整数一下子只剩三个。John Scholes's solution is only a few lines, but every line removes unknowns. He first lets $x$ approach $k$; since the right side of the inequality goes to zero, $(Ak^2+Bk+C) = k(ak^2+bk+c)$, which gives $A=b$, $B=c$, $C=2a$ — six integers reduced to three.
接着他把分子减去 $k$ 倍分母,因式分解成 $(x-k)((b-ak)x + c - ak^2)$,问题变成「这个一次式要比分母小」。他写道,满足它的方法有很多,随手取 $a=1$、$b=c=2$:此时 $(b-ak)x$ 对正 $x$ 是正的且小于 $bx$,常数项 $c-ak^2$ 也是正的且小于 $c$,不等式自然成立。He then subtracts $k$ times the denominator from the numerator and factors it as $(x-k)((b-ak)x + c - ak^2)$, so the problem becomes making that linear factor smaller than the denominator. There are many ways, he notes; take $a=1$, $b=c=2$. Then $(b-ak)x$ is positive for positive $x$ and smaller than $bx$, while the constant $c-ak^2$ is positive and smaller than $c$, so the inequality holds.
AI 随想An AI's reflection
以下由 AI 撰写。Written by AI.
这道题看上去像在六个整数里碰运气,实际的第一击是「取极限」:不等式强迫分子在 $x=k$ 处正好抵消,六个自由度立刻塌成三个。很多人做这类题时急着构造,真正省力的动作却是先问「如果它成立,端点上必须发生什么」。The problem looks like a lucky search over six integers, but the first move is a limit: the inequality forces the numerator to cancel exactly at $x=k$, and six degrees of freedom collapse to three. In problems like this it is tempting to start constructing; the cheaper move is to ask what must happen at the endpoint if the claim is true.
第二步才是构造,而构造之所以容易,是因为已经把「差」因式分解成了一个一次式乘 $(x-k)$。剩下要证的只是这个一次式比二次分母小,而它们的差恰好是 $x^2+kx+k^2$——一个永远为正的配方。这也顺带解释了为什么二次刚好够:差里只剩一个一次因子,分母只要增长得比它快,比值就会被压进 $(0,1)$。这种「先用端点把形状钉死,再挑参数」的顺序,在别处也反复出现——先让边界和对称性说话,剩下的才是算术。Only then comes the construction, and it is easy because the difference has already been factored into a linear term times $(x-k)$. What remains is to show that this linear term is smaller than the quadratic denominator, and their difference is exactly $x^2+kx+k^2$ — a sum that is always positive. It also explains why quadratic is just enough: the difference leaves a single linear factor, and as long as the denominator grows faster the ratio is pinned inside $(0,1)$. This order of work — let the endpoint fix the shape, then choose parameters — shows up elsewhere too: let boundaries and symmetry speak first, and what is left is arithmetic.
Lean 形式化最花力气的不是这些代数,而是 $k$ 不是有理数:没有它,$|x-k|$ 可能为零,严格不等式就不成立。人写解答时常常一句「显然」带过,机器会逼你把那个「显然」真的证出来。这也是我喜欢看形式化版本的原因:它把证明里被省略的承重墙标了出来。The hard work in the Lean formalization is not the algebra but the irrationality of $k$: without it, $|x-k|$ could be zero and the strict inequality would fail. Human solutions wave this away with “obviously”; the machine makes you prove the obvious. That is why I like reading the formal version: it marks the load-bearing walls that the prose left out.
✓ 已通过 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-rc2 · Mathlib a906e4e
- 零知识证明:怎么证明你知道答案,却一个字都不透露Zero-Knowledge Proofs: Convincing Someone You Know, Without Revealing Anything
- 问题:两张巨大的图 G1、G2,我说它们是同构的——只是顶点编号不同——我知道那个换编号的映射 f,但告诉你,你就可能拿去偷我的钱。有没有办法让你相信我,又不泄露 f?The setup: two huge graphs G1 and G2. I claim they are isomorphic — the same graph with different vertex labels — and I know the relabeling f. If I show it to you, you can use it to take my money. Can I convince you without leaking f?
- 第一轮:我随机打乱 G1 的顶点,得到一张新图 H 发给你,并偷偷记下用过的置换 π。Round one: I randomly permute the vertices of G1, send you the resulting graph H, and secretly keep the permutation π.
- 你随机选 t=1 或 2,要求我把 H 变回 Gt。若 t=1,我交 π⁻¹;若 t=2,我交 f∘π⁻¹。两个都是均匀随机的置换,你看不出差别。You pick t=1 or 2 at random and ask me to map H back to Gt. If t=1 I return π⁻¹; if t=2 I return f∘π⁻¹. Both are uniformly random permutations, so you cannot tell them apart.
- 为什么骗不过:如果两张图根本不同构,H 最多只和其中一张同构。无论我怎么伪造,你各有一半概率选中我答不出的那一边,所以单轮被抓概率是 1/2。Why cheating fails: if the graphs are not isomorphic, H can be isomorphic to at most one of them. Whatever I fabricate, you have a one-half chance of choosing the side I cannot answer, so each round catches me with probability 1/2.
- 重复 30 次,作弊成功率降到 2⁻³⁰(约十亿分之一);约 400 次,就比「从全宇宙原子里随机挑中某一个」还难。零知识的直觉是:你收到的每条消息都是随机置换,你自己也能造出来,所以协议结束后你并没有多知道任何东西——这就是「模拟器」论证。(原文发表于 2016 年)Repeat 30 times and the chance of fooling you falls to 2⁻³⁰, about one in a billion; around 400 rounds is less likely than picking one specific atom out of the universe at random. The intuition for “zero knowledge” is that every message you receive is a random permutation you could have generated yourself, so you learn nothing new — the simulator argument. (Originally published in 2016.)
- 所有正分数排成一队,每个只出现一次Every Positive Fraction, Lined Up Once and Only Once
- 先看一个好玩的计数:b(n) 表示把 n 拆成 2 的幂之和、每个幂最多用两次的方法数。比如 5 = 4+1 = 2+2+1,所以 b(5)=2;10 有五种拆法,所以 b(10)=5。这个序列长这样:1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, …Start with a curious counting function. Let b(n) be the number of ways to write n as a sum of powers of two, each power used at most twice. For 5: 4+1 and 2+2+1, so b(5)=2. For 10 there are five ways, so b(10)=5. The sequence begins 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, …
- 现在把序列和它自己错开一位相除:b(n)/b(n+1)。得到 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1, 1/4, 4/3, 3/5, 5/2, …。Calkin 和 Wilf 的论文标题就是结论:这个序列把每个正有理数恰好列出一次,没有遗漏,也没有重复。Now divide the sequence by a copy of itself shifted one place: b(n)/b(n+1). You get 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1, 1/4, 4/3, 3/5, 5/2, …. The Calkin–Wilf paper's punchline is exactly this: the list contains every positive rational exactly once — nothing missing, nothing repeated.
- 为什么成立:把每个分数 a/b 看成树上的一个节点,它的两个孩子是 a/(a+b) 和 (a+b)/b,根是 1/1。反过来,任何 a/b ≠ 1 都有唯一的父节点——a<b 时父节点是 a/(b−a),a>b 时是 (a−b)/b。于是一直往上走必然回到 1/1,路径唯一,所以每个分数只出现一次;而每个分数都能这样走回根,所以一个也不漏。Why it works: treat each fraction a/b as a node of a tree whose children are a/(a+b) and (a+b)/b, with 1/1 at the root. Going backwards, every a/b other than 1 has a unique parent — a/(b−a) when a<b, and (a−b)/b when a>b. So walking upward always reaches 1/1 by one path, which means no fraction appears twice; and since every fraction can walk up to the root, none is left out.
- 这和 b(n) 的递推是一回事:b(2n+1)=b(n),b(2n)=b(n−1)+b(n)。b 其实是 Stern 序列错开一位,而 Stern 序列正是这棵分数树按层读下来的结果——每个分数的分子和分母,就是序列里相邻的两项。一个看似只为数论的数列,背后是一棵枚举所有正有理数的树。This is the same fact as the recurrence for b: b(2n+1)=b(n) and b(2n)=b(n−1)+b(n). The sequence is Stern's diatomic sequence shifted by one, and Stern's sequence is exactly this fraction tree read level by level — the numerator and denominator of each fraction are two consecutive terms. What looked like a number-theory curiosity is a tree that enumerates every positive rational.
- 可以带走的东西:有理数比自然数「密」,但一样可数,而且可数性可以是构造性的——不需要选择公理,只要一条递推和一棵树,就能把无穷多个分数排成一个没有重复的队列。下次有人说「无穷大也分大小」,这就是一个能当场写代码验证的例子。(原文发表于 2008 年)The takeaway: the rationals are dense, yet still countable — and the countability is constructive. No axiom of choice needed; one recurrence and one tree line up infinitely many fractions in a queue with no duplicates. The next time someone says infinity comes in sizes, this is an example you can verify with twenty lines of code. (Originally published in 2008.)
- 有限状态机为什么数不了数:记忆的边界就是能力的边界Why a Finite-State Machine Cannot Count: Memory Sets the Limit of Ability
- 先把「计算」缩成一个简单问题:读一串 0 和 1,判断它是不是某种语言里的句子。最弱的机器是有限状态机(DFA):只有有限个状态,读一个字符就按规则换状态,读完看停在不在接受状态。Shrink “computation” to a simple question: read a string of 0s and 1s and decide whether it belongs to some language. The weakest machine is a deterministic finite automaton: finitely many states, a rule that moves state on each character, and an accepting set you check at the end.
- 它能做不少事:判断 0 的个数是不是偶数,只要两个状态(偶、奇)来回跳。状态就是它全部的记性。It can do a lot. To decide whether the number of 0s is even, two states that flip back and forth are enough. Those states are its entire memory.
- 但有一件事它永远做不到:判断这串是不是 n 个 0 后面跟 n 个 1(0ⁿ1ⁿ)。因为它必须在读到 1 的时候知道前面有几个 0,而「几个」可以任意大,有限个状态存不下。But one thing it can never do is decide whether the string is n zeros followed by n ones (0ⁿ1ⁿ). To read the ones correctly it must know how many zeros came before, and “how many” can be arbitrarily large. Finitely many states cannot store it.
- 证明的工具是泵引理:如果一台有限状态机接受这个语言,取一个足够长的合法串,根据抽屉原理,读的过程中必有某个状态重复;把中间那段循环任意重复多次,机器还是接受——可重复之后 0 和 1 的数量就不相等了,矛盾。The proof tool is the pumping lemma. Suppose a finite machine accepts this language. Take a long enough accepted string; by the pigeonhole principle some state must repeat while reading it. Loop that middle section any number of times and the machine still accepts — but now the counts of zeros and ones no longer match. Contradiction.
- 这个结论比它看起来重要:它说的不是「这台机器不够快」,而是「这类结构根本没有这个能力」。加内存、加状态可以变成下一种机器(下推自动机、图灵机),但只要你还在有限状态里,某些区分就永远做不出来。写程序时判断「我的数据结构记不记得住这件事」,是同一个问题。(原文发表于 2011 年)The result matters more than it looks. It does not say the machine is slow; it says this kind of structure lacks the ability altogether. Add memory and states and you get a stronger machine (a pushdown automaton, a Turing machine), but while you stay finite, some distinctions are simply unavailable. Asking “can my data structure remember this?” is the same question in everyday programming. (Originally published in 2011.)
程序员随想Programmer Reflections
- 注释不是复述代码,而是补上代码说不出口的那部分Comments Do Not Repeat the Code; They Say What the Code Cannot
- antirez 说注释极端重要,理由有两个,第二个常被忽略。他翻遍 Redis 自己的源码,把里面的注释按用途分类,想说明一件事:代码写得再扎实,也不等于不需要注释——很多人恰恰是拿「好代码自己会说话」当借口。antirez argues that comments are essential, for two reasons, the second routinely overlooked. He works through Redis's own source, sorting its comments by purpose, to make one point: solid code does not make comments unnecessary — “good code documents itself” is usually the excuse.
- 第一个理由:代码只能表达「怎么做」,表达不了「为什么这么做」。为什么这里用这个数据结构、为什么不能改成看起来更自然的写法——这些约束不在代码里。删掉注释,下一个修改者就会把它「优化」掉。First, code can express how something is done but not why. Why this data structure, why not the more natural-looking alternative — those constraints live outside the code. Delete the comment and the next person will “clean it up.”
- 第二个理由更微妙:即使注释只是复述代码在做什么,它也能降低阅读时的认知负担。读 Lua 的栈式 API 时,每一步后面标一句「现在栈里有 a、b、c」,读者就不必在脑子里维护一个栈。注释是给读者的工作记忆做缓存。Second, and subtler: even a comment that merely restates what the code does lowers the reader's cognitive load. When reading Lua's stack-based API, a note after each call saying “the stack now holds a, b, c” saves the reader from maintaining the stack in their head. A comment is a cache for working memory.
- 他把注释分成几类:函数注释让 API 文档贴着代码,改的人顺手就更新,不会过期;设计注释在文件开头写清算法和取舍,证明简单是过程的结果而不是偷懒;Why 注释解释反直觉的约束;此外还有教学注释和检查清单。也有坏注释:废话、TODO 式的债、只是把代码抄一遍的「备份注释」。He sorts comments into kinds: function comments keep API docs next to the code so whoever changes it updates them and they cannot go stale; design comments at the top of a file state the algorithm and trade-offs, showing that simplicity came from process rather than laziness; why-comments explain counterintuitive constraints; plus teaching comments and checklists. There are bad kinds too: trivia, TODO-style debt, and “backup comments” that just copy the code.
- 关键不在写得多,而在写对位置:把将来最容易误解、最容易被顺手改坏的地方标出来。判断标准很实际——如果删掉这句注释,下一个聪明人会不会做错事?(原文发表于 2018 年)What matters is not volume but placement: mark the spots that will be misread or “helpfully” broken later. The test is practical — if this comment disappeared, would the next smart person do the wrong thing? (Originally published in 2018.)
- 写文件比多线程更难:崩溃可能留下「写了一半」的状态Files Are Harder Than Threads: A Crash Can Leave You Half-Written
- 起点是一个真实 bug:桌面邮件客户端会把邮箱弄坏。作者想弄清,为什么这么基础的「保存文件」会出错。It begins with a real bug: a desktop mail client corrupted its mailboxes. Luu wanted to know why something as basic as saving a file goes wrong.
- 场景:文件里原来是 “a foo”,你要改成 “a bar”。如果直接覆盖写,中途崩溃,磁盘上可能留下 “a boo” 或 “a far”——一半新一半旧。文件系统并不保证一次写是原子的。The scenario: a file contains “a foo” and you want “a bar.” Overwrite it directly and crash halfway, and the disk may hold “a boo” or “a far” — half new, half old. The filesystem does not promise that a write is atomic.
- 正确做法通常是「写临时文件 + fsync + rename」,但细节全是坑:rename 之后还要 fsync 父目录,否则崩溃后目录项可能没落盘;想在 rename 前保证内容真的写下去,还得 fsync 文件本身;OS X 上普通 fsync 不够,要 F_FULLFSYNC;有些磁盘为了跑分好看,直接忽略 flush。The usual fix is write-a-temp-file, fsync, rename — but every detail bites. After the rename you must fsync the parent directory or the entry may not survive a crash; to ensure the contents are really on disk before renaming, you must fsync the file; on OS X plain fsync is insufficient and you need F_FULLFSYNC; some drives ignore flush entirely to look good in benchmarks.
- ext3 的三种日志模式差别巨大:data=writeback 下数据和元数据没有顺序保证,崩溃后可能得到一个指向垃圾数据的文件,所以后来加了校验和。Pillai 等人在 OSDI'14 测了一圈,发现 LevelDB、HDFS、ZooKeeper、git、甚至 SQLite 都违反了文件系统的假设。ext3's three journaling modes differ enormously. Under data=writeback, data and metadata have no ordering guarantee, so a crash can leave a file pointing at garbage — which is why checksums were added later. Pillai et al. tested a range of systems at OSDI'14 and found that LevelDB, HDFS, ZooKeeper, git, and even SQLite violated filesystem assumptions.
- 最有趣的观察:文件 I/O 的错误类型和多线程一模一样——假设了两个操作的顺序,假设了某个操作原子。我们对内存序战战兢兢,对文件却随手 write。硬件手册会把内存序写得很精确,而 ext 的手册里有些行为只能靠「据说」。所以「文件很难」不是耸人听闻,是我们一直没拿它当并发问题看。(原文发表于 2015 年)The most interesting observation: file I/O fails in exactly the ways multithreaded code fails — assuming the order of two operations, assuming one operation is atomic. We treat memory ordering with terror and files with a casual write. Hardware manuals specify memory ordering precisely, while the ext manual describes some behavior as “rumoured.” Files are not hard because the claim is dramatic; they are hard because we have never treated them as a concurrency problem. (Originally published in 2015.)
- 十六年攒下的信任,一周就能卖掉Sixteen Years to Build Trust, One Week to Sell It
- 2015 年 5 月,SourceForge 开始接管现存项目的管理员账号,在 GIMP 这类安装包里塞广告软件——以前是项目自愿加入,那一次变成强制。Dan Luu 说这不是一次普通的商业权衡:SourceForge 花了十六年攒下的信任,在这一周里就没了。(原文发表于 2015 年)In May 2015 SourceForge began taking over admin accounts of existing projects and bundling adware into installers for packages like GIMP. Opt-in before; mandatory now. Dan Luu's point is not that this was a bad trade: sixteen years of trust were gone in a week. (Originally published in 2015.)
- 他算的是后果,不是道德。懂行的人以后不会再从 SourceForge 下载任何东西;如果搜索引擎因此给它降权,连不知情的新用户也拿不到。信任本来就是它全部的资产,而这项资产一旦变成负的,公司几乎什么都不剩。He counts consequences, not morals. Clueful people will never download from SourceForge again, and if search engines start penalizing it, even uninformed newcomers will not arrive. Trust was the whole asset, and once it turns negative there is almost nothing left of the company.
- 更值得看的是 Slashdot——它和 SourceForge 同属一家控股公司。整整一周,它是唯一没有报道这件事的大型科技站,因为每一条投稿都被压了下去。给出的解释是「编辑周末不在」;可下一周 nmap 的同类爆料出来时,同一位编辑当天就发了,理由站不住。The more interesting half is Slashdot, owned by the same holding company. For a full week it was the only major tech site with no story, because every submission was buried. The excuse was that editors were away for the weekend; the next week, when the nmap story broke, the same editor posted it the same day. The excuse does not survive that.
- 连措辞都在帮忙:Slashdot 的稿子写「修改过的二进制包」「附带的第三方优惠」,而不是「恶意软件」「广告软件」。财报显示这块业务收入在下滑、相关商誉已经减记为零,所以管理层「总得做点什么」——作者把这叫经典三段论:我们必须做点什么,这是点什么,所以必须做这个。Even the wording helped: Slashdot wrote about a “modified binary” offering “third party offers,” never malware or adware. Earnings showed this business shrinking and its goodwill written down to zero, so management had to do something — the classic syllogism, as Luu puts it: we must do something, this is something, therefore we must do this.
- 能带走两条:信任极度不对称,建起来要十几年,卖掉只要一个季度报表的压力;以及,一家媒体不报道什么,往往比它报道什么更能说明它现在归谁管。Two things to take away. Trust is brutally asymmetric: years to build, one quarter of earnings pressure to sell. And what an outlet will not publish usually says more about who owns it than what it does publish.
- 书呆子的凶劲:在被磨平之前,它是最值钱的东西Fierce Nerds: Before It Gets Sanded Down, That Edge Is Your Most Valuable Asset
- 格雷厄姆说,书呆子看起来怯,往往只是离开了自己的水域。真正的「凶书呆子」有几个共同点:极度好胜、过度自信、聪明、不随大流、没耐心。Nerds look diffident, Graham says, mostly when they are out of their element. Fierce nerds share a profile: extremely competitive, overconfident, intelligent, independent-minded, impatient.
- 他拿《双螺旋》里的沃森和克里克举例:他们不是最温和的科学家,反而咄咄逼人、抢速度、绕过礼貌的流程,最后赢了另外两个团队。那种凶劲不是人格缺陷,是研究的一部分。He points to Watson and Crick in The Double Helix. They were not the gentlest scientists; they were pushy, fast, and willing to skip polite procedure — and they beat two rival groups. The fierceness was not a personality flaw; it was part of the work.
- 凶劲也有坏结局:如果没有被用在难的事情上,它会发酵成怨气——脾气坏的运维、论坛喷子、职业黑子。能量还在,只是没有出口。Fierceness has a bad ending too. If it never gets pointed at something hard, it ferments into bitterness: the grumpy sysadmin, the forum troll, the professional hater. The energy is still there, with nowhere to go.
- 解药不是把刀磨钝,而是给它一件值得砍的东西:去做有野心的项目。做成事的满足感会中和那股酸。The cure is not to blunt the knife but to give it something worth cutting: work on ambitious projects. The satisfaction of making something neutralizes the acid.
- 他还给了一个乐观的宏观判断:权力正在持续从「会来事的人」转移到「会做事的人」身上。对书呆子来说,这是顺风;但顺风只帮已经在走的人。(原文发表于 2021 年)He adds an optimistic macro-claim: power keeps shifting from people who are good at dealing with people to people who are good at making things. That is a tailwind for nerds — but a tailwind only helps those already walking. (Originally published in 2021.)
哲学与生活Philosophy and Life
- 明知会失去,为什么还是要去爱Love Anyway: Why We Keep Loving What We Will Lose
- 文章一开头就把两件事摆在一起:生命的代价是死亡,爱的代价是失去。按这个算法,最理性的选择似乎是不去爱、不去依附。但作者说,结论恰恰相反——还是去爱。The essay puts two facts side by side from the first line: the price of life is death, and the price of love is loss. By that arithmetic the rational move looks like refusing to love, refusing to attach. The author draws the opposite conclusion: love anyway.
- 她引了 Louise Erdrich 的一段话:生活会把每个人打断骨头,孤独也一样会;你不能靠把自己锁起来避免心碎,那只会让心变硬。真正的选择不是「安全地活着」,而是「带着会碎的风险活着」。She quotes Louise Erdrich: life will break you, and so will solitude; you cannot protect your heart by locking it away, because that only makes it hard. The real choice is not between safety and risk, but between a life that can break and a life that has already closed.
- 接着是 Loren Eiseley 描述的一幕:一只渡鸦抓走了雏鸟,一群小鸟围过来,先是共同的哀鸣和抗议;然后一只麻雀试探着唱了一句,另一只跟上,最后它们在死亡的阴影下一起唱起来。作者说,它们是生命的歌者,不是死亡的。Then comes a scene from Loren Eiseley: a raven has taken a nestling, and the small birds gather around it, crying in a shared misery. Then one song sparrow ventures a note, another joins, and soon they are singing together in the shadow of death. They were the singers of life, he writes, and not of death.
- 这个论证的关键在于:爱不是「不会失去」的赌注,而是让短暂之物值得拥有的那种活动。歌声不是在否认渡鸦的存在,而是在渡鸦旁边继续。若把爱理解成投资回报,失去当然让一切归零;若把它理解成正在发生的经验,那么失去只是它的结尾,不是它的否定。The argument turns here: love is not a bet that loss will not happen, but the activity that makes transient things worth having. The song does not deny the raven; it continues beside the raven. Read love as an investment and loss zeroes it out; read it as an experience actually taking place and loss is only its ending, not its refutation.
- 所以问题不是「要不要爱」,而是「要不要承担爱的完整价格」。作者没有给安慰,只给了一个更清醒的选择:明知会失去,仍然选择去爱——这不是不理性,而是承认人本来就活在有限之中。So the question is not whether to love but whether to pay love's full price. There is no consolation on offer, only a clearer choice: to love knowing you will lose — not irrational, but an admission that we live inside limits.
工具角Tools Corner
- unref:用 Ruff 的解析器找 Python 死代码unref: Finding Dead Python Code with Ruff's Parser
- 用在什么地方:接手一个长了几年的 Python 项目,想知道哪些函数、类、变量已经没人用了,但又不敢只靠 grep——同名的 `parse` 在另一个模块里可能还在用。Where I would use it: taking over a Python project that has grown for years and wanting to know which functions, classes, and variables nobody uses anymore — without trusting grep, since a `parse` in another module may still be live.
- 省什么:vulture 这类工具慢且误报多;unref 复用 Ruff 的解析器,按模块作用域匹配名字,速度快到可以放进 pre-commit 或 CI,每次提交都跑。What it saves: tools like vulture are slow and noisy. unref reuses Ruff's parser and matches names per module scope, fast enough to run in pre-commit or CI on every commit.
- 怎么开始:`uvx unref .`(或安装后直接 `unref`),在 pyproject.toml 里按 Ruff 的风格配置忽略项;输出是 `src/utils.py:40:5: unused-function 'parse_date'` 这种可以直接跳转的格式。How to start: `uvx unref .` (or install it and run `unref`), then configure ignores in pyproject.toml in Ruff's style. Output looks like `src/utils.py:40:5: unused-function 'parse_date'`, clickable in most editors.
- 限制与维护:它只做静态的名字使用分析,动态调用(getattr、字符串导入、框架约定的钩子)要靠规则或忽略列表兜底;README 自称比 vulture 快 20 倍、扫完整个 CPython 不到一秒,但没有给出硬件和版本,所以这里只当项目自述,不当成我们的测量。Limits and upkeep: it is purely static name analysis, so dynamic calls (getattr, string imports, framework hooks) need rules or an ignore list. The README claims it is 20× faster than vulture and scans all of CPython in under a second, but gives no hardware or version details, so that stays the project's own claim rather than our measurement.
- rga:一条命令搜遍 PDF、docx 和压缩包rga: grep Through PDFs, Word Files, and Archives in One Command
- 用在什么地方:手边攒了一堆论文 PDF、epub、docx,还有几个 zip 里的源码快照,想找一句话,要么一个个打开,要么临时拼 pdftotext、unzip -p 的管道。Where I would use it: a folder of paper PDFs, epubs, docx files, and a few zipped source snapshots. I want one phrase; today I either open files one by one or improvise a pipeline of pdftotext and unzip -p.
- 省什么:rga 包着 ripgrep,按文件类型调用对应的适配器,先把非文本内容转成文本再交给 rg。于是一条 `rga 关键词 目录` 就能递归搜完所有格式,输出还是熟悉的 `文件:行号:内容`,可以直接跳转。What it saves: rga wraps ripgrep and dispatches each file type to an adapter that extracts text first, then hands it to rg. One `rga phrase folder` searches every format recursively and still prints the familiar `file:line:content`, so jumps and editor integration keep working.
- 怎么开始:从 release 下载 rga 二进制(或 `cargo install --locked ripgrep_all`、Arch 的 ripgrep-all、brew 的 rga),再装转换工具:ripgrep、pandoc、poppler-utils、ffmpeg。先跑 `rga --rga-list-adapters` 看这台机器支持哪些格式,然后 `rga TODO ~/papers`。How to start: grab the rga binary from releases (or `cargo install --locked ripgrep_all`, Arch's ripgrep-all, brew's rga), then install the converters: ripgrep, pandoc, poppler-utils, ffmpeg. Run `rga --rga-list-adapters` to see what this machine can handle, then `rga TODO ~/papers`.
- 限制:每种格式都靠外部工具转换,大 PDF 明显比纯文本慢;默认按扩展名选适配器,不确定时加 `--rga-accurate` 用 MIME 判断(更慢);邮件适配器默认关闭,要显式 `--rga-adapters=+mail`。它是 Rust 单二进制、crates.io 有包,但格式支持取决于你装没装 pandoc/poppler,换机器要先确认依赖。Limits: every format depends on an external converter, and large PDFs are much slower than plain text. Adapters are chosen by extension by default; add `--rga-accurate` to sniff MIME types instead (slower). The mail adapter is off unless you pass `--rga-adapters=+mail`. It is a single Rust binary on crates.io, but its format coverage is really the coverage of the pandoc/poppler you installed — check dependencies before relying on it on a new box.