1-- The rationals inside the reals, irrationality, and the irrationality of √22-- Part of Cumulus, the Grace17 mathematics library.3-- Copyright (c) 2026 Grant Passmore.4-- Released under the Apache License 2.0. See LICENSE in the repository root.5-- Authors: Grant Passmore67module Grace.Cumulus.Real.Rationals8import RootTwoRational910-- The image of the rationals under the cut embedding; ℚ itself is the set11-- of rationals.12def rationalReals : Set:= { rationalCut(q) | q ∈ ℚ }1314theorem sqrtTwo.not_rational15shows√2∉ rationalReals16proof17intro member18obtain⟨q, qInQ, equal⟩:= rationalReals.membership.forward with member19 symm at equal20exact sqrtTwo.ne_rationalCut with*, equal2122-- A real number is irrational when it is not the image of any rational23-- under the embedding of ℚ into ℝ: the textbook √2 ∉ ℚ, with ℚ read as its24-- copy inside ℝ.25predicate Irrational (x : Real) :=¬(∃ q ∈ ℚ, rationalCut(q) = x)2627theorem sqrtTwo.irrational28shows Irrational(√2)29proof30unfold Irrational31constructor32 . have one := realZero.lt_one33have twoLe : (0:R) ≤ (2:R) bylinarith34have twoNonnegative := NonnegativeReal.of_le with*35exact sqrt.real with*36 . intro rational37obtain⟨q, qInQ, equal⟩:= rational38have distinct := sqrtTwo.ne_rationalCut at q with*39 symm at equal40exact distinct with equal41