math-sqrt2-irrational-proof
The solution is implemented in Python at ~/prove_sqrt2_irrational.py. It contains:
Proof of √2 irrational by infinite descent:
Assume √2 = a/b in lowest terms (gcd(a,b)=1). Then:
a² = 2b² → a even → a = 2k
4k² = 2b² → b² = 2k² → b even → b = 2m
This produces a smaller pair (k,m) representing √2, where k < a and m < b. Repeating gives an infinite strictly decreasing sequence of positive integers, contradicting the Well-Ordering Principle. Therefore no such a,b exist → √2 is irrational.
Corollary — √n irrational for non-perfect-square n:
If n is not a perfect square, its prime factorization contains a prime p with odd exponent e. From a² = n·b², LHS has even exponent of p (2·α), RHS has odd exponent (e + 2·β). Contradiction via uniqueness of prime factorization.
The code includes:
- prove_sqrt2_irrational() — formatted proof text
- infinite_descent_sqrt2() — simulated descent demonstration
- prove_sqrt_n_irrational_corollary() — corollary proof with examples
- verify_irrational_by_contradiction() — computational search for rational representations
- test_proof_logic() — 38 automated tests
All tests run and pass. Key verifications:
| Test Case | Result | Explanation |
|-----------|--------|-------------|
| √2 ≈ 239/169 | Not exact (239²=57121, 2·169²=57122) | No rational representation found |
| √3 ≈ 265/153 | Not exact (265²=70225, 3·153²=70227) | No rational representation found |
| √36 = 6/1 | EXACT match | Perfect square → rational, as expected |
| Prime factorization | All correct | 12={2:2,3:1}, 36={2:2,3:2}, etc. |
| Non-squares have odd prime exponent | All 8 checked | {2,3,6,8,12,18,20,24} all have ≥1 odd exponent |
| Perfect squares have all-even exponents | All 10 checked | {1,4,9,16,25,36,49,64,81,100} |
Edge cases covered:
- **n=1**: perfect square (1²), √1=1 rational ✓
- **n=8**: 8=2³, odd exponent 3 → √8=2√2 irrational ✓
- **n=36**: perfect square 6² → rational ✓
- **n=0**, **negative n**: handled by `is_perfect_square` returning False
- Denominators up to 500 searched for each non-square; none produced an exact equality
---{"model": "pi-llama", "problem_class": "math-sqrt2-irrational-proof", "result": "passed", "tests": 38}The solution is implemented in Python at ~/prove_sqrt2_irrational.py. It contains:
Proof of √2 irrational by infinite descent:
Assume √2 = a/b in lowest terms (gcd(a,b)=1). Then:
a² = 2b² → a even → a = 2k
4k² = 2b² → b² = 2k² → b even → b = 2m
This produces a smaller pair (k,m) representing √2, where k < a and m < b. Repeating gives an infinite strictly decreasing sequence of positive integers, contradicting the Well-Ordering Principle. Therefore no such a,b exist → √2 is irrational.
Corollary — √n irrational for non-perfect-square n:
If n is not a perfect square, its prime factorization contains a prime p with odd exponent e. From a² = n·b², LHS has even exponent of p (2·α), RHS has odd exponent (e + 2·β). Contradiction via uniqueness of prime factorization.
The code includes:
- prove_sqrt2_irrational() — formatted proof text
- infinite_descent_sqrt2() — simulated descent demonstration
- prove_sqrt_n_irrational_corollary() — corollary proof with examples
- verify_irrational_by_contradiction() — computational search for rational representations
- test_proof_logic() — 38 automated tests
All tests run and pass. Key verifications:
| Test Case | Result | Explanation |
|-----------|--------|-------------|
| √2 ≈ 239/169 | Not exact (239²=57121, 2·169²=57122) | No rational representation found |
| √3 ≈ 265/153 | Not exact (265²=70225, 3·153²=70227) | No rational representation found |
| √36 = 6/1 | EXACT match | Perfect square → rational, as expected |
| Prime factorization | All correct | 12={2:2,3:1}, 36={2:2,3:2}, etc. |
| Non-squares have odd prime exponent | All 8 checked | {2,3,6,8,12,18,20,24} all have ≥1 odd exponent |
| Perfect squares have all-even exponents | All 10 checked | {1,4,9,16,25,36,49,64,81,100} |
Edge cases covered:
- **n=1**: perfect square (1²), √1=1 rational ✓
- **n=8**: 8=2³, odd exponent 3 → √8=2√2 irrational ✓
- **n=36**: perfect square 6² → rational ✓
- **n=0**, **negative n**: handled by `is_perfect_square` returning False
- Denominators up to 500 searched for each non-square; none produced an exact equality
---{"model": "pi-llama", "problem_class": "math-sqrt2-irrational-proof", "result": "passed", "tests": 38}