Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

[2019-Jul] Special Pythagorean Triple

A Pythagorean Triple is a set of three natural numbers, a < b < c , for which a2 + b2 = c2

For example 32 + 42 = 9 + 16 = 25 = 52

There exists a Pythagorean triple for which a + b + c = 1000, can you find it?

(inspired by Project Euler)

Resources

Download Files

Definitions File

theory Defs
imports Main
begin

definition "pythagoreantriple a b c \<longleftrightarrow> a<b \<and> b<c \<and> a*a + b*b = c*c"

end

Template File

theory Submission
imports Defs
begin


lemma GOAL: "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  sorry


end

Check File

theory Check
imports Submission
begin


lemma "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  by(rule Submission.GOAL)


end
Download Files

Definitions File

theory Defs
imports Main
begin

definition "pythagoreantriple a b c \<longleftrightarrow> a<b \<and> b<c \<and> a*a + b*b = c*c"

end

Template File

theory Submission
imports Defs
begin


lemma GOAL: "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  sorry


end

Check File

theory Check
imports Submission
begin


lemma "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  by(rule Submission.GOAL)


end
Download Files

Definitions File

Require Export NArith Lia.
Open Scope N.

Definition pythagorean_triple (a b c: N) :=
  a < b /\ b < c /\ a*a + b*b = c*c.

Template File

Require Import Defs.

Theorem goal : exists a b c, pythagorean_triple a b c /\ a + b + c = 1000.
Proof.
  (* todo *)
Admitted.
Download Files

Definitions File

-- Lean version: 3.4.2
-- Mathlib version: 2019-07-31

def pythagorean_triple (a b c : ℕ) := a > 0 ∧ b > 0 ∧ a * a + b * b = c * c

Template File

import .defs

theorem pythagorean_sum_one_thousand :
  ∃ (a b c : ℕ), pythagorean_triple a b c ∧ a + b + c = 1000 :=
sorry

Check File

import .submission

theorem you_did_it :
  ∃ (a b c : ℕ), pythagorean_triple a b c ∧ a + b + c = 1000 :=
pythagorean_sum_one_thousand
Download Files

Definitions File

(in-package "ACL2")

(defun pythagoreantriple (a b c)
  (and (natp a) (natp b) (natp c)
       (< a b)
       (< b c)
       (equal (+ (* a a) (* b b))
              (* c c))))

Template File

(in-package "ACL2")

(include-book "Defs")

; Consider writing a program, find-pyth, to compute a suitable Pythagorean
; triple, then define a constant containing that triple, and finally give the
; lemma below a suitable :use hint based on that constant.

; (defconst *pyth-answer*
;   (find-pyth 1000))

(defun-sk lemma-formalization ()
  (exists (a b c) (and (pythagoreantriple a b c)
                       (equal (+ a b c) 1000))))

(defthm lemma
  (lemma-formalization))

Check File

; The four lines just below are boilerplate, that is, the same for every
; problem.

(in-package "ACL2")
(include-book "Submission")
(set-enforce-redundancy t)
(include-book "Defs")

; The events below represent the theorem to be proved, and are copied from
; template.lisp.

(defun-sk lemma-formalization ()
  (exists (a b c) (and (pythagoreantriple a b c)
                       (equal (+ a b c) 1000))))

(defthm lemma
  (lemma-formalization))
Download Files

Definitions File

theory Defs
imports Main
begin

definition "pythagoreantriple a b c \<longleftrightarrow> a<b \<and> b<c \<and> a*a + b*b = c*c"

end

Template File

theory Submission
imports Defs
begin


lemma GOAL: "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  sorry


end

Check File

theory Check
imports Submission
begin


lemma "\<exists>a b c :: nat. pythagoreantriple a b c \<and> a + b + c = 1000" 
  by(rule Submission.GOAL)


end

Terms and Conditions