Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions FormalConjectures/OEIS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# OEIS Formalization Guidelines

This directory contains formalizations of conjectures and theorems associated with integer sequences from the [On-Line Encyclopedia of Integer Sequences (OEIS)](https://oeis.org/).

When contributing to or reviewing formalizations in this directory, please follow the specific conventions outlined below in addition to the general repository guidelines in [`AGENTS.md`](../../AGENTS.md).

## File Naming & Work-in-Progress (WIP) Status

- **Naming**: Files must be named after their OEIS number **without leading zeros** (e.g., `56777.lean`, `308734.lean`).

## Sequence Definition Naming

The primary defining sequence in each OEIS file must be named `a` (e.g., `def a (n : ℕ) : ℕ := ...`). Do not name the function after the OEIS number (`A224515`) or use uppercase letters. Secondary auxiliary sequences (such as denominators) may be named `b`, `c`, etc.

## Namespaces

Every file must enclose all its declarations within a dedicated namespace matching `OeisA[Number]` (without leading zeros). This namespace should open immediately after the imports and module docstring, and close at the very end of the file.

```lean
namespace OeisA308734

-- definitions, helper lemmas, term theorems, and main conjecture

end OeisA308734
```

## Module Docstrings & References

Every file must include a descriptive module docstring (`/-! ... -/`) immediately following the imports.
- **Content**: The docstring should clearly explain the sequence definition and the statement of the conjecture or theorem being formalized.
- **References**: It must conclude with a standardized `*References:*` (or `*Reference:*` for a single item) section containing a Markdown link to the official OEIS page, along with any other papers or articles necessary to formulate the problem.

```lean
/-!
# Four-square conjecture with powers of 2, 3, and 5

Any integer $n > 1$ can be written as $(2^a \cdot 3^b)^2 + (2^c \cdot 5^d)^2 + x^2 + y^2$
where $a, b, c, d, x, y$ are nonnegative integers.

*References:*
- [A308734](https://oeis.org/A308734)
- Z.-W. Sun, "Refining Lagrange's four-square theorem," *J. Number Theory* **175** (2017), 167-190.
-/
```

## Main Theorem Docstrings

The main problem or conjecture (typically the last theorem in the file) must have a dedicated docstring (`/-- ... -/`).
- **Verbatim Citation**: The docstring must cite the conjecture from OEIS verbatim.
- **Proof Attribution**: For solved problems where an AI-driven formal proof was found, the bottom of the docstring must include the following attribution line:
`A formal proof has been found with the methods described in [arxiv/2605.22763](https://arxiv.org/abs/2605.22763).`

```lean
/--
Any integer $n > 1$ can be written as $(2^a \cdot 3^b)^2 + (2^c \cdot 5^d)^2 + x^2 + y^2$
where $a, b, c, d, x, y$ are nonnegative integers.

A formal proof has been found with the methods described in [arxiv/2605.22763](https://arxiv.org/abs/2605.22763).
-/
@[category research solved, AMS 11, formal_proof using formal_conjectures at ...]
theorem target_theorem_0 : ...
```

## Term Theorems (`category test`)

To ensure the formalized definition behaves correctly and matches the official OEIS sequence, every file **must include term theorems verifying the first few values of the sequence** (typically the first 5 values).

- **Official Alignment**: Verify the starting index ($n=0, 1, 2, \dots$) and exact initial values against the official OEIS `b-file` (`https://oeis.org/A[padded_number]/b[padded_number].txt`).
- **Attributes**: Every term theorem must be tagged with `@[category test, AMS 11]` (or another appropriate AMS subject).
- **Computable Definitions**: If the sequence definition is kernel-computable, prove the term theorems using `by rfl`, `by decide`, `by norm_num`, or by unfolding the definition.
- **Noncomputable Definitions**: For complex or `noncomputable` definitions where kernel evaluation is not possible:
- Use appropriate helper lemmas to establish values rigorously (e.g., `csInf_eq_of_forall_ge_of_forall_gt_exists_lt` for `sInf`-based definitions, or `Int.floor_eq_iff` for real number bounds).

```lean
@[category test, AMS 11]
lemma test_a_0 : a 0 = 1 := by rfl

@[category test, AMS 11]
lemma test_a_1 : a 1 = 1 := by rfl
```
Loading