Skip to content

chore: commit open changes [lean-runtime-analysis]#22

Merged
Jonathangadeaharder merged 7 commits into
masterfrom
chore/pr-open-changes
May 17, 2026
Merged

chore: commit open changes [lean-runtime-analysis]#22
Jonathangadeaharder merged 7 commits into
masterfrom
chore/pr-open-changes

Conversation

@Jonathangadeaharder
Copy link
Copy Markdown
Collaborator

@Jonathangadeaharder Jonathangadeaharder commented May 17, 2026

Open changes from working tree

  • Add .lake/config/ to .gitignore (untracked build artifacts)
  • Remove tracked .lake/config/ files from index

Summary by CodeRabbit

  • New Features

    • Enhanced selection kernel using a CDF-based best-of-λ distribution
    • Added selection-amplification analysis with a proved amplification bound
  • Documentation

    • Updated blueprint/site links to point to project documentation
  • Chores

    • Updated ignore patterns for build/config artifacts
    • Improved CI setup to avoid redundant installer runs, use persistent cache symlink, and relax audit exclusions for config files

Review Change Stack

Copilot AI review requested due to automatic review settings May 17, 2026 11:37
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cbb71f27-89c4-43f1-b7fc-314ebdd489f5

📥 Commits

Reviewing files that changed from the base of the PR and between bc4f2e5 and ee84778.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

This PR replaces the placeholder selection kernel with a Hamming-weight CDF-based best-of-λ selection measure and completes the sel_amplification_bound proof; it also updates .gitignore, tightens CI admit exclusions for LintOptions.lean, updates blueprint URLs to drift-lean, and edits the lakefile header/lean_exe line.

Changes

Selection Amplification Kernel Improvements

Layer / File(s) Summary
CDF-Based Selection Measure Construction
LBTCoupling.lean
Adds Mathlib.Analysis.Complex.ExponentialBounds import. Introduces sel_cdf computing best-of-λ CDF by Hamming weight and redefines coea_sel_measure as a weight-level measure that spreads mass uniformly across bitstrings of each weight; adds coea_sel_measure_prob and coea_sel_measure_cdf lemmas (proofs sorry).
Selection Amplification Bound Completion
LBTCoupling.lean
Adds sel_monotone_level, mutation_prob_lower_bound, and coea_measure_ge_from_count statements (proofs sorry), provides a chain of inequality lemmas culminating in a proved sel_exp_inequality, and replaces sel_amplification_bound's sorry with a completed proof using the new measure decomposition and inequalities.

Project Infrastructure and Rebranding

Layer / File(s) Summary
Build Environment and CI
.gitignore, .github/workflows/ci.yml, lakefile.lean, WitnessVeto.lean
Adds .lake/config/ and .worktrees/ to .gitignore. Updates CI Check for admit and Summary steps to exclude LintOptions.lean from admit scans/counts. Edits lakefile header and the lean_exe «drift_lean» where line. Simplifies a proof step in WitnessVeto.lean.
Documentation and Blueprint Rebranding
blueprint/src/web.tex
Updates \home, \github, and \dochome macro URLs to reference the drift-lean project instead of the previous project.

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇 I hop through bits where Hamming weights play,
CDFs pick the best in a clever array.
Proofs stitch their seams, one sorry turned right,
CI and docs rebadged, the tree trimmed light.
Hop, patch, merge — carrots tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore: commit open changes [lean-runtime-analysis]' is vague and generic, using the non-descriptive phrase 'open changes' without conveying what the actual changes are. Replace with a more specific title that describes the main changes, such as 'chore: update .gitignore and CI workflow, implement selection kernel in LBTCoupling' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/pr-open-changes

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@blueprint/src/web.tex`:
- Around line 17-19: Update the broken URLs used for site metadata: locate the
LaTeX/macros entries \home, \github, and \dochome in the file (currently
pointing to https://Jonathangadeaharder.github.io/drift-lean and
https://github.com/Jonathangadeaharder/drift-lean) and either rename them to
match an existing repository (rename repository to drift-lean) or revert the
URLs to the correct repository name (replace "drift-lean" with
"lean-runtime-analysis") so the three commands \home, \github, and \dochome
point to valid, non-404 destinations.

In `@LBTCoupling.lean`:
- Around line 586-603: The three lemmas coea_sel_measure_prob,
coea_sel_measure_cdf, and coea_measure_ge_from_count are left as sorry; either
prove them or explicitly mark them as trusted assumptions. To fix: implement
proofs for coea_sel_measure_prob by unfolding coea_sel_measure, handling the
degenerate dirac case (use Measure.dirac_apply_of_mem) then group the sum by
Hamming weight and telescope the sum ∑_w C(n,w)·(cdf(w+1)-cdf(w))/C(n,w) to get
1; implement coea_sel_measure_cdf by unfolding coea_sel_measure and coea_measure
on the A_ge (A_lvl n) k sets and showing the CDF identity 1 - (1 - μ)^λ from the
independent best-of-λ selection definition; and prove coea_measure_ge_from_count
similarly by relating counts to μ(A_ge(k)). If you intend these as axioms,
replace each sorry with a clear trusted axiom/lemma and document it, otherwise
complete the formal proofs in the lemmas named above.
- Around line 567-582: The coea_sel_measure currently spreads mass uniformly
across bitstrings of equal Hamming weight, which breaks the semantics for
lambda_pop = 1 because coea_sel_measure 1 P must equal coea_measure; fix by
replacing the uniform-within-weight construction with the true argmax selection
distribution (i.e. define a sel_argmax_dist lambda_pop P that assigns to each x
the probability that x is the argmax offspring under P, resolving ties uniformly
among equally-fit offspring), then use sel_argmax_dist in place of the current
uniform decomposition inside coea_sel_measure (and update any uses in
expected_generations to use this argmax distribution); alternatively, if you
intend to keep the level-uniform measure, move the related theorem to a
weight-quotiented state space and rename coea_sel_measure to reflect that it is
the level-uniform measure to avoid changing the original process (refer to
coea_sel_measure, coea_measure, sel_cdf, expected_generations, Population, and
BitString in your edits).

In `@LBTCoupling.lean.bak`:
- Around line 1-6: LBTCoupling.lean.bak is a leftover backup that interferes
with the Lake build; remove the file or move it out of the source tree (e.g., to
docs/ or archive/) so Lake doesn’t try to compile it; ensure only
LBTCoupling.lean remains in the repository and verify lakefile.lean still
references the intended source file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c777c59e-c888-48c6-8528-7a312d05d226

📥 Commits

Reviewing files that changed from the base of the PR and between aa98cc9 and 522ff85.

📒 Files selected for processing (9)
  • .github/workflows/blueprint.yml
  • .github/workflows/ci.yml
  • .gitignore
  • LBTCoupling.lean
  • LBTCoupling.lean.bak
  • blueprint/src/web.tex
  • deep_think_rlocal.md
  • lake-manifest.json
  • lakefile.lean

Comment thread blueprint/src/web.tex
Comment thread LBTCoupling.lean
Comment on lines +567 to +582
/-- Selection measure via weight-level CDF decomposition.
The mass at bitstring x is:
(sel_cdf(hamming_weight(x) + 1) - sel_cdf(hamming_weight(x))) / C(n, hw(x))
This distributes the probability that the best offspring has weight = w
uniformly over the C(n,w) bitstrings at that weight level.

Key property: μ_sel(A_ge(k)) = 1 - (1 - μ(A_ge(k)))^λ = 1 - sel_cdf(k). -/
noncomputable def coea_sel_measure {n : ℕ} (lambda_pop : ℕ)
(P : Population (BitString n) lambda_pop) : Measure (BitString n) :=
if lambda_pop = 0 then Measure.dirac (fun _ => false)
else coea_measure lambda_pop P

else
∑ x : BitString n,
let w := hamming_weight x
let weight := (sel_cdf lambda_pop P (w + 1) - sel_cdf lambda_pop P w) /
↑(Nat.choose n w)
weight • Measure.dirac x
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

This changes the Markov process instead of just encoding best-of-λ.

For lambda_pop = 1, best-of-1 should reduce to coea_measure, but this construction redistributes each weight level uniformly over all bitstrings with that Hamming weight. Unless coea_measure is already uniform within every level, coea_sel_measure 1 P is a different distribution. Since expected_generations evolves the full Population (BitString n) lambda_pop, this changes the process being bounded rather than merely quotienting the proof to level events. Please either construct the actual argmax distribution or move the theorem to an explicit weight-quotiented state space.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@LBTCoupling.lean` around lines 567 - 582, The coea_sel_measure currently
spreads mass uniformly across bitstrings of equal Hamming weight, which breaks
the semantics for lambda_pop = 1 because coea_sel_measure 1 P must equal
coea_measure; fix by replacing the uniform-within-weight construction with the
true argmax selection distribution (i.e. define a sel_argmax_dist lambda_pop P
that assigns to each x the probability that x is the argmax offspring under P,
resolving ties uniformly among equally-fit offspring), then use sel_argmax_dist
in place of the current uniform decomposition inside coea_sel_measure (and
update any uses in expected_generations to use this argmax distribution);
alternatively, if you intend to keep the level-uniform measure, move the related
theorem to a weight-quotiented state space and rename coea_sel_measure to
reflect that it is the level-uniform measure to avoid changing the original
process (refer to coea_sel_measure, coea_measure, sel_cdf, expected_generations,
Population, and BitString in your edits).

