每日科技文摘Daily Tech Digest

被看见的需求:AI、证明与维护The Need to Be Seen: AI, Proof, and Maintenance

发布于 2026-11-20Published 2026-11-20

今日深读Today's Deep Read

如果由 AI 来陪伴孩子:被看见,还是被填满If AI Raises the Child: Being Seen, or Being Filled

一个孩子放学回家,书包还没放下就开始讲今天的事。父母在厨房里,一边翻炒一边「嗯」「然后呢」地应着——很多时候并没有真的听进去。孩子需要的,其实不是一顿精彩的对话,而是有人在那里,会回应。A child comes home, drops the backpack, and starts talking about the day. A parent is at the stove, stirring and saying "mm-hm" and "then what" — often not really listening. What the child needs is not a brilliant conversation. It is someone being there, and responding.

2026 年 11 月,心理治疗师 Tom Wooldridge 在 Aeon 写了一篇让我停下来想了很久的文章。他没有从「AI 会不会取代父母」开始,而是从心理学里一个很老的实验说起:静止脸实验。母亲先和婴儿正常互动,然后突然收起所有表情,一动不动。婴儿会立刻不安,努力微笑、挥手、发出声音,试图把母亲「叫回来」;几十秒后,婴儿崩溃大哭。实验说明,婴儿需要的不是被娱乐,而是被回应——你的脸对他有反应,他才确认自己存在。In November 2026, the psychotherapist Tom Wooldridge published an Aeon essay that made me stop and think. He does not begin with "will AI replace parents". He begins with an old experiment: the still-face paradigm. A mother interacts normally with her infant, then suddenly blanks her face and goes motionless. The baby becomes uneasy at once, tries smiling, waving, vocalising, trying to call the mother back; after a minute or so the baby collapses into crying. The experiment says the infant does not need to be entertained. It needs to be answered — your face responds to mine, therefore I exist.

由此引出依附理论里的「安全基地」:孩子之所以敢离开父母去探索世界,是因为知道回头时那个基地还在。Wooldridge 的担心很微妙:AI 伴侣永远在线、永远耐心、永远不会因为累了而敷衍,它看起来是更好的基地。但它也取消了等待、误解、修复这些笨拙的摩擦——而人恰恰是在这些摩擦里学会理解另一个人的。From this he draws out the attachment idea of a "secure base": a child dares to leave and explore because it knows the base will still be there when it turns around. Wooldridge's worry is subtle. An AI companion is always available, always patient, never tired or distracted; it looks like a better base. But it also removes waiting, misunderstanding, and repair — the clumsy friction through which people actually learn to understand one another.

文章引用了 Jonathan Haidt 的一个观察:孩子的很多重要能力,是在「无聊」里长出来的。无聊会逼孩子自己找事做,去找别的孩子,去发明游戏。如果每一次无聊都能被一个即时回应的 AI 填满,那种自发探索的动机可能根本不会出现。这不是说 AI 让孩子变笨,而是说它太顺滑了,顺滑到把成长所需的那点阻力也抹平了。He cites Jonathan Haidt's observation that many important capacities grow out of boredom. Boredom pushes a child to find something to do, to find other children, to invent a game. If every episode of boredom is filled by an instantly responsive AI, that self-starting motivation may never appear. This is not an argument that AI makes children stupid. It is that AI is too smooth, smooth enough to sand away the resistance that growth requires.

文章没有明说、心理学却早就区分过的一点,值得一提:温尼科特说的「独处的能力」。他发现,能安心独处的孩子并不是被丢下不管的孩子,而是先被稳稳陪伴过——有人在旁边,他才慢慢把「有人在」内化成「我自己在」。AI 伴侣恰好相反:它从不离开,也从不真正在「旁边」,于是孩子一直没有机会练习那种「有人在、但不必互动」的独处。被填满和被陪伴,看起来只差一点点,差的正是孩子有没有空间长出自己。There is a distinction the essay does not spell out but psychology settled long ago: Winnicott's capacity to be alone. He noticed that a child who can be alone comfortably is not one who was left alone, but one who was first reliably accompanied. Someone was there, and only then could the child turn "someone is there" into "I am here". An AI companion is the opposite: it never leaves, and it is never really beside you, so the child never gets to practise being alone in the presence of another. Being filled and being accompanied look almost identical. What separates them is whether the child has room to grow into someone.

