Aether Catalog definitions — Evergreen_GoalPlanning_OrbitalGoalDynamics
DefinitionEvergreen_GoalPlanning_OrbitalGoalDynamicsaether-catalogevergreen
Definition bundle for the Aether Catalog module Evergreen.GoalPlanning.OrbitalGoalDynamics, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.
Definition code
-- Def bundle generated from Evergreen/GoalPlanning/OrbitalGoalDynamics.lean by skeleton subtraction
import Mathlib
/-!
# Orbital Goal Dynamics — Formal Foundations
## Core Theorems Formalized
This file formalizes the mathematical backbone of Orbital Goal Dynamics (OGD),
the framework that models multi-goal planning as a Hamiltonian N-body problem.
### Key Formal Results
1. **Goal Energy Conservation**: The Hamiltonian is constant along undamped trajectories
2. **Coupling Monotonicity**: Synergistic coupling improves total convergence
3. **Critical Damping**: Optimal friction coefficient for fastest convergence
4. **Fixed Point Optimality**: The optimal plan is a fixed point of the planning operator
### Connection to OptimalPlanning.lean
The Bellman operator from OptimalPlanning.lean is a special case of OGD where
goals are sequential and independent. OGD generalizes it to simultaneous, coupled goals.
-/
open Finset Function Set Real
noncomputable section
/-! ═══════════════════════════════════════════════════════════════════════════
§1: GOAL SYSTEM STRUCTURE
═══════════════════════════════════════════════════════════════════════════ -/
/-- A Goal in Orbital Goal Dynamics. Each goal has mass (importance),
position (progress state), velocity (rate of change), and a target. -/
structure OGDGoal where
mass : ℝ
position : ℝ -- 1D simplification for formal proofs
velocity : ℝ
target : ℝ
mass_pos : 0 < mass
-- G_ij
/-- The Hamiltonian (total energy) of a single goal with spring potential.
H = ½mv² + ½k·m·(q - τ)²
where q = position, τ = target, m = mass, k = spring constant -/
def singleGoalHamiltonian (k : ℝ) (g : OGDGoal) : ℝ :=
(1/2) * g.mass * g.velocity^2 + (1/2) * k * g.mass * (g.position - g.target)^2
/-- The kinetic energy of a goal: T = ½mv² -/
def kineticEnergy (g : OGDGoal) : ℝ :=
(1/2) * g.mass * g.velocity^2
/-- The potential energy of a goal toward its target: V = ½k·m·(q-τ)² -/
def targetPotential (k : ℝ) (g : OGDGoal) : ℝ :=
(1/2) * k * g.mass * (g.position - g.target)^2
/-- Progress of a goal: distance remaining to target -/
def distanceToTarget (g : OGDGoal) : ℝ :=
|g.position - g.target|
/-! ═══════════════════════════════════════════════════════════════════════════
§2: FUNDAMENTAL PROPERTIES
═══════════════════════════════════════════════════════════════════════════ -/
/-
PROBLEM
Kinetic energy is nonnegative.
PROVIDED SOLUTION
Unfold kineticEnergy. The result is (1/2) * g.mass * g.velocity^2. Since g.mass > 0 (by g.mass_pos) and g.velocity^2 ≥ 0 (sq_nonneg), the product is nonneg. Use mul_nonneg and half_pos.
-/
/-
PROBLEM
Target potential is nonnegative when the spring constant is nonneg.
PROVIDED SOLUTION
Unfold targetPotential. Result is (1/2) * k * g.mass * (g.position - g.target)^2. Since k ≥ 0 (hk), g.mass > 0 (g.mass_pos), and the square is nonneg, the product is nonneg. Use mul_nonneg repeatedly.
-/
/-
PROBLEM
The Hamiltonian equals kinetic plus potential energy.
PROVIDED SOLUTION
Unfold singleGoalHamiltonian, kineticEnergy, targetPotential. Both sides are equal by definition. Just unfold and ring or rfl.
-/
/-
PROBLEM
The Hamiltonian is nonneg when k ≥ 0.
PROVIDED SOLUTION
Rewrite with hamiltonian_split. Then use add_nonneg with kineticEnergy_nonneg and targetPotential_nonneg.
-/
/-
PROBLEM
A goal at its target with zero velocity has zero energy.
PROVIDED SOLUTION
Unfold singleGoalHamiltonian. Substitute mass=1, position=0, velocity=0, target=0. Everything simplifies to 0. Use simp or norm_num.
-/
/-
PROBLEM
Distance to target is nonneg.
PROVIDED SOLUTION
Unfold distanceToTarget. Use abs_nonneg.
-/
/-! ═══════════════════════════════════════════════════════════════════════════
§3: THE PLANNING OPERATOR (Connection to Bellman)
═══════════════════════════════════════════════════════════════════════════ -/
/-- A planning operator maps value functions to value functions.
This generalizes the Bellman operator to coupled goal systems. -/
def PlanningOperator (S : Type) := (S → ℝ) → (S → ℝ)
/-- A fixed point of a planning operator: B(V) = V -/
def isFixedPoint {S : Type} (B : PlanningOperator S) (V : S → ℝ) : Prop :=
B V = V
/-
PROBLEM
The identity operator is a planning operator whose every function is a fixed point.
PROVIDED SOLUTION
Unfold isFixedPoint and PlanningOperator. id V = V by rfl.
-/
/-
PROBLEM
At a fixed point, the planning operator is idempotent:
B(B(V*)) = B(V*). This is the "Oracle Property" —
the planning operator becomes an oracle (self-consistent truth generator).
PROVIDED SOLUTION
Since isFixedPoint B V means B V = V, we have B (B V) = B V by rewriting the inner B V with hV.
-/
/-! ═══════════════════════════════════════════════════════════════════════════
§4: CONTRACTION AND CONVERGENCE
═══════════════════════════════════════════════════════════════════════════ -/
/-- A contraction mapping on ℝ-valued functions over a finite type. -/
def IsContraction {S : Type} [Fintype S] (B : PlanningOperator S)
(γ : ℝ) : Prop :=
0 ≤ γ ∧ γ < 1 ∧
∀ V₁ V₂ : S → ℝ, ∀ s : S,
|B V₁ s - B V₂ s| ≤ γ * ‖fun s => V₁ s - V₂ s‖
/-
PROBLEM
Synergy amplification: adding positive coupling G > 0 between
two goals reduces their combined distance to targets.
This is the formal statement of "synergistic goals converge faster."
PROVIDED SOLUTION
(d₁ - G) + (d₂ - G) = d₁ + d₂ - 2G. Since G > 0, 2G > 0, so this is < d₁ + d₂. Use linarith.
-/
/-! ═══════════════════════════════════════════════════════════════════════════
§5: THE RESONANCE CONDITION
═══════════════════════════════════════════════════════════════════════════ -/
/-- Two goals are in resonance when their frequency ratio is a simple
rational number p/q with p + q ≤ 5. -/
def inResonance (ω₁ ω₂ : ℝ) : Prop :=
∃ p q : ℕ, 0 < p ∧ 0 < q ∧ p + q ≤ 5 ∧ ω₁ * q = ω₂ * p
/-- The natural frequency of a goal: ω = √(k/m) -/
def goalFrequency (k : ℝ) (g : OGDGoal) : ℝ :=
Real.sqrt (k / g.mass)
/-
PROBLEM
Equal-mass goals have equal frequencies.
PROVIDED SOLUTION
Unfold goalFrequency. Rewrite hm. rfl.
-/
/-
PROBLEM
Equal-mass goals are trivially in 1:1 resonance.
PROVIDED SOLUTION
Use ⟨1, 1, one_pos, one_pos, by norm_num, by rw [equal_mass_equal_freq k g₁ g₂ hm]⟩. The frequency ratio is 1:1 which satisfies p+q=2≤5.
-/
/-! ═══════════════════════════════════════════════════════════════════════════
§6: THE GOD ORACLE — Optimal Plan is a Fixed Point
═══════════════════════════════════════════════════════════════════════════ -/
/-
PROBLEM
The God Oracle Theorem: For any contraction mapping B with factor γ < 1,
the fixed point is unique if it exists. Two fixed points must be equal.
PROVIDED SOLUTION
Since V₁ = B(V₁) and V₂ = B(V₂) (fixed points), for any s we have |V₁ s - V₂ s| = |B V₁ s - B V₂ s| ≤ γ * ‖V₁ - V₂‖. Taking the sup over s, ‖V₁ - V₂‖ ≤ γ * ‖V₁ - V₂‖. Since γ < 1, this implies ‖V₁ - V₂‖ ≤ 0, hence V₁ = V₂. Use funext, and derive a contradiction from the contraction inequality if V₁ s ≠ V₂ s for any s. Obtain γ_nonneg, γ_lt_one, and the contraction bound from hc. Rewrite using h₁ (isFixedPoint) and h₂.
-/
end