Comment thread LBTCoupling.lean
Comment on lines 586 to +603
lemma coea_sel_measure_prob {n : ℕ} (lambda_pop : ℕ)
(P : Population (BitString n) lambda_pop) :
coea_sel_measure lambda_pop P Set.univ = 1 := by
dsimp [coea_sel_measure]
split_ifs with h
· simp [Measure.dirac_apply_of_mem (Set.mem_univ _)]
· exact coea_measure_univ lambda_pop P
· -- Group the sum by weight level, then telescope
-- ∑_x weight(x) = ∑_w C(n,w) · (cdf(w+1) - cdf(w)) / C(n,w)
-- = ∑_w (cdf(w+1) - cdf(w)) = cdf(n+1) - cdf(0) = 1
sorry

/-- Key CDF property: μ_sel(A_ge(k)) = 1 - (1 - μ(A_ge(k)))^λ.
This is the defining property of the best-of-λ selection measure. -/
lemma coea_sel_measure_cdf {n : ℕ} (lambda_pop : ℕ)
(P : Population (BitString n) lambda_pop) (k : ℕ) :
coea_sel_measure lambda_pop P (A_ge (A_lvl n) k) =
1 - (1 - coea_measure lambda_pop P (A_ge (A_lvl n) k)) ^ lambda_pop := by
sorry
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Core selection guarantees are still unresolved on the proof path to the runtime bound.

coea_sel_measure_prob, coea_sel_measure_cdf, and coea_measure_ge_from_count are still sorry, but they are immediately used to manufacture IsMarkovKernel and to close sel_amplification_bound, which then feeds G1 and the final theorem. So the new selection kernel and amplification result are still resting on unverified obligations. If this is intentionally outside the mechanized boundary, please surface it explicitly as trusted assumptions; otherwise the core result here is still incomplete.

