This is a project by Grant Passmore to prove the Top 100 Theorems in Imandra.
Currently, we have proven 17/100:
1. Irrationality of √2
3. Denumerability of the Rationals
4. Pythagorean Theorem
11. Infinitude of Primes
34. Divergence of the Harmonic Series
42. Sum of the Reciprocals of the Triangular Numbers
44. Binomial Theorem
52. Number of Subsets of a Set
54. Königsberg Bridges Problem
58. Formula for Number of Combinations
60. Bezout's Theorem
65. Isosceles Triangle Theorem
69. Greatest Common Divisor Algorithm
74. Principle of Mathematical Induction
80. The Fundamental Theorem of Arithmetic
85. Divisibility by 3 Rule
91. The Triangle Inequality
More coming soon!
Source: src/sqrt2_irrational.iml
Statement (informal): There does not exist
Imandra statement
theorem sqrt2_is_irrational (r:Rational.t) =
Rational.is_reduced r
==> Rational.square r <> Rational.of_int 2Statement (informal): There is a surjection from
Imandra statement
theorem decode_onto (q:Rational.t) =
decode (encode q) = q
theorem rationals_denumerable_surj (q : Rational.t) =
Bijection.surj
decode
encode
(fun (n:int) -> n >= 0) (* dom on N *)
(fun (_:Rational.t) -> true) (* all rationals allowed *)
qStatement (informal):
If the triangle
Imandra statement
theorem pythagoras (a : point) (b : point) (c : point) =
right_at c a b ==> dist2 a b = Real.(dist2 a c + dist2 b c)Statement (informal): There are infinitely many prime numbers.
Imandra statement
theorem infinitude_of_primes n =
let bigger_prime = euclid (abs n) in
is_prime bigger_prime && bigger_prime > nStatement (informal):
The harmonic series diverges: its partial sums grow without bound.
More precisely, let
Then,
Imandra statement
theorem harmonic_series_diverges m n =
m >= 0 && n >= exp2 (2*m)
==>
harmonic_sum n >. Real.of_int mStatement (informal):
The sum of the reciprocals of the triangular numbers converges to
More formally, for all
where
Imandra statement
theorem sum_recip_tri_closed_form n =
n >= 0
==>
sum_recip_tri n = 2.0 -. (2.0 /. (Real.of_int (n+1)))Statement (informal):
For all
Imandra statement
theorem binomial_theorem n x y =
n >= 0 && x >= 0 && y >= 0
==> pow (x + y) n = binom_eval n x yStatement (informal):
If
Imandra statement
theorem powerset_len xs =
List.length (powerset xs) = pow 2 (List.length xs)Statement (informal):
The Königsberg Bridges Problem asks whether it is possible to take a walk through the city of Königsberg that crosses each of its seven bridges exactly once and returns to its starting point.
Euler showed that such a walk is impossible. In modern graph-theoretic terms, the corresponding graph has more than two vertices of odd degree, and thus has no Eulerian path.
We prove two versions:
- a concrete version, representing the specific Königsberg map and a purported (impossible) path of length 7 directly, which Imandra proves automatically, and
- a general version, using the abstract notion of Eulerian polarity and reasoning over permutations of edges, and then instantiating this to the configuration of Königsberg.
Imandra statement
theorem konigsberg_concrete start b1 b2 b3 b4 b5 b6 b7 =
not (eulerian start b1 b2 b3 b4 b5 b6 b7)
theorem konigsberg r p =
List.mem r regions && valid_path p r
==> not (permutation p bridges)58. Formula for Number of Combinations
Statement (informal):
For integers
Imandra statement
theorem choose_closed_form n k =
0 <= k && k <= n
==>
Binomial.choose n k = fact n / (fact k * fact (n - k))60. Bezout's Theorem
Statement (informal):
For all
In Imandra, we construct the Bezout coefficients with the function bezout_sub.
Imandra statement
let rec bezout_sub (a:int) (b:int) : int * int =
if a < 0 || b < 0 then (0,0)
else if a = 0 then (0,1)
else if b = 0 then (1,0)
else if a >= b then
let (u',v') = bezout_sub (a - b) b in
(u', v' - u')
else
let (u',v') = bezout_sub a (b - a) in
(u' - v', v')
theorem bezout a b =
let (u,v) = bezout_sub a b in
u*a + v*b = gcd a b65. Isosceles Triangle Theorem
Statement (informal):
In triangle
Imandra statement
theorem isosceles_triangle (a:point) (b:point) (c:point) =
neqp a b && neqp a c
&& dist2 a c = dist2 b c
==>
angle_eq (sub c a) (sub b a) (sub a b) (sub c b)69. Greatest Common Divisor Algorithm
Statement (informal):
For natural numbers
Imandra statement
let rec gcd (a:int) (b:int) : int =
if a < 0 || b < 0 then 0
else if a = 0 then b
else if b = 0 then a
else if a >= b then gcd (a - b) b
else gcd a (b - a)
theorem gcd_remainder_step a b =
a >= 0 && b > 0 ==> gcd a b = gcd b (a mod b)
theorem gcd_dvd_both_pos a b =
gcd a b > 0 ==> a mod (gcd a b) = 0 && b mod (gcd a b) = 0
theorem gcd_absorbs_common_divisor d a b =
d > 0 && a mod d = 0 && b mod d = 0 ==> (gcd a b) mod d = 074. Principle of Mathematical Induction
Statement (informal):
If
Imandra statement
axiom base prop =
prop 0
axiom inductive prop n =
n >= 0 && prop n ==> prop (n+1)
theorem induction prop n =
n >= 0 ==> prop n80. The Fundamental Theorem of Arithmetic
Statement (informal):
Every integer
Imandra statement
theorem prime_factorization_exists n =
n >= 2
==> all_prime (prime_factors n) && prod_list (prime_factors n) = n
theorem prime_factorization_unique xs ys =
all_prime xs && all_prime ys && prod_list xs = prod_list ys
==> permutation xs ys85. Divisibility by 3 Rule
Statement (informal):
An integer
Imandra statement
theorem sum_digits_preserves_mod3 n =
n >= 0 ==> n mod 3 = sum_digits n mod 391. The Triangle Inequality
Statement (informal):
For all vectors
Imandra statement
theorem triangle_inequality (x:R2.vec) (y:R2.vec) (nx:real) (ny:real) (nxy:real) =
let open Real in
let open R2 in
nx >= 0.0 && ny >= 0.0 && nxy >= 0.0 &&
nx * nx = norm x && ny * ny = norm y && nxy * nxy = norm (add x y)
==> nxy <= nx + nyContact
Grant Passmore ([email protected])