Skip to content

Instantly share code, notes, and snippets.

@MantasBaksys
Last active August 28, 2022 23:12
Show Gist options
  • Select an option

  • Save MantasBaksys/3efd5c0d42f440d16c09076db42822f2 to your computer and use it in GitHub Desktop.

Select an option

Save MantasBaksys/3efd5c0d42f440d16c09076db42822f2 to your computer and use it in GitHub Desktop.
AIME 1984 P1 (Human formalization)
/-
Copyright (c) 2021 OpenAI. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kunhao Zheng, Kudzo Ahegbebu, Stanislas Polu, David Renshaw, Mantas Bakšys, OpenAI GPT-f
-/
import minif2f_import
open_locale big_operators
open_locale nat
open_locale real
open_locale rat
-- Sum a sequence by grouping adjacent terms.
lemma sum_pairs (n : ℕ) (f : ℕ → ℚ) :
∑ k in (finset.range (2 * n)), f k = ∑ k in (finset.range n), (f (2 * k) + f (2 * k + 1)) :=
begin
induction n with pn hpn,
{ simp only [finset.sum_empty, finset.range_zero, mul_zero] },
{ have hs: (2 * pn.succ) = (2 * pn).succ.succ := rfl,
rw [finset.sum_range_succ, ←hpn, hs, finset.sum_range_succ, finset.sum_range_succ],
ring },
end
theorem aime_1984_p1
(u : ℕ → ℚ)
(h₀ : ∀ n, u (n + 1) = u n + 1)
(h₁ : ∑ k in finset.range 98, u k.succ = 137) :
∑ k in finset.range 49, u (2 * k.succ) = 93 :=
begin
-- We will use sum_pairs and h₀ to rewrite h₁ and the goal in terms of the quantity
-- ∑ k in finset.range 49, u (2 * k + 1).
have h₃: ∑ (x : ℕ) in finset.range 49, (1:ℚ) = 49 := by norm_num,
simp only [(show 98 = 2 * 49, by norm_num), sum_pairs, finset.sum_add_distrib, h₀,
finset.sum_add_distrib, ←add_assoc] at h₁,
simp only [← nat.add_one, mul_add, mul_one, h₀, finset.sum_add_distrib],
linarith,
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment