-
Notifications
You must be signed in to change notification settings - Fork 339
feat(Other/Rule30): Wolfram's Rule 30 Prize Problems (non-periodicity & equal frequency) #4377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Deicyde
wants to merge
2
commits into
google-deepmind:main
Choose a base branch
from
Deicyde:add-rule30-prize-problems
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /- | ||
| Copyright 2026 The Formal Conjectures Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| https://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| -/ | ||
|
|
||
| import FormalConjectures.Util.ProblemImports | ||
|
|
||
| /-! | ||
| # The Rule 30 Prize Problems | ||
|
|
||
| **Rule 30** is the elementary cellular automaton with local update `c' = l ⊕ (c ∨ r)`, the | ||
| Boolean rule numbered `30` by Wolfram. Started from a single black cell on a bi-infinite row, | ||
| its **center column** `t ↦ (state t) 0` looks random — it was long *Mathematica*'s default | ||
| pseudorandom generator — yet nothing about that randomness is proven. In 2019 Wolfram offered | ||
| the **Rule 30 Prizes** for three questions about it; we formalize the first two. | ||
|
|
||
| * **Problem 1.** Is the center column non-periodic (never eventually periodic)? | ||
| * **Problem 2.** Does each color occur on average equally often, i.e. does the running average | ||
| of the values converge to `1 / 2`? | ||
|
|
||
| Problem 3 — whether computing the `n`-th cell requires at least `~O(n)` work — is omitted. It is | ||
| model-relative and has no canonical model-independent phrasing. All three are open. | ||
|
|
||
| *References:* | ||
| - [Announcing the Rule 30 Prizes](https://writings.stephenwolfram.com/2019/10/announcing-the-rule-30-prizes/), | ||
| Stephen Wolfram, 2019. | ||
| - [Rule 30 Prizes](https://rule30prize.org/). | ||
| - [Wikipedia: Rule 30](https://en.wikipedia.org/wiki/Rule_30). | ||
| -/ | ||
|
|
||
| open Filter Topology | ||
|
|
||
| namespace Rule30 | ||
|
|
||
| /-- The Rule 30 local update on a bi-infinite row `row : ℤ → Bool`. | ||
| The new value at `i` is `row (i-1) ⊕ (row i ∨ row (i+1))`, i.e. Wolfram's rule `30`. -/ | ||
| def step (row : ℤ → Bool) : ℤ → Bool := | ||
| fun i => xor (row (i - 1)) (row i || row (i + 1)) | ||
|
|
||
| /-- The Rule 30 evolution from the single-black-cell initial condition: `state 0` is black | ||
| exactly at position `0`, and each subsequent row is obtained by applying `step`. -/ | ||
| def state : ℕ → ℤ → Bool | ||
| | 0 => fun i => decide (i = 0) | ||
| | t + 1 => step (state t) | ||
|
|
||
| @[simp, category API, AMS 37 68] | ||
| theorem state_zero (i : ℤ) : state 0 i = decide (i = 0) := rfl | ||
|
|
||
| @[simp, category API, AMS 37 68] | ||
| theorem state_succ (t : ℕ) : state (t + 1) = step (state t) := rfl | ||
|
|
||
| /-- The **center column** of Rule 30: the value of the single central cell (position `0`) | ||
| at time `t`. -/ | ||
| def centerColumn (t : ℕ) : Bool := state t 0 | ||
|
|
||
| /-- Sanity check: the first center-column values reproduce the known Rule 30 center column | ||
| ([OEIS A051023](https://oeis.org/A051023)). Unlike `state_zero`/`state_succ`, this exercises the | ||
| composed evolution, guarding against a wrong seed, a swapped `xor`/`||`, or an off-by-one | ||
| neighbour index. -/ | ||
| @[category test, AMS 37 68] | ||
| theorem centerColumn_prefix : | ||
| (List.range 8).map centerColumn = [true, true, false, true, true, true, false, false] := by | ||
| decide | ||
|
|
||
| /-- The center-column value at time `t` as a real number (`1` for black, `0` for white). -/ | ||
| def centerReal (t : ℕ) : ℝ := if centerColumn t then 1 else 0 | ||
|
|
||
| /-- **Rule 30 Prize, Problem 1 (non-periodicity).** The center column of Rule 30 is not | ||
| eventually periodic: there is no positive period `p` and threshold `N` past which the column | ||
| repeats with period `p`. -/ | ||
| @[category research open, AMS 37 68] | ||
| theorem centerColumn_not_eventually_periodic : | ||
| answer(sorry) ↔ | ||
| ¬ ∃ p : ℕ, 0 < p ∧ ∃ N : ℕ, ∀ t : ℕ, N ≤ t → centerColumn (t + p) = centerColumn t := by | ||
| sorry | ||
|
|
||
| /-- **Rule 30 Prize, Problem 2 (equal frequency).** Each color occurs on average equally often | ||
| in the center column: the running average of the center-column values converges, and its limit | ||
| is `1 / 2`. Equivalently, in Wolfram's phrasing, the discrete limit of `Total[c[t]] / t` as | ||
| `t → ∞` is `1 / 2`. -/ | ||
| @[category research open, AMS 37 68] | ||
| theorem centerColumn_frequency_half : | ||
| answer(sorry) ↔ | ||
| Tendsto (fun t : ℕ => (∑ s ∈ Finset.range t, centerReal s) / t) atTop (𝓝 (1 / 2)) := by | ||
| sorry | ||
|
|
||
| end Rule30 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have
Set.HasDensityin our repo, so it is perhaps simpler to re-use that?! This would have the additional advantage that one could delete the ad-hoccenterRealdefinitionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mo271 just applied your suggestion. Thanks for the review!