Recovering Classical Evolutionary Ecology from Generative Models: Selection, Drift, and Coarse-Graining under Active Inference
A monograph by Daniel Ari Friedman (Active Inference Institute) and the source that reproduces every number, table and figure in it.
- Read the monograph: PDF on the Zenodo record, which also archives this source tree.
- Cite it: see How to cite or CITATION.cff.
- Reproduce it: see Install and reproduce.
Organisms adjust their behavior within a lifetime. Populations change across generations through who reproduces, what is transmitted, and which environments descendants meet. Active inference describes the first process as inference and action under a generative model. Classical evolutionary ecology describes the second with results on selection, drift, inheritance and growth. The monograph asks when the descriptions agree, what each must specify before they can be compared, and which predictions survive when a model is read at a coarser scale.
Each classical result is studied in a finite model where it can be computed exactly. The settings carry the same decimal position in the Introduction, Methods, Results and Discussion.
| Setting | Finding |
|---|---|
| Bayesian conditioning and reproductive selection | Selection equals conditioning only when reproductive weights are proportional to a stated likelihood. |
| Price accounting | Selection and transmission are separate terms, and sampling descendants reweights lineage paths. |
| Wright–Fisher drift and fixation | Sampling only the lineages that later fix changes the apparent early course of a neutral population. |
| Lande–Arnold response | A selection gradient predicts the inherited response only under stated covariance and inheritance conditions. |
| Kelly–Cohen growth and cue-driven switching | Whether using a cue helps long-run growth depends on cue reliability, environmental persistence and switching cost. |
| Filtering, precision learning and synaptic change | Changing contacts alters held-out prediction separately from fast state estimation. |
| Moran dynamics and coarse-graining | A threshold reduction loses forecast accuracy, and a reduction that holds across a full cycle fails when repeated at every census. |
| Ecological inheritance through a shared resource | Cue use alters the resource and the composition that later generations inherit. |
| Classical channels and measurement order | Classical transport is recovered, and order effects need no nonclassical substrate. |
The evidence is analytical and synthetic: exact identities, machine-checked Lean proofs of selected results, enumerated finite laws and controlled simulations. A single comparison uses measured behavior, leaving rules fitted to public mouse patch-foraging records (Webb et al. 2025, license CC-BY-4.0, 10.5281/zenodo.15104572) and scored on held-out sessions and animals. That comparison concerns leaving decisions only: it tests no claim about inheritance, reproduction or fitness, and a good score does not show that animals compute a belief posterior.
- Agent models are authored files. Every model whose inference is reported is a Generalized Notation Notation (GNN) file under models, read through a pinned GNN package and audited against native conditioning.
- Reproduction is a separate law. A reproductive law turns realized actions and environmental states into descendants, so inference and reproduction are never assumed to be the same thing.
- Every reported value is generated. The manuscript sources in markdown take each number from a registry built by the code in src/synthesis; a release gate rebuilds the PDF and checks it against its sources.
- Selected identities are proved. formal/Evolution.lean builds against a pinned upstream Lean library.
Requirements: uv, the Python interpreter named in .python-version, Git, and, for the complete build, the Pandoc, Pandoc Crossref, BibTeX and XeLaTeX tools and the Lean compiler listed in the generated tables of current reproduction. The same page holds the pinned upstream repositories and revisions in its upstream-pins block, and the selected tool and package versions in its software blocks. This README restates none of them.
-
Install the frozen environment from the repository root. The
integrationextra supplies JAX for native GNN execution.uv sync --frozen --extra integration --group dev
-
Check out each upstream repository named in the upstream-pins block of current reproduction at its pinned revision (a detached worktree at that revision leaves another checkout alone), then point these variables at the checkouts. Source admission refuses a checkout whose HEAD differs from the pinned commit or whose owner files differ in
SHA-256from the manifests. Nothing fetches, installs or repins a source automatically.Variable Meaning GNN_ROOTGeneralized Notation Notation checkout; required for every native inference run, including numerical tests FEP_FORMAL_ROOTfep_formalcheckout, the upstream Lean foundationsCOGNITIVE_ROOTcognitivecheckout, used for the vocabulary concordanceACTIVE_INFERENCE_ONTOLOGY_ROOTActive Inference Ontology checkout FEP_TEMPLATE_ROOTdocxology/templatecheckout that renders the manuscriptFEP_FORMAL_LEAN_BINLean executable at the pinned toolchain; FEP_FORMAL_LAKE_PACKAGESoptionally names prebuilt Lean dependenciesFEP_OUTPUT_DIRA new, empty directory that receives a run; scripts.verifyrequires it andscripts.reproducedefaults tooutput/revisionFEP_ECOSYSTEM_OUTPUT_DIR,FEP_GNN_AUDIT_OUTPUT_DIR,FEP_ATLAS_OUTPUT_DIRFresh output directories of the focused producers (the same destinations can be passed as arguments where a producer offers them) WEBB_FORAGING_ROOTOptional; raw public mouse records, needed only to re-derive the committed foraging table with scripts.derive_webb_patchesAn output directory can be any writable location, including one that a scheduler or container runtime assigns; the code reads no other output-location variable.
-
Run the release gate on the exact checkout, with a new output directory.
FEP_OUTPUT_DIR=/path/to/new-run PYTHONPATH=src \ uv run --frozen --no-sync python -m scripts.verify release
The gate checks the lockfile, Ruff lint and format and the locked type baseline, then runs the full reproduction and the artifact checkers. Its source-bound
release-gate.jsonrecords the passing test count and hashes the evidence. A release candidate needs a fresh successful receipt for its exact source cut. The lower-levelscripts.reproducecommand is the reproduction producer alone, andpython -m scripts.verify numericalruns the numerical checks on the active interpreter.
The reproduction guide gives source identities and environment policy, usage guide gives the input and artifact contracts, and formal reproduction covers the Lean build. The examples guide lists focused command payloads, each of which needs a fresh output destination. For example, the generator RG study and the bounded synthesis audit run as follows:
PYTHONPATH=src uv run --frozen --no-sync python -m scripts.run_rg_memory \
--output-dir /path/to/new-run/rg-memory-study
uv run --frozen --no-sync python -m scripts.run_synthesis_audit \
--gnn-root "$GNN_ROOT" --formal-root "$FEP_FORMAL_ROOT" \
--cognitive-root "$COGNITIVE_ROOT" \
--ontology-root "$ACTIVE_INFERENCE_ONTOLOGY_ROOT" \
--output-dir /path/to/new-run/synthesis-auditThe generator RG study requires a fresh directory and retains the same rg-memory sidecar, numerical archive and figures as full reproduction, including figures/rg-filtering-budget in PDF, SVG and PNG. When a stage fails, it keeps the partial products and writes failure.json with the failing stage, the error type and message, and the local source hashes, then exits nonzero; a directory that holds failure.json never reads as a fresh success. The primary-source ledger and finite derivation give the source scope and analytical hypotheses.
Every root is required. GNN and formal roots must match config/upstream_sources.json; ontology roots must match config/ontology_concordance.json. A detached worktree at a declared revision preserves the active upstream checkout. No fetch, installation or automatic repinning occurs. The audit records formal source admission only; the separate Lean gate supplies theorem evidence.
The full scripts.reproduce command computes and retains operator-witness.npz and operator-witness.json, the ecological arrays and summaries, the configured result figures, full-page concordances and the native cover. The integration extra supplies JAX for native GNN execution. The declared Pandoc, Pandoc Crossref, BibTeX and XeLaTeX tools, the admitted docxology/template tree, the exact Lean compiler and built manifest-pinned formal dependencies are required for the complete build (formal reproduction). Missing capabilities fail explicitly, and a frozen lock, current metadata or an earlier output directory cannot substitute for a new successful reproduction receipt.
Production inference requires GNN_ROOT and the pinned native semantic runner, including when invoked by numerical tests. Population, statistical and generator tests remain independently executable. Source admission and per-family execution counts accompany the outputs; a local probability oracle is never a substitute production backend. The publication path is described in the rendering contract: the validated reference registry generates BibTeX, Pandoc/natbib and BibTeX resolve linked author-year citations and DOI links, and the native template owns the author block, graphical cover and contents. Publication metadata controls author details, typography and margins. The date on the cover is not stored anywhere: it is the committer date, in UTC, of the commit being built. A checkout reads it from git, and a source archive from config/commit_timestamp.txt, which git archive fills in through the export-subst attribute. A tree with neither source fails the build instead of using the current date, and CITATION.cff and .zenodo.json carry no date because a static file cannot hold the date of its own commit. Equations receive automatic TeX numbers and stable labels, and source-bound registries insert symbols, equations, settings, outcomes and references and retain their uses and hashes in manuscript-variables.json.
Nothing in the reproduction workflow publishes manuscripts or changes repository visibility.
Cite as: Friedman, D. A. (2026). Recovering Classical Evolutionary Ecology from Generative Models. Zenodo, 10.5281/zenodo.24522522. The archived record at that DOI holds the monograph PDF and the source tree of the same version, and it links back to this repository, https://github.com/ActiveInferenceInstitute/FEP_Evolution.
The same reference is machine-readable in CITATION.cff, and the Zenodo metadata is in .zenodo.json. Cite the foraging data separately as Webb et al. (2025), 10.5281/zenodo.15104572, and the reference article in actinf_varsynth/docs/refs as stated there.
The monograph text, source code, models and configuration are licensed under Apache-2.0 (LICENSE). Some material carries its own terms:
data/reference/DEM_Dendrites.matis unchanged reference data from the SPM project underGPL-2.0-or-later; its license is retained in SPM-LICENCE.md, and the data note states the provenance. No SPM code is vendored.- The committed foraging table derived from Webb et al. (2025) is an adaptation under
CC-BY-4.0with credit to the authors (data note). - The Entropy article files in actinf_varsynth/docs/refs are
CC-BY-4.0and remain the work of their authors.
| Path | Responsibility |
|---|---|
| src/synthesis | Qualified finite methods, experiments and artifact generation (implementation guidance) |
| models | Authored GNN models with separate model-wide audit receipts |
| formal/Evolution.lean | Actual upstream imports and downstream finite-law proofs (formal guide) |
| markdown | Manuscript sources; authoring guide for equations, citations, captions and cross-references |
| config | Declared designs, source pins, publication metadata and the reference registry |
| scripts | Orchestration entry points: scripts/verify.py, scripts/reproduce.py and the focused producers |
| tests | Analytic identities, failure controls, native integration and artifact contracts |
| data | Reference data and the derived empirical table, each with provenance and license notes |
| docs | Usage, architecture and workflow guides, method notes, scholarship ledgers and reproduction guides, listed in the documentation map |
| actinf_varsynth | Historical exploratory Lean project with Python bindings, kept for its build checks and the reference article in its docs/refs |
| repo_utilities | Housekeeping helpers: glossary generation, markdown validation, and build, open and cleanup wrappers |
| .github | CI workflows, issue and pull-request templates, Dependabot configuration |
| .basedpyright | The locked type-check baseline |
Authored GNN models cover the inherited sensory controller, the resource-context controller, the biological-settings forager, the synaptic sequence and precision-screen models, the coupled ecosystem agent, phenotypic switching and its comparator, the foraging belief, the passive first-exit observation protocol, the paired exit survey, the passive filter channels of the coarse filtering comparison, the Dirichlet likelihood and the Bayes reference of the experiment. The model files, their kinds and their counts are generated in counts. The forager's A/B/C/D tables are extracted from its GNN file; config/biological_settings.json names that file and keeps only the world, reproduction and carrier declarations. Every model declares the pinned required sections (a section-name check, not full schema validation; the Gaussian model does not pass strict categorical validation), and RuntimeBoundary and ConcordanceBoundary are project extensions. Production inference and action scoring of the authored models use the admitted native GNN implementation, except for the computations that stay outside the GNN path, and a separate all-model audit validates each authored model in its own receipt epoch. Statistical, population and matrix calculations retain their distinct computational roles. config/experiment.json, biological settings, replicated populations and the other study configurations own the declared designs. Simulation dispersion, Monte Carlo uncertainty, paired contrasts and exact population laws answer different questions; none is empirical validation of an organism or ecosystem. The mouse foraging comparison is behavioral and does not validate an inheritance or fitness mechanism.
| Study | What it computes | Controls and limits that accompany it |
|---|---|---|
| Biological settings | Gaussian quantitative-genetic references, explicit clonal transmission and replicated finite populations | Paired arms share random draws; infinite-population targets stay references; a separate precision-identifiability calculation shows which experimental crossings separate policy precision from the utility contrast |
| Finite populations | Independently enumerated Wright-Fisher count laws, deadline conditioning and coalescence | A joint census comparison over the whole enumerated support reports total variation against its sampling baseline; a family statistic over slot triples separates family-size patterns that the pair statistic cannot |
| Switching | Inherited phenotype abundance along shared finite environmental histories | Exact history enumeration; cue-blind and preference-only controls; a refined search of each policy grid so the compared optima are not artifacts of coarse grids |
| Synaptic adaptation | Native phase inference with held-out conditional predictive scores | Paired structural intervention on contacts; approximate precision learning stated as such |
| Generator renormalization and memory (methods, derivation) | Declared aggregation, lifting, clocks, projected memory, initial forcing, survivor conditioning and coarse filtering | A generator-defect error bound, an analytic nonreversible control separating restricted closure from closure for every initial law, and a fixed-lag readout control showing that aggregation across consecutive censuses can recover a forecast that iterated reconstruction of the hidden state changes |
| Observation windows | Passive first-exit and paired-read benchmarks | Cause-specific prevalence identification under stated detection assumptions; minimax forecast limits and partial-identification bounds when observation models share every report probability |
| Ecosystem | Private cues, individual actions, a persistent resource, realized offspring weights and inherited precision types | Paired feedback and neutral-reproduction controls against an independently enumerated finite-state law; a conditional census law compared with an independent binomial at the same mean parent probability; a signed cue sweep with a cue-relabeling control that restores the authored law |
| Foraging records and leaving-rule models | Per-patch records derived from public freely moving mouse sessions, and the leaving rules of the rule list (constant hazard, elapsed time, time since reward, recent reward cue, belief-state reward rate) scored by held-out log loss, within animal and across animals, with animal-level sign tests and sensitivity analyses | The only measured data in the repository and a behavioral comparison of descriptive decision rules only; no inheritance, reproduction, fitness or neural claim, and no test of the authors' models; raw recordings stay outside the repository, and a derived table with provenance is committed under data/empirical |
| Operator witness | A diagonal completely positive trace-preserving embedding of an authored classical channel, and a separate order-sensitive measurement protocol | A classical stored-bit model with disturbance reproduces each order table, so order effects alone do not identify a quantum substrate; ordinary linear algebra, no quantum backend |
The lineage comparison uses the same realized trees to distinguish founder-followed paths, within-cohort descendant samples and pooled descendant samples. The coarse filtering comparison tests forecast and emission errors separately, with report channels and initial laws extracted from models/rg_filter_channel.md. The survival analysis adds an absorbing outcome, evidence scores and conditional composition, and compares deadline-conditioned Wright-Fisher trajectories. The signed cue comparison varies the physical cue channel while holding the authored native GNN controller fixed. The passive observation model is a benchmark over consecutive censuses for missed detection and coarse records; its native GNN updates and independent rational path reference compare the same population transition under the survey models of its design. The paired exit survey contrasts exact capture-recapture calibration under conditional independence with an observationally equivalent dependent channel.
The extended formal target proves posterior and variational-free-energy, policy-reweighting, expected action-output, chronological-composition and conditional-fitness statements using the imported upstream interfaces. The generator-defect bound, the minimax forecast limits, the classical stored-bit rival and the cue relabeling control are analytic numerical controls that sit outside the compiled proof target. Physical quantum biology, polycomputing and generalized probability remain qualified research horizons; classical scholarship records the foundational sources and their access limits.
The front matter follows a fixed order: the author cover, the full-page graphical concordances, the written Abstract, the contents, a reading guide to notation and ontology, and then the Introduction. The paired-survey results open with a worked example: observation models of the same cohort assign the same probability to every survey report, yet they predict different next-census loss, so the record alone cannot decide the forecast.
The Introduction, Methods, Results and Discussion each begin with an overview and then use the same decimal positions for the scientific domains of the domain registry: Bayesian selection and variational inference; Price accounting; Wright-Fisher drift; Lande-Arnold response; Kelly-Cohen growth and switching; learning and synaptic adaptation; renormalization group, Moran dynamics and memory; ecological inheritance; and classical/operator probability. The Introduction gives each domain its scholarly context, Methods define the recovery conditions, Results give the analytical and synthetic evidence, and Discussion identifies the biological measurements that could test the connection. The declared source order and domain registry are checked during production; the domain guide and IMRAD outline explain the structure. The systems-biology scholarship ledger qualifies the historical, experimental and conceptual sources, and the bibliography registry records source access and claim limits. The analytical contribution and evidence scope separates exact identities, conditional recoveries, added process-model structure and prospective empirical application.
The upstream sources and the native renderer are frozen independently of release archive citations. The manifests (upstream, ontology concordance, renderer) define the admitted inputs, and the software registry and the frozen lock record the selected tools and packages. Current reproduction generates the tables of pinned commits and selected versions from those files, and counts states the same values in a structured record. Observations of the latest stable release are separate evidence from installed-version and execution checks, and compatibility jobs do not imply complete native reproduction on every supported interpreter.
The formal toolchain follows the admitted upstream; its compiler and Mathlib pins are in the manifest above. Use the FEP_FORMAL_LEAN_BIN variable for the executable. Current upstream citations distinguish version-specific archives, source commits, ontology content releases and software foundation papers, and the GNN integration note records the executed interfaces.
| Guide | Contents |
|---|---|
| usage guide, examples, domain showcase, manuscript authoring, FAQ | Usage, focused payloads, the domain showcase, writing manuscript sources and common questions |
| architecture, workflow, CONTRIBUTING, AGENTS, roadmap, TODO | Ownership, the development and closeout workflow, contribution rules, scoped open items and longer-term research directions |
| SECURITY, CODE_OF_CONDUCT | How to report a vulnerability and the community conduct policy |
| counts and its structured record counts.json | Generated counts, pins, versions and thresholds that the other documents point to instead of restating |
| current reproduction, native CI, type checking, template rendering, inference execution map | Version policy, hosted validation, the type baseline, the renderer and where each inference method runs |
| assessment, documentation contracts, legacy model selection | Implemented controls and limits, documentation contracts and the exploratory compatibility APIs |
| evolutionary information, evolutionary bridges, selection identifiability, classical concordance, formal crosswalk, ontology concordance | Mathematical derivations, identification boundaries and source-bound concordances |
| evolutionary synthesis, analytical claims, scholarship guide, evolutionary scholarship, scholarship expansion, classical scholarship, observation windows, coarse-graining comparator, variational synthesis map, RG source ledger | Literature, source access and claim boundaries |
| foraging records, leaving-rule models, switching, synaptic study, ecosystem, generator RG, finite RG memory, biological settings | Study methods and their controls |