返回资讯中心
外部精选
软件工程
#开发者实时流

Lean 4 机器验证嵌套圆角矩形半径法则 R = r + d

来源标题:radius-proof: proof that nested rounded rectangles need R = R and d

研究者用 Lean 4 和 Mathlib 机器验证了嵌套圆角矩形的圆角半径法则:若内层圆角半径为 r 的圆角矩形被外层形状以均匀间距 d 包裹,则外层圆角半径 R 必须等于 r + d,其他取值都不成立。证明将平面建模为 ℂ,把圆角矩形表示为核心矩形与闭圆盘的 Minkowski 和,并附带 LIPIcs 排版的论文。

Hacker News 最新bpierre2026/11/25 · 今天6 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

A machine-checked proof, in Lean 4 and Mathlib, of the corner-radius law for nested rounded rectangles:

If a rounded rectangle with corner radius $r$ sits inside another rounded rectangle with a uniform gap $d$ on every side, the outer corner radius $R$ must be $r + d$. No other radius works.

(a) With $R = r + d$, both corner arcs share a centre and the gap is $d$ everywhere. (b) With equal radii, the gap along the corner diagonal grows to $d\sqrt{2}$.

The accompanying paper is paper/radius.pdf. It is typeset with the LIPIcs class (lipics-v2021.cls, distributed under the LPPL), which is included in paper/.

The plane is modelled as ℂ, which carries the Euclidean norm. A rounded rectangle with half-width a, half-height b and corner radius r is the Minkowski sum of its core rectangle [-(a - r), a - r] × [-(b - r), b - r] with the closed disc of radius r. The parameters are admissible when 0 ≤ r ≤ min a b. One shape surrounds another with uniform gap d when it is the other's closed d-neighbourhood (Metric.cthickening d).

theorem nested_radius_theorem (h : Admissible a b r) (hd : 0 ≤ d) (hO : Admissible A B R) : roundedRect A B R = cthickening d (roundedRect a b r) ↔ A = a + d ∧ B = b + d ∧ R = r + d

Results

Theorem File Statement

cthickening_roundedRect Offset.lean The d-neighbourhood of a rounded rectangle of radius r is the rounded rectangle of radius r + d.

roundedRect_inj Uniqueness.lean An admissible rounded rectangle determines its half-width, half-height and radius.

nested_radius_theorem Main.lean The characterisation above.

outer_radius_eq / inner_radius_eq Main.lean R = r + d, equivalently r = R - d.

equal_radii_iff Main.lean Giving both shapes the same radius produces a uniform gap only when d = 0.

gap_le_outer_radius Main.lean If R < d, no inner rounded rectangle has a uniform gap d to the outer one.

The development contains no sorry. #print axioms reports only propext, Classical.choice and Quot.sound for every theorem.

lake exe cache get # download prebuilt Mathlib lake build lake env lean AxiomCheck.lean

To rebuild the paper and the README figures (requires Tectonic):

cd paper && tectonic radius.tex cd ../figures && tectonic nested-light.tex && tectonic nested-dark.tex

The figures are converted from PDF to SVG with PyMuPDF (page.get_svg_image()).

The Lean development and the paper are released under the MIT license. The LIPIcs class files in paper/ are distributed under their own license (LPPL 1.3c).

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →