-
Notifications
You must be signed in to change notification settings - Fork 92
The square root of two is irrational #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a2bbc5f
Progress
lowasser fe8acdd
Progress
lowasser 65cc5c1
Merge branch 'master' into irrational-sqrt-2
lowasser 93afe0c
No rational number squares to two
lowasser f0a15a6
Progress
lowasser b72c850
Make claim in words match proved result
lowasser 3cf78e3
Simplification
lowasser b85f1f3
Merge branch 'master' into irrational-sqrt-2
lowasser 4fc62c5
Update src/real-numbers/irrationality-square-root-of-two.lagda.md
lowasser 8589f5a
Define irrational real numbers
lowasser 70f182e
Update src/elementary-number-theory/irrationality-square-root-of-two.…
lowasser c9af316
Update src/elementary-number-theory/irrationality-square-root-of-two.…
lowasser 023a2fe
Respond to review comments
lowasser 53ca313
Merge remote-tracking branch 'origin/irrational-sqrt-2' into irration…
lowasser b8537e3
Respond to comments
lowasser a13f24d
Respond to comments
lowasser 3965fea
Respond to review comments
lowasser 2c27c58
Fix file name
lowasser 07e0c0c
Use is-square-Q
lowasser d8a007a
Fix literature link
lowasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
src/elementary-number-theory/irrationality-square-root-of-two.lagda.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # The irrationality of the square root of two | ||
|
|
||
| ```agda | ||
| {-# OPTIONS --lossy-unification #-} | ||
| module elementary-number-theory.irrationality-square-root-of-two where | ||
| ``` | ||
|
|
||
| <details><summary>Imports</summary> | ||
|
|
||
| ```agda | ||
| open import elementary-number-theory.absolute-value-integers | ||
| open import elementary-number-theory.divisibility-integers | ||
| open import elementary-number-theory.integer-fractions | ||
| open import elementary-number-theory.integers | ||
| open import elementary-number-theory.multiplication-integer-fractions | ||
| open import elementary-number-theory.multiplication-integers | ||
| open import elementary-number-theory.multiplication-natural-numbers | ||
| open import elementary-number-theory.multiplication-rational-numbers | ||
| open import elementary-number-theory.natural-numbers | ||
| open import elementary-number-theory.parity-natural-numbers | ||
| open import elementary-number-theory.positive-integers | ||
| open import elementary-number-theory.rational-numbers | ||
| open import elementary-number-theory.relatively-prime-integers | ||
| open import elementary-number-theory.squares-integers | ||
| open import elementary-number-theory.squares-natural-numbers | ||
| open import elementary-number-theory.squares-rational-numbers | ||
|
|
||
| open import foundation.action-on-identifications-functions | ||
| open import foundation.coproduct-types | ||
| open import foundation.dependent-pair-types | ||
| open import foundation.empty-types | ||
| open import foundation.function-types | ||
| open import foundation.identity-types | ||
| open import foundation.logical-equivalences | ||
| open import foundation.negated-equality | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| ## Idea | ||
|
|
||
| There is no [rational number](elementary-number-theory.rational-numbers.md) | ||
| whose [square](elementary-number-theory.squares-rational-numbers.md) is two. | ||
|
|
||
| The irrationality of the square root of two is the | ||
| [1st](literature.100-theorems.md#1) theorem on | ||
| [Freek Wiedijk](http://www.cs.ru.nl/F.Wiedijk/)'s list of | ||
| [100 theorems](literature.100-theorems.md) {{#cite 100theorems}}. | ||
|
|
||
| This file proves that two is not the square of any rational number. | ||
|
|
||
| ## Proof | ||
|
|
||
| ```agda | ||
| abstract opaque | ||
| unfolding rational-fraction-ℤ mul-ℚ | ||
|
|
||
| neq-two-square-ℚ : (q : ℚ) → square-ℚ q ≠ rational-ℕ 2 | ||
| neq-two-square-ℚ (p/q@(p , q⁺@(q , is-pos-q)) , coprime-p-q) p²/q²=2 = | ||
| let | ||
| qℕ = succ-ℕ (nat-positive-ℤ q⁺) | ||
| qℕ=q : int-ℕ qℕ = q | ||
| qℕ=q = | ||
| inv (int-positive-int-ℕ _) ∙ ap int-ℤ⁺ (is-section-nat-positive-ℤ q⁺) | ||
| |p|²=qℕ²2 : square-ℕ (abs-ℤ p) = square-ℕ qℕ *ℕ 2 | ||
| |p|²=qℕ²2 = | ||
| is-injective-int-ℕ | ||
| ( equational-reasoning | ||
| int-ℕ (square-ℕ (abs-ℤ p)) | ||
| = square-ℤ p | ||
| by square-abs-ℤ p | ||
| = square-ℤ p *ℤ one-ℤ | ||
| by inv (right-unit-law-mul-ℤ _) | ||
| = int-ℕ 2 *ℤ square-ℤ q | ||
| by | ||
| sim-fraction-ℤ-eq-ℚ | ||
| ( mul-fraction-ℤ p/q p/q) | ||
| ( in-fraction-ℤ (int-ℕ 2)) | ||
| ( ( p²/q²=2) ∙ | ||
| ( inv (is-retraction-rational-fraction-ℚ (rational-ℕ 2)))) | ||
| = int-ℕ 2 *ℤ square-ℤ (int-ℕ qℕ) | ||
| by ap-mul-ℤ refl (ap square-ℤ (inv qℕ=q)) | ||
| = int-ℕ 2 *ℤ int-ℕ (square-ℕ qℕ) | ||
| by ap-mul-ℤ refl (square-int-ℕ qℕ) | ||
| = int-ℕ (2 *ℕ square-ℕ qℕ) | ||
| by mul-int-ℕ _ _ | ||
| = int-ℕ (square-ℕ qℕ *ℕ 2) | ||
| by ap int-ℕ (commutative-mul-ℕ 2 (square-ℕ qℕ))) | ||
| (k , k2=|p|) = | ||
| is-even-is-even-square-ℕ (abs-ℤ p) (square-ℕ qℕ , inv |p|²=qℕ²2) | ||
| k²2=qℕ² : square-ℕ k *ℕ 2 = square-ℕ qℕ | ||
| k²2=qℕ² = | ||
| is-injective-right-mul-succ-ℕ | ||
| ( 1) | ||
| ( equational-reasoning | ||
| square-ℕ k *ℕ 2 *ℕ 2 | ||
| = square-ℕ k *ℕ square-ℕ 2 | ||
| by associative-mul-ℕ (square-ℕ k) 2 2 | ||
| = square-ℕ (k *ℕ 2) | ||
| by inv (distributive-square-mul-ℕ k 2) | ||
| = square-ℕ (abs-ℤ p) | ||
| by ap square-ℕ k2=|p| | ||
| = square-ℕ qℕ *ℕ 2 | ||
| by |p|²=qℕ²2) | ||
| (l , l2=qℕ) = is-even-is-even-square-ℕ qℕ (square-ℕ k , k²2=qℕ²) | ||
| in | ||
| rec-coproduct | ||
| ( λ ()) | ||
| ( λ ()) | ||
| ( is-one-or-neg-one-is-unit-ℤ | ||
| ( int-ℕ 2) | ||
| ( is-unit-div-relatively-prime-ℤ | ||
| ( p) | ||
| ( q) | ||
| ( int-ℕ 2) | ||
| ( coprime-p-q) | ||
| ( rec-coproduct | ||
| ( λ p=|p| → | ||
| ( int-ℕ k , mul-int-ℕ k 2 ∙ ap int-ℕ k2=|p| ∙ inv p=|p|)) | ||
| ( λ p=-|p| → | ||
| ( neg-ℤ (int-ℕ k) , | ||
| ( left-negative-law-mul-ℤ _ _) ∙ | ||
| ( ap neg-ℤ (mul-int-ℕ k 2)) ∙ | ||
| ( ap (neg-ℤ ∘ int-ℕ) k2=|p|) ∙ | ||
| ( inv p=-|p|))) | ||
| ( is-pos-or-neg-abs-ℤ p) , | ||
| ( int-ℕ l , mul-int-ℕ l 2 ∙ ap int-ℕ l2=qℕ ∙ qℕ=q)))) | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| - [The square root of 2 as a real number is not a rational real number](real-numbers.irrationality-square-root-of-two.md) | ||
lowasser marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.