Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Aether Catalog definitions — Speculative_AutoResearch_DegreeMonoidRealisation

Definition
Speculative_AutoResearch_DegreeMonoidRealisation

by raver1975 · Sep 13, 2026 · Mathlib c5ea003 (Lean v4.30.0)

aether-catalogspeculative

Definition bundle for the Aether Catalog module Speculative.AutoResearch.DegreeMonoidRealisation, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.

Definition code
-- Def bundle generated from Speculative/AutoResearch/DegreeMonoidRealisation.lean by skeleton subtraction
import Mathlib
/-
# Degree monoids of abstract transition systems and the realisation theorem

An abstract computation is modelled by a *transition relation* `R : α → α → Prop`
on a state space `α`.  For a distinguished state `a` the set

  `{ n | a is reachable from a in exactly n R-steps }`

is the **degree monoid** `degreeMonoid R a`: it contains `0` and is closed under
addition, because two return loops can be concatenated (`iterR_add`).  It is the
basic *periodic invariant* of a state of a machine: the set of possible lengths
of computations that bring the machine back to the same configuration.

This file develops the theory:

* `iterR` — `n`-step reachability, with the concatenation law `iterR_add`;
* `degreeMonoid R a : AddSubmonoid ℕ` — the invariant;
* structural laws: monotonicity under simulations (`degreeMonoid_le_of_simulation`),
  invariance under bisimulation (`degreeMonoid_eq_of_bisim`), and the
  *product law* `degreeMonoid (prodRel R S) (a, b) = degreeMonoid R a ⊓ degreeMonoid S b`;
* the **realisation theorem** `degreeMonoid_chainRel`: the chain system generated by a set
  `S` of loop lengths has degree monoid `AddSubmonoid.closure S`, so *every* additive
  submonoid of `ℕ` occurs as a degree monoid (`degreeMonoid_chainRel_submonoid`).  Consequently the invariant is *complete*:
  the realisable set of degree monoids is exactly the lattice of additive
  submonoids of `ℕ` (`degreeMonoid_range`);
* the certified extremes and sample values: `⊥ = {0}`, `⊤ = ℕ`,
  `nℕ` (single-loop machine) and the numerical semigroup `⟨2,3⟩` (two-loop machine).

Everything is proved from scratch; no `sorry`, no `native_decide`.
-/

namespace Computation
namespace DegreeMonoid

variable {α β : Type*}

/-! ## Exact-length reachability -/

/-- `iterR R n a b` says that `b` is reachable from `a` in **exactly** `n` steps of the
transition relation `R`. -/
def iterR (R : α → α → Prop) : ℕ → α → α → Prop
  | 0, a, b => a = b
  | n + 1, a, c => ∃ b, R a b ∧ iterR R n b c

@[simp] theorem iterR_zero (R : α → α → Prop) (a b : α) : iterR R 0 a b ↔ a = b := Iff.rfl

theorem iterR_succ (R : α → α → Prop) (n : ℕ) (a c : α) :
    iterR R (n + 1) a c ↔ ∃ b, R a b ∧ iterR R n b c := Iff.rfl


theorem iterR_refl (R : α → α → Prop) (a : α) : iterR R 0 a a := rfl

/-- **Concatenation law.**  A path of length `m + n` is a path of length `m` followed by a
path of length `n`.  This is the engine behind the monoid structure. -/
theorem iterR_add (R : α → α → Prop) (m n : ℕ) (a c : α) :
    iterR R (m + n) a c ↔ ∃ b, iterR R m a b ∧ iterR R n b c := by
  induction m generalizing a with
  | zero => simp
  | succ m ih =>
      rw [show m + 1 + n = (m + n) + 1 by ring, iterR_succ]
      constructor
      · rintro ⟨b, hab, hb⟩
        obtain ⟨c', h1, h2⟩ := (ih b).1 hb
        exact ⟨c', ⟨b, hab, h1⟩, h2⟩
      · rintro ⟨b, ⟨d, had, hdb⟩, hbc⟩
        exact ⟨d, had, (ih d).2 ⟨b, hdb, hbc⟩⟩


/-! ## The degree monoid -/

/-- The **degree monoid** of a state: the set of lengths of closed computations at `a`.
It is an additive submonoid of `ℕ` by `iterR_add`. -/
def degreeMonoid (R : α → α → Prop) (a : α) : AddSubmonoid ℕ where
  carrier := {n | iterR R n a a}
  zero_mem' := iterR_refl R a
  add_mem' := by
    intro m n hm hn
    exact (iterR_add R m n a a).2 ⟨a, hm, hn⟩


/-! ## Functoriality: simulations and bisimulations -/




/-! ## Time rescaling: powers of a machine -/



/-! ## Products: the invariant is a lattice meet -/

/-- Synchronous product of two transition systems. -/
def prodRel (R : α → α → Prop) (S : β → β → Prop) : α × β → α × β → Prop :=
  fun p q => R p.1 q.1 ∧ S p.2 q.2



/-! ## The chain system realising an arbitrary submonoid -/

/-- The **chain system** generated by a set `S ⊆ ℕ` of loop lengths.  States are natural
numbers; a positive state `i` counts down deterministically (`i → i - 1`), while the base
state `0` may jump to `s - 1` for any nonzero `s ∈ S`, i.e. it enters a loop of length
exactly `s`. -/
def chainRel (S : Set ℕ) : ℕ → ℕ → Prop :=
  fun i j => (i = 0 ∧ j + 1 ∈ S) ∨ i = j + 1






/-! ## Certified extremes and sample values -/








/-! ## A first structural consequence of realisation -/


end DegreeMonoid
end Computation

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me