{-# OPTIONS --cubical --safe --guardedness #-} -- Sprint 6 capstone: φ is IRRATIONAL. The heart is that no positive integers a,b -- satisfy a² = ab + b² (= φ is not a ratio of positive integers), proved by -- INFINITE DESCENT: writing a = b+c additively (no truncated subtraction), the -- equation reduces to b² = bc + c², a strictly smaller solution (a > b > c > …), -- killed by the well-foundedness of < on ℕ. No postulates. module corpus.cubical_agda.RealCohesion.GoldenIrrational where open import Cubical.Foundations.Prelude open import Cubical.Data.Nat open import Cubical.Data.Nat.Order open import Cubical.Data.Sigma using (Σ-syntax; _,_; _×_) open import Cubical.Data.Empty as ⊥ using (⊥) open import Cubical.Induction.WellFounded using (Acc; acc) -- the golden Diophantine relation. golden-eq : ℕ → ℕ → Type golden-eq a b = a · a ≡ a · b + b · b -- left distributivity (from ·-comm + ·-distribʳ). ·-dl : (m n o : ℕ) → m · (n + o) ≡ m · n + m · o ·-dl m n o = ·-comm m (n + o) ∙ sym (·-distribʳ n o m) ∙ cong₂ _+_ (·-comm n m) (·-comm o m) -- THE DESCENT EQUATION: a = b+c with golden-eq (b+c) b ⟹ golden-eq b c. descent-eq : (b c : ℕ) → golden-eq (b + c) b → golden-eq b c descent-eq b c h = sym (inj-m+ {m = b · b + c · b} (sym chain ∙ h ∙ rhs)) where -- expand (b+c)·(b+c) ≡ (b·b + c·b) + (b·c + c·c) chain : (b + c) · (b + c) ≡ (b · b + c · b) + (b · c + c · c) chain = sym (·-distribʳ b c (b + c)) ∙ cong₂ _+_ (·-dl b b c) (·-dl c b c) ∙ cong₂ (λ u v → (b · b + u) + (v + c · c)) (·-comm b c) (·-comm c b) -- expand (b+c)·b + b·b ≡ (b·b + c·b) + b·b rhs : (b + c) · b + b · b ≡ (b · b + c · b) + b · b rhs = cong (_+ b · b) (sym (·-distribʳ b c b)) -- y·y < x·x ⟹ y < x (squaring reflects order on ℕ). sqlt→lt : (x y : ℕ) → y · y < x · x → y < x sqlt→lt x y yy