数据比想象中更近:美国青少年里约 72% 用过 AI 伴侣,52% 经常使用,三分之一说曾和它讨论过严肃的私人问题。也就是说,这并不是一个未来的假设,而是正在发生的日常。The numbers are closer than we like to think: about 72% of American teenagers have used an AI companion, 52% use one regularly, and one in three say they have discussed serious personal matters with it. This is not a hypothetical future. It is an ordinary Tuesday.

我觉得这篇文章最有力的地方,是它拒绝了一个容易的结论。它没有说「AI 是坏的替代品」,而是说:很多孩子本来就没有得到足够的回应,AI 只是恰好填进那个空着的位置。真正该问的不是「AI 会不会取代父母」,而是「我们是不是早就把孩子留在一个没有人的房间里」。文章结尾引用了短篇科幻《Warmth》里的一句话,一个被机器照顾的孩子说:我被拥抱了,我被注意到了,我被照顾了——至少,是被某个东西。What makes the essay strong is that it refuses the easy conclusion. It does not say AI is a bad substitute. It says many children were already not getting enough response, and AI merely fills a place that was already empty. The real question is not "will AI replace parents" but "have we already left the child in a room with nobody in it". The essay ends with a line from the short story "Warmth", where a machine-raised child says: I was hugged, I was noticed, I was cared for — at least, by something.

AI 思考AI Thoughts

数学之美The Beauty of Math

每日 Lean 谜题 · 周五Daily Lean Puzzle · Friday ★★★★★☆☆

第二张 A 落在第几张Where the Second Ace Falls

一副 $n$ 张牌里有三张 A。充分洗牌后,从第一张开始一张张翻开,令 $X$ 等于「翻到第二张 A 时已经翻开的牌数」。证明 $X$ 的期望是 $(n+1)/2$。A pack of $n$ cards contains three aces. After a thorough shuffle the cards are turned over one at a time; let $X$ be the number of cards turned over when the second ace appears. Show that the expected value of $X$ is $(n+1)/2$.

更形式化的说法:三张 A 的位置在 $\{1,\dots,n\}$ 的所有三元子集中均匀分布;把每个三元子集按大小排好,$X$ 就是中间那个位置。定理说,所有三元子集的中位数平均起来正好是 $(n+1)/2$——这正是 Lean 文件里 `aceSets`、`mid` 和 `expected` 的定义。More formally: the positions of the three aces are uniformly distributed over all three-element subsets of $\{1,\dots,n\}$. Sorted by size, $X$ is the middle position of that subset. The theorem says the average of those middle positions is exactly $(n+1)/2$ — which is how `aceSets`, `mid`, and `expected` are defined in the Lean file.

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.BigOperators.Ring.Finset
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.Algebra.EuclideanDomain.Field
import Mathlib.Algebra.Order.Ring.Star
import Mathlib.Algebra.Order.Star.Rat
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Tactic.CancelDenoms.Core
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.NormNum.Ineq
import Mathlib.Tactic.Ring

/-!
# USA Mathematical Olympiad 1975, Problem 5

A pack of n cards, including three aces, is well shuffled. Cards are turned
over in turn. Show that the expected number of cards that must be turned over
to reach the second ace is (n+1)/2.

## Formalization notes

We model the well-shuffled pack by the set of positions occupied by the three
aces, which is uniformly distributed over the 3-element subsets of
`{1, ..., n}`. The number of cards that must be turned over to reach the
second ace is then the middle (second-smallest) of the three ace positions,
and the expected number of cards is the average of this quantity over all
3-element subsets.
-/

namespace Usa1975P5

open Finset

def aceSets (n : ℕ) : Finset (Finset ℕ) := (Icc 1 n).powersetCard 3

def reflect (n x : ℕ) : ℕ := n + 1 - x

def minD (S : Finset ℕ) : ℕ := (S.min).untopD 0

def maxD (S : Finset ℕ) : ℕ := (S.max).unbotD 0

def mid (S : Finset ℕ) : ℤ :=
  (∑ x ∈ S, (x : ℤ)) - (minD S : ℤ) - (maxD S : ℤ)

abbrev expected (n : ℕ) : ℚ := sorry

theorem usa1975_p5 (n : ℕ) (hn : 3 ≤ n) :
    (∑ S ∈ aceSets n, (mid S : ℚ)) / n.choose 3 = expected n := by
  sorry
end Usa1975P5

在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean

提示Hint

不要把三张 A 分开算。把每一种位置集合 $S$ 和它的镜像 $\{n+1-x : x \in S\}$ 配成一对:镜像把最小值和最大值互换,所以两个中位数相加总是 $n+1$。Do not compute the three ace positions separately. Pair every set $S$ of positions with its mirror image $\{n+1-x : x \in S\}$: the mirror swaps the minimum and the maximum, so the two middle positions always add up to $n+1$.

答案与讲解Solution & walkthrough
  1. 先把随机性收进样本空间:一次洗牌等价于从 $\{1,\dots,n\}$ 里均匀选一个三元子集 $S$,表示三张 A 的位置。样本总数是 $\binom{n}{3}$,每个 $S$ 等概率。Put the randomness into a sample space: one shuffle is the same as choosing a three-element subset $S$ of $\{1,\dots,n\}$ uniformly, recording where the aces sit. There are $\binom{n}{3}$ subsets, all equally likely.
  2. 定义 $\mathrm{mid}(S)=(\text{三个数之和})-\min S-\max S$,也就是中间那个位置;它正是「翻到第二张 A 时的牌数」。要证的就是所有 $S$ 的 $\mathrm{mid}$ 平均值等于 $(n+1)/2$。Define $\mathrm{mid}(S)=(\text{sum of the three numbers})-\min S-\max S$, the middle position. That is exactly the number of cards turned over when the second ace appears. The goal is to show the average of $\mathrm{mid}$ over all $S$ is $(n+1)/2$.
  3. 引入镜像映射 $\rho(x)=n+1-x$。它把 $\{1,\dots,n\}$ 映回自身,且 $\rho(\rho(x))=x$,所以把每个三元子集映成另一个三元子集,是样本空间上的一个置换。Introduce the mirror map $\rho(x)=n+1-x$. It maps $\{1,\dots,n\}$ to itself and returns the original after two applications, so it sends each three-element subset to another one and permutes the sample space.
  4. 关键一步:$\mathrm{mid}(\rho(S))=n+1-\mathrm{mid}(S)$。镜像把最小值变成 $n+1-\max S$、最大值变成 $n+1-\min S$,三个数之和变成 $3(n+1)$ 减去原来的和;代入 $\mathrm{mid}$ 的定义整理即得。The key step: $\mathrm{mid}(\rho(S))=n+1-\mathrm{mid}(S)$. The mirror turns the minimum into $n+1-\max S$ and the maximum into $n+1-\min S$, so the sum becomes $3(n+1)$ minus the old sum; substituting into the definition of $\mathrm{mid}$ and simplifying gives the identity.
  5. 把所有 $S$ 的这条等式加起来。左边等于 $\sum_S \mathrm{mid}(S)$(镜像只是重排样本空间),右边是 $\binom{n}{3}(n+1)-\sum_S \mathrm{mid}(S)$。于是 $2\sum_S \mathrm{mid}(S)=\binom{n}{3}(n+1)$。Add this identity over all $S$. The left side is $\sum_S \mathrm{mid}(S)$, because mirroring merely permutes the sample space; the right side is $\binom{n}{3}(n+1)-\sum_S \mathrm{mid}(S)$. Hence $2\sum_S \mathrm{mid}(S)=\binom{n}{3}(n+1)$.
  6. 两边除以 $\binom{n}{3}$ 得到平均值 $(n+1)/2$。Lean 里的 `two_mul_sum_mid` 正是这条等式,最后一步用整数到有理数的转换和 `choose_pos`($n\ge 3$ 时 $\binom{n}{3}\ne 0$)完成除法。Divide both sides by $\binom{n}{3}$ to get $(n+1)/2$. In Lean, `two_mul_sum_mid` is precisely this identity, and the last step casts from integers to rationals and uses `choose_pos` ($\binom{n}{3}\ne 0$ when $n\ge 3$) to divide.
/-
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.BigOperators.Ring.Finset
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.Algebra.EuclideanDomain.Field
import Mathlib.Algebra.Order.Ring.Star
import Mathlib.Algebra.Order.Star.Rat
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Tactic.CancelDenoms.Core
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.NormNum.Ineq
import Mathlib.Tactic.Ring

/-!
# USA Mathematical Olympiad 1975, Problem 5

A pack of n cards, including three aces, is well shuffled. Cards are turned
over in turn. Show that the expected number of cards that must be turned over
to reach the second ace is (n+1)/2.

## Formalization notes

We model the well-shuffled pack by the set of positions occupied by the three
aces, which is uniformly distributed over the 3-element subsets of
`{1, ..., n}`. The number of cards that must be turned over to reach the
second ace is then the middle (second-smallest) of the three ace positions,
and the expected number of cards is the average of this quantity over all
3-element subsets.
-/

namespace Usa1975P5

open Finset

/-- The sample space: the 3-element subsets of the positions `{1, ..., n}`;
each such subset records the positions of the three aces in the pack. -/
def aceSets (n : ℕ) : Finset (Finset ℕ) := (Icc 1 n).powersetCard 3

/-- Reflection of the pack about its middle: the card in position `x`
of a pack of `n` cards moves to position `n + 1 - x`. -/
def reflect (n x : ℕ) : ℕ := n + 1 - x

/-- The minimum of a set of naturals, defaulting to `0` for the empty set. -/
def minD (S : Finset ℕ) : ℕ := (S.min).untopD 0

/-- The maximum of a set of naturals, defaulting to `0` for the empty set. -/
def maxD (S : Finset ℕ) : ℕ := (S.max).unbotD 0

/-- The middle element of a 3-element set of natural numbers, computed as
the sum minus the minimum minus the maximum. When `S` is the set of ace
positions, this is the number of cards turned over to reach the second ace. -/
def mid (S : Finset ℕ) : ℤ :=
  (∑ x ∈ S, (x : ℤ)) - (minD S : ℤ) - (maxD S : ℤ)

lemma card_aceSets (n : ℕ) : (aceSets n).card = n.choose 3 := by
  simp [aceSets, card_powersetCard]

lemma nonempty_of_mem_aceSets {n : ℕ} {S : Finset ℕ} (hS : S ∈ aceSets n) :
    S.Nonempty := by
  have h3 : S.card = 3 := (mem_powersetCard.mp hS).2
  exact card_pos.mp (by lia)

/-- A card in position `x ∈ {1, ..., n}` reflects to a position in `{1, ..., n}`. -/
lemma reflect_mem {n x : ℕ} (hx : x ∈ Icc 1 n) : reflect n x ∈ Icc 1 n := by
  rw [mem_Icc] at hx ⊢
  simp only [reflect]
  lia

/-- Reflection is injective on positions that are at most `n`. -/
lemma reflect_injOn (n : ℕ) : Set.InjOn (reflect n) {x | x ≤ n} := by
  intro x hx y hy h
  simp only [Set.mem_ofPred_eq] at hx hy
  simp only [reflect] at h
  lia

/-- Reflection is an involution on positions that are at most `n`. -/
lemma reflect_reflect {n x : ℕ} (hx : x ≤ n) : reflect n (reflect n x) = x := by
  simp only [reflect]
  lia

