逐步主鏈
S01 · definition
操作前
f(n)=3n^2+5n+2,\ g(n)=n^2,\ h(n)=n
操作後
f(n)>0,\ g(n)\ge 0,\ h(n)\ge 0\ \text{for all}\ n\ge 0條件:n\in\mathbb{N}
規則:def_intro · 依賴:G1, G2, G3
葉節點依據:def_intro + square_nonneg + order_basics
命名三個函數並確認 MKO 要求的非負性:n≥0 時 n²≥0,所以 3n²≥0、5n≥0,再加上 2>0 得 f(n)>0;g(n)=n²≥0;h(n)=n≥0。成本模型與輸入大小已隨 f 宣告(G2),之後只比較這個宣告下的函數。
S02 · equivalent
操作前
f\in O(g)
操作後
\exists c>0\ \exists N\in\mathbb{N}\ \forall n\ge N,\ f(n)\le c\,g(n)條件:無
規則:def_unfold · 依賴:S01, mko_asymptotic_def
葉節點依據:def_unfold + mko_asymptotic_def
展開大 O 的定義:要找到一對 witness (c,N),使從 N 起的整個尾段都滿足 f(n)≤c·g(n)。量詞順序是「存在 c、N,對所有 n」:c 與 N 不可依賴 n。Ω 的定義把 ≤ 換成 ≥,Θ 要求兩者都成立。
S03 · theorem_application
操作前
n\in\mathbb{N},\ n\ge 1操作後
1\le n\le n^2
條件:n\ge 1
規則:L_n_le_nsq · 依賴:G1
葉節點依據:order_basics + distributive
套用引理 L_n_le_nsq(在 S03.1、S03.2 證明):n≥1 時 1≤n≤n²。這讓低次項 5n 與常數 2 都能用 n² 控制。
S04 · implies
操作前
n\le n^2,\ 1\le n^2\ (n\ge 1)
操作後
5n\le 5n^2,\ 2\le 2n^2\ (n\ge 1)
條件:n\ge 1; 5>0,\ 2>0
規則:order_basics · 依賴:S03
葉節點依據:order_basics
把 n≤n² 兩邊乘以正數 5,把 1≤n² 兩邊乘以正數 2;乘以正數保持不等式方向。
S05 · implies
操作前
f(n)=3n^2+5n+2
操作後
f(n)\le 3n^2+5n^2+2n^2=10n^2\quad(n\ge 1)
條件:n\ge 1
規則:order_basics · 依賴:S04
葉節點依據:order_basics + distributive + add_assoc
把 S04 的兩個不等式與 3n²=3n² 相加(不等式同向相加),得 f(n)≤10n²,對每個 n≥1 成立。等價地,10n²−f(n)=5n(n−1)+2(n²−1),兩項在 n≥1 時都非負(N1 以多項式恆等式核對)。
S06 · implies
操作前
\forall n\ge 1,\ f(n)\le 10\,g(n)
操作後
f\in O(g)\ \text{with witness}\ (c,N)=(10,1)條件:10>0
規則:exists_intro · 依賴:S05, S02
葉節點依據:exists_intro + forall_intro
S05 對任意 n≥1 證明,沒有額外假設,所以依全稱推廣對整個尾段 n≥1 成立。取 c=10>0、N=1,依 ∃引入與 S02 的等價,f∈O(g)。
S07 · implies
操作前
n=0
操作後
f(0)=2>0=c\cdot g(0)\ \text{for every}\ c>0條件:無
規則:numeric_evaluation · 依賴:G2, G3
葉節點依據:numeric_evaluation + mul_zero
門檻的作用:f(0)=2,而 g(0)=0,所以對任何 c>0 都有 f(0)>c·g(0)。因此任何以 N=0 為門檻的 O witness 都不存在;N=1 把這個有限前綴排除在外。MKO 所說「有限前綴被吸收到 witness 中」就是這個意思。
S08 · implies
操作前
f(n)-3g(n)=5n+2
操作後
f(n)\ge 3\,g(n)\ \forall n\ge 0\ \Rightarrow\ f\in\Omega(g)\ \text{with}\ (c,N)=(3,0)條件:n\ge 0
規則:exists_intro · 依賴:S01, mko_asymptotic_def
葉節點依據:exists_intro + order_basics + def_unfold
展開 Ω:需要 c>0、N 使 n≥N 時 f(n)≥c·g(n)。計算 f(n)−3n²=5n+2,n≥0 時它 ≥2>0,所以 f(n)≥3g(n) 對所有 n≥0 成立。取 c=3、N=0,得 f∈Ω(g)。下界的 witness 可以從 0 起,因為 g(0)=0 不構成障礙。
S09 · implies
操作前
f\in O(g),\ f\in\Omega(g)
操作後
f\in\Theta(g)=\Theta(n^2)
條件:無
規則:and_intro_elim · 依賴:S06, S08, mko_asymptotic_def
葉節點依據:and_intro_elim + mko_asymptotic_def
依 MKO 定義,Θ 要求 O 與 Ω 同時成立。兩者分別由 S06 與 S08 證得,所以 f∈Θ(n²)。兩個 witness 不必相同:上界用 (10,1),下界用 (3,0)。
S10 · implies
操作前
4n^2-f(n)=n^2-5n-2=n(n-5)-2
操作後
n\ge 6\Rightarrow 4n^2-f(n)\ge 4>0;\quad n=5:\ f(5)=102>100=4\cdot 25
條件:n\ge 6
規則:exists_intro · 依賴:S02
葉節點依據:exists_intro + order_basics + distributive
另一組 witness:c=4、N=6。4n²−f(n)=n²−5n−2=n(n−5)−2(N4 核對恆等式)。子步 S10.1 證明 n≥6 時它 ≥4。所以 (4,6) 也是 O 的 witness。但 n=5 時 f(5)=102>100:用較小的 c,就需要較大的 N。witness 不唯一,有限個例外點由 N 吸收。
S11 · implies
操作前
f(n)-3n^2=5n+2>0\ \forall n
操作後
\neg\exists N\ \forall n\ge N,\ f(n)\le 3\,g(n)
條件:無
規則:quantifier_negation · 依賴:S08
葉節點依據:quantifier_negation + order_basics
對每個 n,f(n)−3n²=5n+2≥2>0,所以 f(n)≤3g(n) 從不成立。無論 N 取多大,n=N 就是反例,所以 c=3 不能作為 O 的常數。定義只要求「存在某個 c」,不是「每個 c 都行」;常數因子要由 witness 吸收,但不能任意小。
S12 · implies
操作前
\text{assume}\ \exists c>0\ \exists N\ \forall n\ge N,\ f(n)\le c\,n操作後
\text{contradiction, so}\ f\notin O(h)條件:無
規則:contradiction · 依賴:S02, G3
葉節點依據:contradiction + archimedean + order_basics
反證:假設有 witness (c,N) 使 n≥N 時 f(n)≤c·n。S12.1 構造一個 n≥N 且 n>c;S12.2 證明此 n 滿足 f(n)>c·n,與假設矛盾。所以沒有任何 witness,f∉O(n)。
S13 · implies
操作前
f(n)\ge 5n\ge n\ (n\ge 0),\ f\notin O(h)
操作後
f\in\Omega(n),\ f\notin O(n),\ f\notin\Theta(n)
條件:無
規則:and_intro_elim · 依賴:S12, S01, mko_asymptotic_def
葉節點依據:and_intro_elim + exists_intro + order_basics
n≥0 時 f(n)=3n²+5n+2≥5n≥n,所以 (c,N)=(1,0) 是 Ω(n) 的 witness,f∈Ω(n)。但 S12 已證 f∉O(n)。Θ(n) 要求兩者兼具,所以 f∉Θ(n)。這說明 O、Ω、Θ 不能互換:同一個 f 對 n 有下界卻沒有上界。
局部子步與引理
S03.1 · implies
操作前
n\ge 1
操作後
n^2-n=n(n-1)\ge 0,\ \text{so}\ n\le n^2條件:n\ge 1
規則:order_basics · 依賴:order_basics, distributive
葉節點依據:order_basics + distributive + add_inverse
n≥1 給出 n−1≥0 且 n≥0。兩個非負數相乘仍非負(由 0≤n−1 乘以 n≥0),所以 n(n−1)≥0。依分配律 n(n−1)=n²−n,故 n²−n≥0,兩邊加 n 得 n≤n²。
S03.2 · implies
操作前
1\le n,\ n\le n^2
操作後
1\le n\le n^2
條件:無
規則:order_basics · 依賴:S03.1, order_basics
葉節點依據:order_basics
把假設 1≤n 與 S03.1 的 n≤n² 串起來,依傳遞得 1≤n≤n²,特別地 1≤n²。S03.1 與 S03.2 合起來證得 L_n_le_nsq。
S10.1 · implies
操作前
n\ge 6
操作後
n-5\ge 1,\ n(n-5)\ge n\ge 6,\ n(n-5)-2\ge 4
條件:n\ge 6
規則:order_basics · 依賴:order_basics
葉節點依據:order_basics
n≥6 給出 n−5≥1。把 n−5≥1 兩邊乘以正數 n,得 n(n−5)≥n≥6。兩邊減 2,得 n(n−5)−2≥4>0。
S12.1 · implies
操作前
c>0,\ N\in\mathbb{N}操作後
n=\max(n_0,N,1)\ \text{with}\ n_0>c:\ n\ge N,\ n>c,\ n\ge 1條件:無
規則:archimedean · 依賴:archimedean
葉節點依據:archimedean + order_basics
依阿基米德性質,存在自然數 n0>c。令 n=max(n0,N,1),則 n≥N、n≥n0>c,且 n≥1>0。
S12.2 · implies
操作前
n>c,\ n\ge 1
操作後
f(n)\ge 3n^2\ge n^2=n\cdot n>c\cdot n
條件:無
規則:order_basics · 依賴:S12.1, S03, order_basics
葉節點依據:order_basics + square_nonneg
f(n)=3n²+5n+2≥3n²≥n²(因 5n+2≥0 與 2n²≥0)。由 c<n 兩邊乘以正數 n 得 c·n<n·n=n²。串起來 f(n)>c·n。但 n≥N,假設給 f(n)≤c·n,矛盾。