Also applies to: 611-614, 643-649, 814-830

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@LBTCoupling.lean` around lines 586 - 603, The three lemmas
coea_sel_measure_prob, coea_sel_measure_cdf, and coea_measure_ge_from_count are
left as sorry; either prove them or explicitly mark them as trusted assumptions.
To fix: implement proofs for coea_sel_measure_prob by unfolding
coea_sel_measure, handling the degenerate dirac case (use
Measure.dirac_apply_of_mem) then group the sum by Hamming weight and telescope
the sum ∑_w C(n,w)·(cdf(w+1)-cdf(w))/C(n,w) to get 1; implement
coea_sel_measure_cdf by unfolding coea_sel_measure and coea_measure on the A_ge
(A_lvl n) k sets and showing the CDF identity 1 - (1 - μ)^λ from the independent
best-of-λ selection definition; and prove coea_measure_ge_from_count similarly
by relating counts to μ(A_ge(k)). If you intend these as axioms, replace each
sorry with a clear trusted axiom/lemma and document it, otherwise complete the
formal proofs in the lemmas named above.

Comment thread LBTCoupling.lean.bak
Comment on lines +1 to +6
import LintOptions
import Hoeffding
import Mathlib.Probability.Kernel.Basic
import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.MeasureTheory.MeasurableSpace.Instances
import Mathlib.Analysis.SpecialFunctions.Log.Basic
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there's already a LBTCoupling.lean file that this is backing up
fd -e lean -g '*LBTCoupling*'

# Check lakefile to see what files are expected to be built
cat lakefile.lean 2>/dev/null | head -50

Repository: Jonathangadeaharder/lean-runtime-analysis

Length of output: 1288


Remove or relocate the .bak backup file.

This is a backup file. The actual source file LBTCoupling.lean already exists and is included in the build system (see lakefile.lean). Since the .bak extension prevents compilation by Lake, either delete it if no longer needed or move it to a docs/, archive/, or similar non-source directory to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@LBTCoupling.lean.bak` around lines 1 - 6, LBTCoupling.lean.bak is a leftover
backup that interferes with the Lake build; remove the file or move it out of
the source tree (e.g., to docs/ or archive/) so Lake doesn’t try to compile it;
ensure only LBTCoupling.lean remains in the repository and verify lakefile.lean
still references the intended source file.

Jonathan Gadea Harder and others added 3 commits May 17, 2026 14:13
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lakefile.lean`:
- Around line 26-30: Remove the unresolved merge-conflict markers (<<<<<<< HEAD,
=======, >>>>>>>) and the duplicated lean_exe «drift_lean» declaration so only a
single, valid lean_exe «drift_lean» where block remains; locate the conflicting
lines containing the symbols <<<<<<< HEAD, =======, >>>>>>> and the two
occurrences of lean_exe «drift_lean» and delete the conflict markers and the
extra duplicate declaration, preserving the intended configuration from one of
the blocks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27b9e031-9d12-4f07-b109-08a8a8450907

📥 Commits

Reviewing files that changed from the base of the PR and between 522ff85 and 209fac9.

📒 Files selected for processing (4)
  • .gitignore
  • LBTCoupling.lean
  • blueprint/src/web.tex
  • lakefile.lean
✅ Files skipped from review due to trivial changes (2)
  • blueprint/src/web.tex
  • .gitignore

Comment thread lakefile.lean Outdated
Added 7 private helper lemmas translating Corus et al. 2018 Lemma 18:
- one_sub_pow_le_exp_neg_mul: (1-p)^n ≤ exp(-pn)
- exp_neg_le_sub_ratio: exp(-x) ≤ (n-1)/n when x ≥ log(n/(n-1))
- log_ratio_le_two_div: log(n/(n-1)) ≤ 2/n for n ≥ 2
- exp_eight_le_3072, log_3072_ge_eight: exp(8) ≤ 3072
- key_bound: 4n·log(128(n+1)n³)/e ≥ 2/n
- one_sub_pow_le_ratio: (1-p)^λ ≤ (n-1)/n

Also: replaced axiomatized coea_sel_measure with real CDF-based
definition (sel_cdf + weight-level decomposition), added
coea_sel_measure_cdf lemma (sorry), added ExponentialBounds import.

Sorry count: 8 → 7 (sel_exp_inequality closed).
@Jonathangadeaharder Jonathangadeaharder merged commit ee84778 into master May 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants