Skip to content

Commit c5221eb

Browse files
Merge pull request #198 from trishullab/michael
Isabelle & Coq verifications: 1983-1986
2 parents eefea68 + 2a0af3b commit c5221eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+200
-190
lines changed

coq/src/commented_problems.v

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,21 @@ Theorem putnam_1997_b4
166166
: forall k : nat, ge k 0 -> 0 <= (sum_n (fun i => (-1)^i * (IZR (a (Nat.sub k i) i))) (Z.to_nat (Coquelicot.Rcomplements.floor (2 * INR k / 3)))) <= 1.
167167
Proof. Admitted. *)
168168

169+
(* From mathcomp Require Import ssralg ssrnum fintype seq poly.
170+
Open Scope ring_scope.
171+
Variable (R: numDomainType).
172+
Definition putnam_1985_a6_solution : {poly R} := 6%:R *: 'X^2 + 5%:R *: 'X + 1%:R.
173+
Theorem putnam_1985_a6
174+
(g : {poly R} := 3%:R *: 'X^2 + 7%:R *: 'X + 2%:R)
175+
(Comp_poly_n := fix comp_poly_n (p : {poly R}) (n : nat) : {poly R} :=
176+
match n with
177+
| O => 1
178+
| S n' => comp_poly (comp_poly_n p n') p
179+
end)
180+
: forall (f: {poly R}), f`_0 = 0 ->
181+
forall (n: nat),
182+
let F : {poly R} := Comp_poly_n f n in
183+
let G : {poly R} := Comp_poly_n g n in
184+
(\sum_(i < size F) F`_i) = (\sum_(i < size G) G`_i)
185+
<-> f = putnam_1985_a6_solution.
186+
Proof. Admitted. *)

coq/src/putnam_1983_a3.v

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
Require Import Nat Reals ZArith Znumtheory Coquelicot.Coquelicot.
2-
Open Scope R.
1+
Require Import Nat ZArith Znumtheory.
2+
Open Scope nat_scope.
3+
Fixpoint nat_sum (a : nat -> nat) (k : nat) : nat :=
4+
match k with
5+
| O => a O
6+
| S k' => a k + nat_sum a k'
7+
end.
38
Theorem putnam_1983_a3
4-
(f : nat -> nat -> R := fun n p => sum_n (fun i => INR ((i+1) * n^i)) (p-1))
5-
: forall (p m n: nat), odd p = true /\ prime (Z.of_nat p) /\ (floor (f m p)) mod Z.of_nat p = (floor (f n p)) mod Z.of_nat p -> Z.of_nat m mod Z.of_nat p = Z.of_nat n mod Z.of_nat p.
9+
(p : nat)
10+
(hp : odd p = true /\ prime (Z.of_nat p))
11+
(f : nat -> nat := fun n => nat_sum (fun i => (i+1) * n^i) (p-2))
12+
: forall (a b : nat), a < p /\ b < p /\ a <> b -> (f a) mod p <> (f b) mod p.
613
Proof. Admitted.

coq/src/putnam_1983_a4.v

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Require Import Binomial Reals Znumtheory Coquelicot.Coquelicot.
1+
Require Import Binomial Reals Coquelicot.Coquelicot.
22
Open Scope nat_scope.
33
Theorem putnam_1983_a4
4-
(m: nat)
5-
(hm : m mod 6 = 5)
6-
: sum_n (fun n => (if (eq_nat_dec (n mod 3) 2) then Binomial.C m n else R0)) (m-2) <> R0.
4+
(k : nat)
5+
(kpos : k > 0)
6+
(m : nat := 6 * k - 1)
7+
(s : R := sum_n_m (fun j => Rmult ((-1) ^ (j + 1)) (Binomial.C m (3 * j - 1))) 1 (2*k - 1))
8+
: s <> R0.
79
Proof. Admitted.

coq/src/putnam_1983_a5.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Require Import Nat Reals Coquelicot.Coquelicot.
2-
Definition putnam_1983_a5_solution := true.
1+
Require Import Nat ZArith Reals Coquelicot.Coquelicot.
2+
Definition putnam_1983_a5_solution := True.
33
Theorem putnam_1983_a5
4-
: exists (a: R), forall (n: nat), gt n 0 -> even (Z.to_nat (floor (Rpower a (INR n))) - n) = putnam_1983_a5_solution.
4+
: (exists a : R, a > 0 /\ forall n : nat, gt n 0 -> Z.Even (floor (a^n) - Z.of_nat n)) <-> putnam_1983_a5_solution.
55
Proof. Admitted.

coq/src/putnam_1983_a6.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Require Import Reals Coquelicot.Coquelicot.
22
Definition putnam_1983_a6_solution := 2 / 9.
33
Theorem putnam_1983_a6
4-
: Lim_seq (fun a => let a := INR a in a ^ 4 * exp (-a ^ 3) * RInt (fun x => RInt (fun y => exp (x ^ 3 + y ^ 3)) 0 (a - x)) 0 a) = putnam_1983_a6_solution.
4+
(F : R -> R := fun a => (a ^ 4 / exp (a ^ 3)) * RInt (fun x => RInt (fun y => exp (x ^ 3 + y ^ 3)) 0 (a - x)) 0 a)
5+
: filterlim F (Rbar_locally p_infty) (locally putnam_1983_a6_solution).
56
Proof. Admitted.

coq/src/putnam_1983_b4.v

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
Require Import Reals Coquelicot.Coquelicot.
2-
Open Scope R.
1+
Require Import ZArith Reals Coquelicot.Coquelicot.
2+
Open Scope Z_scope.
33
Theorem putnam_1983_b4
4-
(m: nat)
5-
(f : R -> R := fun n => n + IZR (floor (sqrt n)))
4+
(m : Z)
5+
(hm : m > 0)
6+
(f : Z -> Z := fun n => n + floor (sqrt (IZR n)))
67
(A := fix a (n: nat) :=
78
match n with
8-
| O => INR m
9+
| O => m
910
| S n' => f (a n')
1011
end)
11-
: exists (i: nat) (q: Z), A i = IZR (floor (A i)) /\ floor (A i) = Z.mul q q.
12+
: exists (i : nat) (s : Z), A i = s^2.
1213
Proof. Admitted.

coq/src/putnam_1983_b5.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Require Import Nat Reals Coquelicot.Coquelicot.
22
Open Scope R.
33
Definition putnam_1983_b5_solution := ln (4/PI).
44
Theorem putnam_1983_b5
5-
(mindist : R -> R := fun x => Rmin (Rabs (x - IZR (floor x))) (Rabs (x - IZR (floor (x+1)))))
6-
: Lim_seq (fun n => 1/(INR n) * (RInt (fun x => mindist (INR n/x)) 1 (INR n))) = putnam_1983_b5_solution.
5+
(mindist : R -> R := fun x => Rmin (x - IZR (floor x)) (IZR (floor (x+1)) - x))
6+
: Lim_seq (fun n => (1/INR n) * (RInt (fun x => mindist (INR n/x)) 1 (INR n))) = putnam_1983_b5_solution.
77
Proof. Admitted.

coq/src/putnam_1984_a2.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Require Import Reals Coquelicot.Coquelicot.
22
Open Scope nat_scope.
3+
(* Uses division by 0 in the first term of the series. *)
34
Definition putnam_1984_a2_solution := 2%R.
45
Theorem putnam_1984_a2
5-
(f : nat -> R := fun n => Rdiv (pow 6 n) ((pow 3 (n+1) - pow 2 (n+1)) * pow 3 n - pow 2 n))
6+
(f : nat -> R := fun n => Rdiv (pow 6 n) ((pow 3 (n+1) - pow 2 (n+1)) * (pow 3 n - pow 2 n)))
67
: Series f = putnam_1984_a2_solution.
78
Proof. Admitted.

coq/src/putnam_1984_a5.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Require Import Reals Factorial Coquelicot.Coquelicot.
22
Open Scope R.
3-
Definition putnam_1984_a5_solution := INR (fact 9 * fact 8 * fact 4 / fact 25).
3+
Definition putnam_1984_a5_solution := INR (fact 9 * fact 8 * fact 4) / INR (fact 25).
44
Theorem putnam_1984_a5
55
: RInt (fun z => RInt (fun y => RInt (fun x => x * pow y 9 * pow z 8 * pow (1 - x - y - z) 4) 0 (1 - y - z)) 0 (1 - z)) 0 1 = putnam_1984_a5_solution.
66
Proof. Admitted.

coq/src/putnam_1984_b1.v

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
Require Import Factorial ZArith Reals Coquelicot.Coquelicot.
1+
Require Import Factorial ZArith.
22
Open Scope Z.
3-
Definition putnam_1984_b1_solution (coeff1 coeff2 : nat -> Z) (n1 n2 : Z) := (coeff1 = fun x => match x with | O => 3 | S O => 1 | _ => 0 end) /\ (coeff2 = fun x => match x with | O => -2 | S O => -1 | _ => 0 end) /\ n1 = 1 /\ n2 = 1.
3+
Fixpoint nat_sum (a : nat -> nat) (k : nat) : nat :=
4+
match k with
5+
| O => a O
6+
| S k' => a k + nat_sum a k'
7+
end.
8+
Fixpoint Z_sum (a : nat -> Z) (k : nat) : Z :=
9+
match k with
10+
| O => a O
11+
| S k' => a k + Z_sum a k'
12+
end.
13+
Definition putnam_1984_b1_solution : (nat -> Z) * (nat -> Z) := (fun x => match x with | O => 3 | S O => 1 | _ => 0 end, fun x => match x with | O => -2 | S O => -1 | _ => 0 end).
414
Theorem putnam_1984_b1
5-
(f : nat -> Z := fun n => (floor (sum_n (fun i => INR (fact (i + 1))) n)))
6-
(p: (nat -> Z) -> Z -> (nat -> Z) := fun coeff n => (fun x => (floor (sum_n (fun i => IZR ((coeff i) * (Z.of_nat (x ^ i)))) (Z.to_nat n + 1)))))
7-
: exists (coeff1 coeff2 : nat -> Z) (n1 n2 : Z),
8-
let fix F (n: nat) :=
9-
match n with
10-
| O => f 0%nat
11-
| S O => f 1%nat
12-
| S ((S n'') as n') => (p coeff1 n1) n' * F n' + (p coeff2 n2) n'' * F n''
13-
end in
14-
f = F -> putnam_1984_b1_solution coeff1 coeff2 n1 n2.
15+
(f : nat -> Z)
16+
(poly : nat -> (nat -> Z) -> nat -> Z := fun k p n => Z_sum (fun i => (p i) * (Z.of_nat (n ^ i))) k)
17+
(deg : (nat -> Z) -> nat)
18+
(finpoly : (nat -> Z) -> Prop := fun p => (exists k : nat, p k <> 0) /\ (exists m : nat, forall n : nat, gt n m -> p n = 0))
19+
(hdeg : forall p : nat -> Z, finpoly p -> (p (deg p) <> 0 /\ forall n : nat, gt n (deg p) -> p n = 0))
20+
(hf : forall n : nat, gt n 0 -> f n = (Z_sum (fun i => Z.of_nat (fact i)) n) - Z.of_nat (fact 0))
21+
: finpoly (fst putnam_1984_b1_solution) /\ finpoly (snd putnam_1984_b1_solution) /\
22+
forall n : nat, ge n 1 -> f (Nat.add n 2) = poly (deg (fst putnam_1984_b1_solution)) (fst putnam_1984_b1_solution) n * f (Nat.add n 1) + poly (deg (snd putnam_1984_b1_solution)) (snd putnam_1984_b1_solution) n * f n.
1523
Proof. Admitted.

0 commit comments

Comments
 (0)