/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
module
public import FormalConjecturesUtilMoving Sofa Problem
References:
[Ge92] Gerver, J. L., On moving a sofa around a corner. Geometriae Dedicata 42.3 (1992): 267-283.
[Ro18] Romik, D. Differential equations and exact solutions in the moving sofa problem. Experimental mathematics 27.3 (2018): 316-330.
[Ba24] Baek, J. Optimality of Gerver's Sofa. arXiv preprint arXiv:2411.19826 (2024).
@[expose] public sectionnoncomputable sectionnamespace MovingSofaopen Topologyopen scoped Real unitInterval EuclideanGeometryThe horizontal side of the hallway is $(-\infty, 1] \times [0, 1]$.
def horizontalHallway : Set ℝ² := {!2[x, y] | (x) (y) (_ : x ≤ 1 ∧ 0 ≤ y ∧ y ≤ 1)}The vertical side of the hallway is $[0, 1] \times (-\infty, 1]$.
def verticalHallway : Set ℝ² := {!2[x, y] | (x) (y) (_ : 0 ≤ x ∧ x ≤ 1 ∧ y ≤ 1)}The hallway is the union of its horizontal and vertical sides.
def hallway : Set ℝ² := horizontalHallway ∪ verticalHallwayscoped notation "E(2)" => ℝ² ≃ᵃⁱ[ℝ] ℝ²instance : TopologicalSpace E(2) :=
.induced (·.toAffineIsometry.toContinuousAffineMap) inferInstanceA connected closed set $s$ is a moving sofa according to a rigid motion $m:I\to\mathrm{SE}(2)$, if the sofa is initially in the horizontal side of the hallway and ends up in the vertical side. Here, since $\mathrm{SE}(2)$ is not in Mathlib yet, we use $\mathrm{E}(2)$ and rely on continuity and $m(0) = \mathrm{id}$ to ensure $m$ is in $\mathrm{SE}(2)$.
structure IsMovingSofa (s : Set ℝ²) (m : I → E(2)) : Prop where
isConnected : IsConnected s
isClosed : IsClosed s
continuous : Continuous m
zero : m 0 = .refl ℝ ℝ²
initial : s ⊆ horizontalHallway
subset_hallway : ∀ t, m t '' s ⊆ hallway
final : m 1 '' s ⊆ verticalHallwayThe unit square.
def unitSquare : Set ℝ² := parallelepiped (EuclideanSpace.basisFun (Fin 2) ℝ)
Coordinates of points in the unit square lie in [0,1].
p:ℝ²hp:p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1}i:Fin 2h:parallelepiped ⇑(EuclideanSpace.basisFun (Fin 2) ℝ).toBasis =
{x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1}⊢ p.ofLp i ∈ Set.Icc 0 1
simpa using hp i All goals completed! 🐙
The unit square $[0,1]^2$ is a valid moving sofa (with the identity motion).
It sits in the corner where both hallways overlap, so the stationary motion works.
This is a sanity check that the IsMovingSofa definition is not vacuous.
@[category test, AMS 49]
theorem isMovingSofa_unitSquare : ∃ m, IsMovingSofa unitSquare m := by ⊢ ∃ m, IsMovingSofa unitSquare m
refine ⟨fun _ => .refl ℝ ℝ², ?_, ?_, continuous_const, rfl, ?_, ?_, ?_⟩ refine_1 ⊢ IsConnected unitSquarerefine_2 ⊢ IsClosed unitSquarerefine_3 ⊢ unitSquare ⊆ horizontalHallwayrefine_4 ⊢ ∀ (t : ↑I), ⇑(AffineIsometryEquiv.refl ℝ ℝ²) '' unitSquare ⊆ hallwayrefine_5 ⊢ ⇑(AffineIsometryEquiv.refl ℝ ℝ²) '' unitSquare ⊆ verticalHallway
· refine_1 ⊢ IsConnected unitSquare unfold unitSquare parallelepiped refine_1 ⊢ IsConnected ((fun t ↦ ∑ i, t i • (EuclideanSpace.basisFun (Fin 2) ℝ) i) '' Set.Icc 0 1)
refine ⟨⟨0, 0, by ⊢ 0 ∈ Set.Icc 0 1 simp All goals completed! 🐙, by ⊢ (fun t ↦ ∑ i, t i • (EuclideanSpace.basisFun (Fin 2) ℝ) i) 0 = 0 simp All goals completed! 🐙⟩, (convex_Icc _ _).isPreconnected.image _ ?_⟩
exact (continuous_finsetSum _ fun i _ =>
(continuous_apply i).smul continuous_const).continuousOn All goals completed! 🐙
· refine_2 ⊢ IsClosed unitSquare unfold unitSquare parallelepiped refine_2 ⊢ IsClosed ((fun t ↦ ∑ i, t i • (EuclideanSpace.basisFun (Fin 2) ℝ) i) '' Set.Icc 0 1)
exact (isCompact_Icc.image
(continuous_finsetSum _ fun i _ =>
(continuous_apply i).smul continuous_const)).isClosed All goals completed! 🐙
· refine_3 ⊢ unitSquare ⊆ horizontalHallway intro p hp refine_3 p:ℝ²hp:p ∈ unitSquare⊢ p ∈ horizontalHallway
have h0 := mem_Icc_of_mem_unitSquare hp 0 refine_3 p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1⊢ p ∈ horizontalHallway
have h1 := mem_Icc_of_mem_unitSquare hp 1 refine_3 p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ p ∈ horizontalHallway
exact ⟨p 0, p 1, ⟨h0.2.trans (by p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ 1 ≤ 1 norm_num All goals completed! 🐙), h1.1, h1.2⟩,
by p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1] = p ext i p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp i = p.ofLp i; fin_cases i «0» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) <;> «0» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) rfl All goals completed! 🐙⟩
· refine_4 ⊢ ∀ (t : ↑I), ⇑(AffineIsometryEquiv.refl ℝ ℝ²) '' unitSquare ⊆ hallway rintro t q ⟨p, hp, rfl⟩ refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquare⊢ (AffineIsometryEquiv.refl ℝ ℝ²) p ∈ hallway
rw [show (AffineIsometryEquiv.refl ℝ ℝ²) p = p from rfl refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquare⊢ p ∈ hallway refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquare⊢ p ∈ hallway] refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquare⊢ p ∈ hallway
refine .inl ?_ refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquare⊢ p ∈ horizontalHallway
have h0 := mem_Icc_of_mem_unitSquare hp 0 refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1⊢ p ∈ horizontalHallway
have h1 := mem_Icc_of_mem_unitSquare hp 1 refine_4 t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ p ∈ horizontalHallway
exact ⟨p 0, p 1, ⟨h0.2.trans (by t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ 1 ≤ 1 norm_num All goals completed! 🐙), h1.1, h1.2⟩,
by t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1] = p ext i t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp i = p.ofLp i; fin_cases i «0» t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) <;> «0» t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» t:↑Ip:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) rfl All goals completed! 🐙⟩
· refine_5 ⊢ ⇑(AffineIsometryEquiv.refl ℝ ℝ²) '' unitSquare ⊆ verticalHallway rintro q ⟨p, hp, rfl⟩ refine_5 p:ℝ²hp:p ∈ unitSquare⊢ (AffineIsometryEquiv.refl ℝ ℝ²) p ∈ verticalHallway
rw [show (AffineIsometryEquiv.refl ℝ ℝ²) p = p from rfl refine_5 p:ℝ²hp:p ∈ unitSquare⊢ p ∈ verticalHallway refine_5 p:ℝ²hp:p ∈ unitSquare⊢ p ∈ verticalHallway]refine_5 p:ℝ²hp:p ∈ unitSquare⊢ p ∈ verticalHallway
have h0 := mem_Icc_of_mem_unitSquare hp 0 refine_5 p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1⊢ p ∈ verticalHallway
have h1 := mem_Icc_of_mem_unitSquare hp 1 refine_5 p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ p ∈ verticalHallway
exact ⟨p 0, p 1, ⟨h0.1, h0.2, h1.2.trans (by p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ 1 ≤ 1 norm_num All goals completed! 🐙)⟩,
by p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1] = p ext i p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp i = p.ofLp i; fin_cases i «0» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) <;> «0» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» p:ℝ²hp:p ∈ unitSquareh0:p.ofLp 0 ∈ Set.Icc 0 1h1:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) = p.ofLp ((fun i ↦ i) ⟨1, ⋯⟩) rfl All goals completed! 🐙⟩The rigid motion that translates by $p$ and then rotates counterclockwise by $\alpha$. Note that [Ge92] used this definition while [Ro18] used rotation first and then translation.
def rotateTranslate (α : Real.Angle) (p : ℝ²) : E(2) :=
(AffineIsometryEquiv.vaddConst ℝ p).trans
(EuclideanGeometry.o.rotation α).toAffineIsometryEquiv
rotateTranslate α p sends $q$ to $R_\alpha(q + p)$: the translation is applied first.
@[category test, AMS 49]
theorem rotateTranslate_apply (α : Real.Angle) (p q : ℝ²) :
rotateTranslate α p q = EuclideanGeometry.o.rotation α (q + p) := rflThe sofa according to a rotation path $p : [0, \pi/2] \to \mathbb{R}^2$ as in [Ge92] is the intersection over $\alpha \in [0, \pi/2]$ of hallways each translated by $p(\alpha)$ and then rotated by $\alpha$, with the special cases that the hallway at $0$ is the horizontal side and the hallway at $\pi/2$ is the vertical side.
def sofaOfRotateTranslatePath (p : ℝ → ℝ²) : Set ℝ² :=
rotateTranslate 0 (p 0) '' horizontalHallway ∩
rotateTranslate ↑(π / 2) (p (π / 2)) '' verticalHallway ∩
⋂ α ∈ Set.Icc 0 (π / 2), rotateTranslate α (p α) '' hallwaynamespace GerversSofaEq. 1-4 of [Ro18], which specifies the constants $A$, $B$, $\varphi$, and $\theta$ of [Ge92].
def ABφθSpec (A B φ θ : ℝ) : Prop :=
0 ≤ φ ∧ φ ≤ θ ∧ θ ≤ π / 4 ∧ 0 ≤ A ∧ 0 ≤ B ∧
A * (θ.cos - φ.cos) - 2 * B * φ.sin
+ (θ - φ - 1) * θ.cos - θ.sin + φ.cos + φ.sin = 0 ∧
A * (3 * θ.sin + φ.sin) - 2 * B * φ.cos
+ 3 * (θ - φ - 1) * θ.sin + 3 * θ.cos - φ.sin + φ.cos = 0 ∧
A * φ.cos - (φ.sin + 1 / 2 - φ.cos / 2 + B * φ.sin) = 0 ∧
(A + π / 2 - φ - θ) - (B - (θ - φ) * (1 + A) / 2 - (θ - φ)^2 / 4) = 0There exist unique constants $A$, $B$, $\varphi$, and $\theta$ satisfying the spec.
@[category textbook, AMS 49,
formal_proof using lean4 at "https://github.com/RuifengCao/sofa-formal/blob/838baca722560f30ea8e60b8c711b20147626175/SofaSubmission/Defs.lean#L173",
formal_proof using lean4 at "https://github.com/dawidmtrela-dotcom/GerverSofaLean/blob/v1.0.0/GerverSofa/KernelOnly/PartE/E24KC6KernelFinalClosure.lean"]
theorem ABφθSpec.existsUnique : ∃! ABφθ : ℝ × ℝ × ℝ × ℝ,
ABφθSpec ABφθ.1 ABφθ.2.1 ABφθ.2.2.1 ABφθ.2.2.2 :=
sorrydef A : ℝ := ABφθSpec.existsUnique.choose.1def B : ℝ := ABφθSpec.existsUnique.choose.2.1def φ : ℝ := ABφθSpec.existsUnique.choose.2.2.1def θ : ℝ := ABφθSpec.existsUnique.choose.2.2.2def r (α : ℝ) : ℝ :=
if α ≤ φ then
1 / 2
else if α ≤ θ then
(1 + A + α - φ) / 2
else if α ≤ π / 2 - θ then
A + α - φ
else if α ≤ π / 2 - φ then
B - (π / 2 - α - φ) * (1 + A) / 2 - (π / 2 - α - φ) ^ 2 / 4
else
0def y (α : ℝ) : ℝ :=
∫ t in α..π / 2 - φ, r t * t.sindef x (α : ℝ) : ℝ :=
1 - ∫ t in α..π / 2 - φ, r t * t.cosdef p (α : ℝ) : ℝ² :=
!2[if α ≤ φ
then α.cos - 1
else x (π / 2 - α) * α.cos + y (π / 2 - α) * α.sin - 1,
if α ≤ π / 2 - φ
then y α * α.cos - (4 * x 0 - 2 - x α) * α.sin - 1
else -(4 * x 0 - 3) * α.sin - 1]end GerversSofa
Gerver's sofa is the sofa according to the rotation path GerversSofa.p.
def gerversSofa : Set ℝ² :=
sofaOfRotateTranslatePath GerversSofa.pset_option linter.style.formal_proof_palomar false inGerver's concrete sofa admits a valid hallway motion.
@[category research solved, AMS 49,
formal_proof using lean4 at "https://github.com/dawidmtrela-dotcom/GerverSofaLean/releases/tag/v1.1.0",
formal_proof using lean4 at "https://github.com/RuifengCao/sofa-formal/blob/838baca722560f30ea8e60b8c711b20147626175/SofaSubmission/Solution.lean#L20",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/16653ae81e0e4f52a362bafae2ad3440100ad065/Solution.lean#L161-L168",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/0addd87e5a0a4550ab8a60019180f012167fa24f/Solution.lean#L120-L121"]
theorem isMovingSofa_gerversSofa : ∃ m, IsMovingSofa gerversSofa m := by ⊢ ∃ m, IsMovingSofa gerversSofa m
sorry All goals completed! 🐙open MeasureTheoryopen scoped ENNRealThe sofa constant is the maximal area of a moving sofa.
@[optimization_constant "41a"]
def sofaConstant : ℝ≥0∞ := ⨆ (s : Set ℝ²) (_ : ∃ m, IsMovingSofa s m), volume sThe sofa constant is at least 1, as witnessed by the unit square.
@[category test, AMS 49]
theorem one_le_sofaConstant : 1 ≤ sofaConstant := by ⊢ 1 ≤ sofaConstant
calc
_ = volume unitSquare := (OrthonormalBasis.volume_parallelepiped _).symm
_ ≤ sofaConstant := le_iSup₂ (α := ℝ≥0∞) unitSquare isMovingSofa_unitSquaredef sofaConstant_eq.answer : ℝ≥0∞ := volume gerversSofaset_option linter.style.formal_proof_palomar false inWhat is the sofa constant?
@[category research solved, question value, AMS 49,
formal_proof using lean4 at "https://github.com/deancureton/MovingSofa/blob/a0753860f1d2b4424e059c35e64ad611be71a415/MovingSofaSubmission/Solution.lean#L20",
formal_proof using lean4 at "https://github.com/RuifengCao/sofa-formal/blob/838baca722560f30ea8e60b8c711b20147626175/SofaSubmission/Solution.lean#L26",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/16653ae81e0e4f52a362bafae2ad3440100ad065/Solution.lean#L171-L173",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/0addd87e5a0a4550ab8a60019180f012167fa24f/Solution.lean#L124-L125"]
theorem sofaConstant_eq : sofaConstant = sofaConstant_eq.answer := by ⊢ sofaConstant = sofaConstant_eq.answer
sorry All goals completed! 🐙set_option linter.style.formal_proof_palomar false inGerver's sofa attains the sofa constant, conjectured by [Ge92] and claimed by [Ba24].
@[category research solved, AMS 49,
formal_proof using lean4 at "https://github.com/deancureton/MovingSofa/blob/a0753860f1d2b4424e059c35e64ad611be71a415/MovingSofaSubmission/Solution.lean#L20",
formal_proof using lean4 at "https://github.com/RuifengCao/sofa-formal/blob/838baca722560f30ea8e60b8c711b20147626175/SofaSubmission/Solution.lean#L30",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/16653ae81e0e4f52a362bafae2ad3440100ad065/Solution.lean#L171-L173",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/0addd87e5a0a4550ab8a60019180f012167fa24f/Solution.lean#L124-L125"]
theorem sofaConstant_eq_volume_gerversSofa : sofaConstant = volume gerversSofa := by ⊢ sofaConstant = volume gerversSofa
sorry All goals completed! 🐙set_option linter.style.formal_proof_palomar false inGerver's sofa is the unique sofa that attains the sofa constant, up to a rigid motion.
The motion is needed: horizontalHallway is $(-\infty, 1] \times [0, 1]$, so a leftward
translate of any moving sofa is again one, obtained by sliding right and then following the
original motion. It has the same area, so uniqueness cannot hold on the nose.
@[category research solved, AMS 49,
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/16653ae81e0e4f52a362bafae2ad3440100ad065/Solution.lean#L176-L190",
formal_proof using lean4 at "https://github.com/vltanh/lean4-moving-sofa/blob/0addd87e5a0a4550ab8a60019180f012167fa24f/Solution.lean#L128-L131"]
theorem volume_eq_sofaConstant_iff_congruent_gerversSofa (s : Set ℝ²)
(hs : ∃ m, IsMovingSofa s m) :
volume s = sofaConstant ↔ ∃ g : E(2), s = g '' gerversSofa := by s:Set ℝ²hs:∃ m, IsMovingSofa s m⊢ volume s = sofaConstant ↔ ∃ g, s = ⇑g '' gerversSofa
sorry All goals completed! 🐙The ambidextrous sofa
Romik [Ro18, §1.2] asks for the largest shape that can turn both right and left around the
corner. hallway turns right and its reflection in midline, $(x, y) \mapsto (x, 1 - y)$,
turns left; the two share horizontalHallway.
The horizontal line $y = 1/2$, the axis of symmetry of the horizontal side of the hallway.
def midline : AffineSubspace ℝ ℝ² :=
AffineSubspace.mk' !2[0, 1 / 2] (ℝ ∙ (EuclideanSpace.basisFun (Fin 2) ℝ 0))instance : Nonempty midline := ⟨⟨_, AffineSubspace.self_mem_mk' _ _⟩⟩
Sanity check: reflection in midline acts as $(x, y) \mapsto (x, 1 - y)$.
@[category test, AMS 49]
theorem reflection_midline_apply (q : ℝ²) :
EuclideanGeometry.reflection midline q = !2[q 0, 1 - q 1] := by q:ℝ²⊢ (EuclideanGeometry.reflection midline) q = !₂[q.ofLp 0, 1 - q.ofLp 1]
rw [EuclideanGeometry.reflection_apply_of_mem midline q (AffineSubspace.self_mem_mk' _ _), q:ℝ²⊢ midline.direction.reflection (q -ᵥ !₂[0, 1 / 2]) +ᵥ !₂[0, 1 / 2] = !₂[q.ofLp 0, 1 - q.ofLp 1] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1]
midline, q:ℝ²⊢ (AffineSubspace.mk' !₂[0, 1 / 2] (ℝ ∙ (EuclideanSpace.basisFun (Fin 2) ℝ) 0)).direction.reflection
(q -ᵥ !₂[0, 1 / 2]) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1] AffineSubspace.direction_mk', q:ℝ²⊢ (ℝ ∙ (EuclideanSpace.basisFun (Fin 2) ℝ) 0).reflection (q -ᵥ !₂[0, 1 / 2]) +ᵥ !₂[0, 1 / 2] = !₂[q.ofLp 0, 1 - q.ofLp 1] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1] Submodule.reflection_apply, q:ℝ²⊢ (2 • (ℝ ∙ (EuclideanSpace.basisFun (Fin 2) ℝ) 0).starProjection (q -ᵥ !₂[0, 1 / 2]) - (q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1]
Submodule.starProjection_singleton q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1]] q:ℝ²⊢ (2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2] =
!₂[q.ofLp 0, 1 - q.ofLp 1]
ext i q:ℝ²i:Fin 2⊢ ((2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2]).ofLp
i =
!₂[q.ofLp 0, 1 - q.ofLp 1].ofLp i
fin_cases i «0» q:ℝ²⊢ ((2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2]).ofLp
((fun i ↦ i) ⟨0, ⋯⟩) =
!₂[q.ofLp 0, 1 - q.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» q:ℝ²⊢ ((2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2]).ofLp
((fun i ↦ i) ⟨1, ⋯⟩) =
!₂[q.ofLp 0, 1 - q.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) <;> «0» q:ℝ²⊢ ((2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2]).ofLp
((fun i ↦ i) ⟨0, ⋯⟩) =
!₂[q.ofLp 0, 1 - q.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩)«1» q:ℝ²⊢ ((2 •
(inner ℝ ((EuclideanSpace.basisFun (Fin 2) ℝ) 0) (q -ᵥ !₂[0, 1 / 2]) /
↑(‖(EuclideanSpace.basisFun (Fin 2) ℝ) 0‖ ^ 2)) •
(EuclideanSpace.basisFun (Fin 2) ℝ) 0 -
(q -ᵥ !₂[0, 1 / 2])) +ᵥ
!₂[0, 1 / 2]).ofLp
((fun i ↦ i) ⟨1, ⋯⟩) =
!₂[q.ofLp 0, 1 - q.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) simp [EuclideanSpace.inner_eq_star_dotProduct, Matrix.vecHead] «1» q:ℝ²⊢ 2⁻¹ - q.ofLp 1 + 2⁻¹ = 1 - q.ofLp 1 <;> «0» q:ℝ²⊢ 2 * q.ofLp 0 - q.ofLp 0 = q.ofLp 0«1» q:ℝ²⊢ 2⁻¹ - q.ofLp 1 + 2⁻¹ = 1 - q.ofLp 1 ring All goals completed! 🐙
A set closed under reflection in midline is its own image.
@[category API, AMS 49]
private lemma reflection_midline_image_eq_self {S : Set ℝ²}
(h : ∀ p ∈ S, EuclideanGeometry.reflection midline p ∈ S) :
EuclideanGeometry.reflection midline '' S = S :=
Set.Subset.antisymm (Set.image_subset_iff.2 h) fun p hp =>
⟨_, h p hp, EuclideanGeometry.reflection_reflection midline p⟩
Sanity check: reflection in midline fixes the horizontal side of the hallway.
@[category test, AMS 49]
theorem reflection_midline_image_horizontalHallway :
EuclideanGeometry.reflection midline '' horizontalHallway = horizontalHallway := by ⊢ ⇑(EuclideanGeometry.reflection midline) '' horizontalHallway = horizontalHallway
refine reflection_midline_image_eq_self ?_ ⊢ ∀ p ∈ horizontalHallway, (EuclideanGeometry.reflection midline) p ∈ horizontalHallway
rintro _ ⟨x, y, ⟨hx, hy0, hy1⟩, rfl⟩ x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ (EuclideanGeometry.reflection midline) !₂[x, y] ∈ horizontalHallway
rw [reflection_midline_apply x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ !₂[!₂[x, y].ofLp 0, 1 - !₂[x, y].ofLp 1] ∈ horizontalHallway x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ !₂[!₂[x, y].ofLp 0, 1 - !₂[x, y].ofLp 1] ∈ horizontalHallway] x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ !₂[!₂[x, y].ofLp 0, 1 - !₂[x, y].ofLp 1] ∈ horizontalHallway
exact ⟨x, 1 - y, ⟨by x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ x ≤ 1 simpa using hx All goals completed! 🐙, by x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ 0 ≤ 1 - y simp x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ y ≤ 1; linarith All goals completed! 🐙, by x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ 1 - y ≤ 1 simp x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ 0 ≤ y; linarith All goals completed! 🐙⟩, by x:ℝy:ℝhx:x ≤ 1hy0:0 ≤ yhy1:y ≤ 1⊢ !₂[x, 1 - y] = !₂[!₂[x, y].ofLp 0, 1 - !₂[x, y].ofLp 1] simp All goals completed! 🐙⟩
A point lies in the unit square iff both coordinates lie in [0,1].
@[category API, AMS 49]
private lemma mem_unitSquare_iff {p : ℝ²} : p ∈ unitSquare ↔ ∀ i, p i ∈ Set.Icc (0:ℝ) 1 := by p:ℝ²⊢ p ∈ unitSquare ↔ ∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1
rw [unitSquare, p:ℝ²⊢ p ∈ parallelepiped ⇑(EuclideanSpace.basisFun (Fin 2) ℝ) ↔ ∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1 p:ℝ²⊢ p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1} ↔
∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1 ← OrthonormalBasis.coe_toBasis, p:ℝ²⊢ p ∈ parallelepiped ⇑(EuclideanSpace.basisFun (Fin 2) ℝ).toBasis ↔ ∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1 p:ℝ²⊢ p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1} ↔
∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1 parallelepiped_basis_eq p:ℝ²⊢ p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1} ↔
∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1 p:ℝ²⊢ p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1} ↔
∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1] p:ℝ²⊢ p ∈ {x | ∀ (i : Fin 2), ((EuclideanSpace.basisFun (Fin 2) ℝ).toBasis.repr x) i ∈ Set.Icc 0 1} ↔
∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1
simp All goals completed! 🐙
A closed connected set is an ambidextrous sofa if both it and its reflection in midline
are moving sofas [Ro18, Thm. 5].
def IsAmbidextrousSofa (s : Set ℝ²) : Prop :=
(∃ m, IsMovingSofa s m) ∧ (∃ m, IsMovingSofa (EuclideanGeometry.reflection midline '' s) m)
Sanity check: the unit square is ambidextrous, since it is symmetric under reflection in
midline.
@[category test, AMS 49]
theorem isAmbidextrousSofa_unitSquare : IsAmbidextrousSofa unitSquare := by ⊢ IsAmbidextrousSofa unitSquare
have h : EuclideanGeometry.reflection midline '' unitSquare = unitSquare := by
refine reflection_midline_image_eq_self fun p hp => ?_ p:ℝ²hp:p ∈ unitSquare⊢ (EuclideanGeometry.reflection midline) p ∈ unitSquare h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
rw [mem_unitSquare_iff p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ ∀ (i : Fin 2), ((EuclideanGeometry.reflection midline) p).ofLp i ∈ Set.Icc 0 1 p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ ∀ (i : Fin 2), ((EuclideanGeometry.reflection midline) p).ofLp i ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare] at hp ⊢ p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ ∀ (i : Fin 2), ((EuclideanGeometry.reflection midline) p).ofLp i ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
intro i p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1i:Fin 2⊢ ((EuclideanGeometry.reflection midline) p).ofLp i ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
rw [reflection_midline_apply p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp i ∈ Set.Icc 0 1 p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp i ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare] p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1i:Fin 2⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp i ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
fin_cases i «0» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) ∈ Set.Icc 0 1«1» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
· «0» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp ((fun i ↦ i) ⟨0, ⋯⟩) ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare simpa using hp 0 All goals completed! 🐙 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
· «1» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare have := hp 1 «1» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:p.ofLp 1 ∈ Set.Icc 0 1⊢ !₂[p.ofLp 0, 1 - p.ofLp 1].ofLp ((fun i ↦ i) ⟨1, ⋯⟩) ∈ Set.Icc 0 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
simp only [Set.mem_Icc] at this ⊢ «1» p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ 0 ≤ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩ ∧ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩ ≤ 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
constructor «1».left p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ 0 ≤ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩«1».right p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩ ≤ 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare <;> «1».left p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ 0 ≤ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩«1».right p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ ![p.ofLp 0, 1 - p.ofLp 1] ⟨1, ⋯⟩ ≤ 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare simp «1».right p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ 0 ≤ p.ofLp 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare <;> «1».left p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ p.ofLp 1 ≤ 1«1».right p:ℝ²hp:∀ (i : Fin 2), p.ofLp i ∈ Set.Icc 0 1this:0 ≤ p.ofLp 1 ∧ p.ofLp 1 ≤ 1⊢ 0 ≤ p.ofLp 1 h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare linarith [this.1, this.2] h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ IsAmbidextrousSofa unitSquare
exact ⟨isMovingSofa_unitSquare, by h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ ∃ m, IsMovingSofa (⇑(EuclideanGeometry.reflection midline) '' unitSquare) m rw [h h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ ∃ m, IsMovingSofa unitSquare m h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ ∃ m, IsMovingSofa unitSquare m] h:⇑(EuclideanGeometry.reflection midline) '' unitSquare = unitSquare⊢ ∃ m, IsMovingSofa unitSquare m; exact isMovingSofa_unitSquare All goals completed! 🐙⟩The ambidextrous sofa constant is the maximal area of an ambidextrous sofa.
def ambidextrousSofaConstant : ℝ≥0∞ :=
⨆ (s : Set ℝ²) (_ : IsAmbidextrousSofa s), volume sThe ambidextrous sofa constant is at least 1, as witnessed by the unit square.
@[category test, AMS 49]
theorem one_le_ambidextrousSofaConstant : 1 ≤ ambidextrousSofaConstant := by ⊢ 1 ≤ ambidextrousSofaConstant
calc
_ = volume unitSquare := (OrthonormalBasis.volume_parallelepiped _).symm
_ ≤ ambidextrousSofaConstant :=
le_iSup₂ (α := ℝ≥0∞) unitSquare isAmbidextrousSofa_unitSquareEvery ambidextrous sofa is a moving sofa.
@[category API, AMS 49]
theorem ambidextrousSofaConstant_le_sofaConstant :
ambidextrousSofaConstant ≤ sofaConstant :=
iSup₂_le fun s hs => le_iSup₂ (α := ℝ≥0∞) s hs.1namespace RomiksSofaThe cubic $x^2 (x + 3) = 8$ has exactly one real root.
@[category textbook, AMS 49]
theorem existsUnique_X : ∃! x : ℝ, x ^ 2 * (x + 3) = 8 := by ⊢ ∃! x, x ^ 2 * (x + 3) = 8
have hc : Continuous (fun x : ℝ => x ^ 2 * (x + 3)) := by fun_prop hc:Continuous fun x ↦ x ^ 2 * (x + 3)⊢ ∃! x, x ^ 2 * (x + 3) = 8 hc:Continuous fun x ↦ x ^ 2 * (x + 3)⊢ ∃! x, x ^ 2 * (x + 3) = 8
obtain ⟨x, -, hx⟩ := intermediate_value_Icc (a := (0:ℝ)) (b := 2) (by hc:Continuous fun x ↦ x ^ 2 * (x + 3)⊢ 0 ≤ 2 hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8⊢ ∃! x, x ^ 2 * (x + 3) = 8 norm_num All goals completed! 🐙 hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8⊢ ∃! x, x ^ 2 * (x + 3) = 8)
hc.continuousOn (show (8:ℝ) ∈ Set.Icc _ _ by norm_num All goals completed! 🐙 hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8⊢ ∃! x, x ^ 2 * (x + 3) = 8) hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8⊢ ∃! x, x ^ 2 * (x + 3) = 8
refine ⟨x, hx, fun y hy => ?_⟩ hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) y⊢ y = x
have hx0 : 0 < x := by ⊢ ∃! x, x ^ 2 * (x + 3) = 8 hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < x⊢ y = x nlinarith [sq_nonneg (x + 2), sq_nonneg x] hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < x⊢ y = x hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < x⊢ y = x
have hy0 : 0 < y := by ⊢ ∃! x, x ^ 2 * (x + 3) = 8 hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < xhy0:0 < y⊢ y = x nlinarith [sq_nonneg (y + 2), sq_nonneg y] hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < xhy0:0 < y⊢ y = x hc:Continuous fun x ↦ x ^ 2 * (x + 3)x:ℝhx:(fun x ↦ x ^ 2 * (x + 3)) x = 8y:ℝhy:(fun x ↦ x ^ 2 * (x + 3) = 8) yhx0:0 < xhy0:0 < y⊢ y = x
nlinarith [sq_nonneg (x - y), sq_nonneg (x + y), mul_pos hx0 hy0] All goals completed! 🐙The cubic $x (4 x^2 + 3) = 1$ has exactly one real root.
@[category textbook, AMS 49]
theorem existsUnique_Y : ∃! x : ℝ, x * (4 * x ^ 2 + 3) = 1 := by ⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1
have hc : Continuous (fun x : ℝ => x * (4 * x ^ 2 + 3)) := by fun_prop hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1 hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1
obtain ⟨x, -, hx⟩ := intermediate_value_Icc (a := (0:ℝ)) (b := 1) (by hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)⊢ 0 ≤ 1 hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)x:ℝhx:(fun x ↦ x * (4 * x ^ 2 + 3)) x = 1⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1 norm_num All goals completed! 🐙 hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)x:ℝhx:(fun x ↦ x * (4 * x ^ 2 + 3)) x = 1⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1)
hc.continuousOn (show (1:ℝ) ∈ Set.Icc _ _ by norm_num All goals completed! 🐙 hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)x:ℝhx:(fun x ↦ x * (4 * x ^ 2 + 3)) x = 1⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1) hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)x:ℝhx:(fun x ↦ x * (4 * x ^ 2 + 3)) x = 1⊢ ∃! x, x * (4 * x ^ 2 + 3) = 1
refine ⟨x, hx, fun y hy => ?_⟩ hc:Continuous fun x ↦ x * (4 * x ^ 2 + 3)x:ℝhx:(fun x ↦ x * (4 * x ^ 2 + 3)) x = 1y:ℝhy:(fun x ↦ x * (4 * x ^ 2 + 3) = 1) y⊢ y = x
nlinarith [sq_nonneg (x - y), sq_nonneg (x + y), sq_nonneg x, sq_nonneg y] All goals completed! 🐙$X = \sqrt[3]{3 + 2\sqrt2} + \sqrt[3]{3 - 2\sqrt2} - 1 ≈ 1.3553$, the real root of $x^2 (x + 3) = 8$.
def X : ℝ := existsUnique_X.exists.choose$Y = \tfrac12\bigl(\sqrt[3]{\sqrt2 + 1} - \sqrt[3]{\sqrt2 - 1}\bigr) ≈ 0.2980$, the real root of $x (4 x^2 + 3) = 1$.
def Y : ℝ := existsUnique_Y.exists.chooseThe area of Romik's ambidextrous sofa is $X + \arctan Y ≈ 1.644955218425440$ [Ro18, eq. (5)]. The shape itself, bounded by 18 arcs of circles and sextic curves [Ro18, §5–6], is not defined here.
def area : ℝ := X + Real.arctan Yend RomiksSofa
Romik's ambidextrous sofa has area RomiksSofa.area [Ro18, Thm. 5], so the ambidextrous sofa
constant is at least that.
@[category research solved, AMS 49]
theorem romiksSofa_area_le_ambidextrousSofaConstant :
ENNReal.ofReal RomiksSofa.area ≤ ambidextrousSofaConstant := by ⊢ ENNReal.ofReal RomiksSofa.area ≤ ambidextrousSofaConstant
sorry All goals completed! 🐙Romik's ambidextrous sofa is optimal. Romik derived it from local-optimality considerations and proposed it as the solution [Ro18, §1.2, §5]; [Wikipedia] records it as the conjectured optimum. Even its local optimality is open [Ro18, §7, Problem 1].
@[category research open, AMS 49]
theorem ambidextrousSofaConstant_eq_romiksSofa_area :
ambidextrousSofaConstant = ENNReal.ofReal RomiksSofa.area := by ⊢ ambidextrousSofaConstant = ENNReal.ofReal RomiksSofa.area
sorry All goals completed! 🐙end MovingSofa