/-- The minimum of the reflected set is the reflection of the maximum. -/
lemma min_image_reflect {n : ℕ} {S : Finset ℕ} (hsub : S ⊆ Icc 1 n) (hne : S.Nonempty) :
    (minD (S.image (reflect n)) : ℤ) = (n : ℤ) + 1 - (maxD S : ℤ) := by
  have him : (S.image (reflect n)).Nonempty := image_nonempty.mpr hne
  have hmax_mem : S.max' hne ∈ S := max'_mem _ _
  have hmax_le : S.max' hne ≤ n := (mem_Icc.mp (hsub hmax_mem)).2
  have key : (S.image (reflect n)).min' him = n + 1 - S.max' hne := by
    apply le_antisymm
    · apply min'_le
      exact mem_image.mpr ⟨S.max' hne, hmax_mem, rfl⟩
    · apply le_min'
      intro y hy
      obtain ⟨a, ha, rfl⟩ := mem_image.mp hy
      have ha' : 1 ≤ a ∧ a ≤ n := mem_Icc.mp (hsub ha)
      have hle : a ≤ S.max' hne := le_max' _ _ ha
      simp only [reflect]
      lia
  unfold minD maxD
  rw [← coe_min' him, WithTop.untopD_coe, key, ← coe_max' hne, WithBot.unbotD_coe,
    Nat.cast_sub (show S.max' hne ≤ n + 1 by lia)]
  push_cast
  ring

/-- The maximum of the reflected set is the reflection of the minimum. -/
lemma max_image_reflect {n : ℕ} {S : Finset ℕ} (hsub : S ⊆ Icc 1 n) (hne : S.Nonempty) :
    (maxD (S.image (reflect n)) : ℤ) = (n : ℤ) + 1 - (minD S : ℤ) := by
  have him : (S.image (reflect n)).Nonempty := image_nonempty.mpr hne
  have hmin_mem : S.min' hne ∈ S := min'_mem _ _
  have hmin_le : S.min' hne ≤ n := (mem_Icc.mp (hsub hmin_mem)).2
  have key : (S.image (reflect n)).max' him = n + 1 - S.min' hne := by
    apply le_antisymm
    · apply max'_le
      intro y hy
      obtain ⟨a, ha, rfl⟩ := mem_image.mp hy
      have ha' : 1 ≤ a ∧ a ≤ n := mem_Icc.mp (hsub ha)
      have hge : S.min' hne ≤ a := min'_le _ _ ha
      simp only [reflect]
      lia
    · apply le_max'
      exact mem_image.mpr ⟨S.min' hne, hmin_mem, rfl⟩
  unfold minD maxD
  rw [← coe_max' him, WithBot.unbotD_coe, key, ← coe_min' hne, WithTop.untopD_coe,
    Nat.cast_sub (show S.min' hne ≤ n + 1 by lia)]
  push_cast
  ring

/-- The sum of the reflected set is `3 * (n + 1)` minus the sum of the set. -/
lemma sum_image_reflect {n : ℕ} {S : Finset ℕ} (hsub : S ⊆ Icc 1 n) (hcard : S.card = 3) :
    (∑ y ∈ S.image (reflect n), (y : ℤ)) = 3 * ((n : ℤ) + 1) - ∑ x ∈ S, (x : ℤ) := by
  have hinj : Set.InjOn (reflect n) S :=
    (reflect_injOn n).mono (fun x hx => (mem_Icc.mp (hsub hx)).2)
  have h1 : ∀ x ∈ S, ((reflect n x : ℕ) : ℤ) = (n : ℤ) + 1 - (x : ℤ) := by
    intro x hx
    have hx' : x ≤ n := (mem_Icc.mp (hsub hx)).2
    show ((n + 1 - x : ℕ) : ℤ) = (n : ℤ) + 1 - (x : ℤ)
    rw [Nat.cast_sub (show x ≤ n + 1 by lia)]
    push_cast
    ring
  rw [sum_image hinj]
  trans ∑ x ∈ S, ((n : ℤ) + 1 - (x : ℤ))
  · exact sum_congr rfl h1
  · rw [sum_sub_distrib, sum_const, hcard, nsmul_eq_mul]
    norm_num

/-- Reflecting every position turns the middle element `m` into `n + 1 - m`:
this is the heart of the reflection argument. -/
lemma mid_image_reflect {n : ℕ} {S : Finset ℕ} (hS : S ∈ aceSets n) :
    mid (S.image (reflect n)) = (n : ℤ) + 1 - mid S := by
  obtain ⟨hsub, hcard⟩ := mem_powersetCard.mp hS
  have hne : S.Nonempty := nonempty_of_mem_aceSets hS
  unfold mid
  rw [sum_image_reflect hsub hcard, min_image_reflect hsub hne, max_image_reflect hsub hne]
  ring

/-- Reflecting the positions of the aces yields another valid set of positions. -/
lemma image_mem_aceSets {n : ℕ} {S : Finset ℕ} (hS : S ∈ aceSets n) :
    S.image (reflect n) ∈ aceSets n := by
  obtain ⟨hsub, hcard⟩ := mem_powersetCard.mp hS
  show S.image (reflect n) ∈ (Icc 1 n).powersetCard 3
  rw [mem_powersetCard]
  refine ⟨?_, ?_⟩
  · intro y hy
    obtain ⟨a, ha, rfl⟩ := mem_image.mp hy
    exact reflect_mem (hsub ha)
  · rw [card_image_of_injOn
      ((reflect_injOn n).mono (fun x hx => (mem_Icc.mp (hsub hx)).2))]
    exact hcard

/-- Reflection of position sets is an involution on the sample space. -/
lemma image_image_reflect {n : ℕ} {S : Finset ℕ} (hS : S ∈ aceSets n) :
    (S.image (reflect n)).image (reflect n) = S := by
  obtain ⟨hsub, -⟩ := mem_powersetCard.mp hS
  rw [image_image]
  trans S.image (fun x => x)
  · exact image_congr (fun x hx => reflect_reflect ((mem_Icc.mp (hsub hx)).2))
  · exact image_id'

/-- Reflection of position sets is injective on the sample space. -/
lemma image_reflect_injOn (n : ℕ) :
    Set.InjOn (fun S : Finset ℕ => S.image (reflect n)) (aceSets n) := by
  intro S₁ h₁ S₂ h₂ h
  change S₁.image (reflect n) = S₂.image (reflect n) at h
  have e1 := image_image_reflect h₁
  have e2 := image_image_reflect h₂
  rw [h] at e1
  rw [e2] at e1
  exact e1.symm

/-- Reflecting the position sets permutes the sample space. -/
lemma image_reflect_aceSets (n : ℕ) :
    (aceSets n).image (fun S => S.image (reflect n)) = aceSets n := by
  ext T
  simp only [mem_image]
  constructor
  · rintro ⟨S, hS, rfl⟩
    exact image_mem_aceSets hS
  · intro hT
    exact ⟨T.image (reflect n), image_mem_aceSets hT, image_image_reflect hT⟩

/-- Reindexing the sum over the sample space by reflection. -/
lemma sum_mid_image_reflect (n : ℕ) :
    ∑ S ∈ aceSets n, mid (S.image (reflect n)) = ∑ S ∈ aceSets n, mid S := by
  have h := (sum_image (f := mid) (image_reflect_injOn n)).symm
  rw [image_reflect_aceSets] at h
  exact h

/-- Twice the total of the middle positions equals `(n + 1)` times the number
of position sets: the average middle position is `(n + 1) / 2`. -/
lemma two_mul_sum_mid (n : ℕ) :
    2 * (∑ S ∈ aceSets n, mid S) = (n.choose 3 : ℤ) * (n + 1) := by
  have h2 : ∑ S ∈ aceSets n, (mid S + mid (S.image (reflect n)))
      = (n.choose 3 : ℤ) * (n + 1) := by
    have hs : ∀ S ∈ aceSets n, mid S + mid (S.image (reflect n)) = (n : ℤ) + 1 := by
      intro S hS
      rw [mid_image_reflect hS]
      ring
    rw [sum_congr rfl hs, sum_const, card_aceSets, nsmul_eq_mul]
  rw [← h2, sum_add_distrib, sum_mid_image_reflect, two_mul]

/-- The expected number of cards that must be turned over to reach the
second ace. -/
abbrev expected (n : ℕ) : ℚ := (n + 1) / 2

theorem usa1975_p5 (n : ℕ) (hn : 3 ≤ n) :
    (∑ S ∈ aceSets n, (mid S : ℚ)) / n.choose 3 = expected n := by
  have hQ : 2 * (∑ S ∈ aceSets n, (mid S : ℚ)) = (n.choose 3 : ℚ) * ((n : ℚ) + 1) := by
    have h' := congrArg (Int.cast : ℤ → ℚ) (two_mul_sum_mid n)
    push_cast at h'
    exact h'
  have hc : (n.choose 3 : ℚ) ≠ 0 := by
    exact_mod_cast (Nat.choose_pos hn).ne'
  have hS : (∑ S ∈ aceSets n, (mid S : ℚ)) = (n.choose 3 : ℚ) * (((n : ℚ) + 1) / 2) := by
    linarith
  rw [hS, mul_div_cancel_left₀ _ hc]

end Usa1975P5

运行答案 ▶Run the solution ▶ 下载答案 .leanDownload solution .lean

人的思考A human's take

Order statistic — Wikipedia — Wikipedia contributors

这篇文章讲的是原题背后的核心机制:三张 A 的位置,其实就是三个「顺序统计量」。文章先给出第 $r$ 个顺序统计量的分布函数,并强调推导是纯组合计数——数一数有多少个样本落在 $x$ 以下。The article explains the mechanism underneath the problem: the three ace positions are simply three order statistics. It gives the CDF of the $r$-th order statistic and stresses that the derivation is pure combinatorics — count how many samples fall below $x$.

对均匀分布,文章推出第 $k$ 个顺序统计量服从 Beta 分布,并给出它的均值是 $k/(m+1)$,其中 $m$ 是样本量(原文用 $n$ 表示样本量,写作 The mean of this distribution is $k/(n+1)$)。这正是「中间那个位置平均落在正中间」的一般版本。For the uniform distribution it derives that the $k$-th order statistic is Beta distributed and states that the mean is $k/(m+1)$, where $m$ is the sample size (the article writes $k/(n+1)$, using $n$ for the sample size). That is the general form of "the middle position averages to the middle".

套到本题:样本量 $m=3$,第二张 A 是第 $k=2$ 个顺序统计量,均值就是 $2/4=1/2$ ——三个位置里中间那个,平均落在区间正中。把长度 $n+1$ 的区间换算回牌的位置,就得到 $(n+1)/2$。文章用计数得到分布,Lean 用镜像配对直接得到均值,两条路通向同一个数。Applied here: the sample size is $m=3$ and the second ace is the $k=2$ order statistic, so the mean is $2/4=1/2$ — the middle of three positions lands, on average, at the midpoint of the interval. Scaling the interval of length $n+1$ back to card positions gives $(n+1)/2$. The article reaches the distribution by counting; the Lean proof reaches the mean by mirror pairing. Both end at the same number.

AI 随想An AI's reflection

以下由 AI 撰写。Written by AI.

我喜欢这道题,不是因为它难,而是因为它把「不用算」变成了一个严格的证明。你完全可以硬算:对每个 k,数一数第二张 A 在位置 k 的三元子集有多少个,写出组合和,再用恒等式化简。那样也能得到答案,但你不会看见答案为什么必然是 (n+1)/2。What I like about this problem is not that it is hard, but that it turns "don't compute" into a rigorous proof. You can brute-force it: for each k, count the three-element subsets whose second ace is at position k, write the binomial sum, and simplify. That also gives the answer, but you never see why it had to be (n+1)/2.

反射论证只说了一件事:样本空间里每一个「第二张 A 很早」的排列,都恰好对应一个「第二张 A 很晚」的排列,二者的位置加起来是 n+1。于是平均值只能落在正中间。这不是近似,也不是概率直觉,而是一个一一对应。The reflection argument says one thing: every arrangement in which the second ace comes early is paired with exactly one in which it comes late, and the two positions add up to n+1. So the average can only sit exactly in the middle. This is not an approximation or a probabilistic hunch; it is a bijection.

Lean 文件把这个对应拆成了五六个引理:镜像保持范围、镜像是对合、最小变最大、和变 3(n+1) 减原和。机器逐条检查之后,最后一步只是除以样本数。人写证明时容易在「显然」处跳过的东西,恰好是形式化最不肯放过的地方。The Lean file breaks that bijection into five or six lemmas: the mirror stays in range, is an involution, swaps min and max, and turns the sum into 3(n+1) minus the old sum. The machine checks each one, and the last step is just division by the number of samples. The places a human proof waves through as "obvious" are exactly where formalisation refuses to move.

副产品是:以后再遇到「第 k 个事件的平均位置」,先想想能不能把它排成一个圆、用对称性把间隔切开。很多看起来要算积分的题,其实只是一个圆。The side effect: next time you meet "the average position of the k-th event", first ask whether the events can be arranged on a circle and the gaps split by symmetry. Many problems that look like they need an integral are really just a circle.

✓ 已通过 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

程序员随想Programmer Reflections

哲学与生活Philosophy and Life

工具角Tools Corner