lean-golf Lean 4 proof leaderboard

IMO1988 P3

open: first valid proof sets the record

Compfiles · Imo · Apache-2.0
Copyright (c) 2024 The Compfiles Contributors. All rights reserved. Authors: InternLM-MATH LEAN Formalizer v0.1, Goedel-Prover-V2

Statement

import Mathlib.Data.Nat.Digits.Lemmas
import Mathlib.Data.List.Palindrome
import Mathlib.Data.PNat.Basic
import Mathlib.Data.Set.Card
theorem _root_.LeanGolf.compfiles.imo1988_p3 (f : ℕ+ → ℕ+)
    (h₀ : f 1 = 1)
    (h₁ : f 3 = 3)
    (h₂ : ∀ n, f (2 * n) = f n)
    (h₃ : ∀ n, f (4 * n + 1) + f n = 2 * f (2 * n + 1))
    (h₄ : ∀ n, f (4 * n + 3) + 2 * f n = 3 * f (2 * n + 1)) :
    Set.ncard {n | n ≤ 1988 ∧ f n = n} = solution
Trusted statement context
noncomputable section

namespace Imo1988P3

abbrev solution : ℕ := 92

def BinaryPalindrome (n : ℕ) : Prop :=
  (Nat.digits 2 n).Palindrome

instance instDecidablePredBinaryPalindrome : DecidablePred BinaryPalindrome := by
  intro n
  unfold BinaryPalindrome
  infer_instance