Original joint-protocol pure rank: definitions and checked support lemmas
DefinitionAPFOriginalJointPureRank_20260914Fix each original physical context, its admitted classes of complete protocols, full nonnegative calibrated resource bills, and finite held budget . For a feasible family , let be the infimum of those original bills. A distinction is support-novel over a prefix when some positive window above the original infimum contains no original admitted prefix protocol maintaining sufficient support for it, including support not explicitly requested by the prefix.
Assume the original same-protocol subfamily law at budget-admissible ambient families, and the adopted positive uniform B05 floor : each support-novel addition raises the original infimum by at least , with both prefix and extended family originally feasible and within . These premises retain the original joint class and its valuation throughout.
Let be the maximum length of a list of distinct members of , starting at the empty family, with each member support-novel over its preceding prefix. For an originally admissible family,
The rank counts additions requiring new support. It need not equal the total number of carried distinctions and can be zero. This reconstructs the existing Paper 1 implication directly in its original class. The adopted uniform floor is not derived here, and the held service-class floor transfer is not validated. The subfamily law is an explicit formal premise supported by the cited original source meaning, not a consequence of an unconstrained OriginalData record.
This support module contains the ten original-class definitions and eleven proved helpers used by the occupant theorem. It preserves complete bills, original near-optimal support and both budget domains. No additional original-J empty-zero law or cost-minimizing protocol is consumed.
import Definitions.Def_APFOperationalOccupancy_20260914
import Theorems.Thm_APFPaper1_Ranks_extension_union
import Mathlib.Data.ENNReal.Real
import Mathlib.Data.Nat.Cast.Order.Basic
set_option autoImplicit false
open Classical APFOriginalSource APFUpstreamOccupant APFPaper1.Foundation
open APFPaper1.Ranks APFOperationalOccupancy
noncomputable section
attribute [local instance] Classical.propDecidable
namespace APFOriginalJointRank
variable {X Q R Record : Type*} [AddCommMonoid R] [Preorder R]
variable {Cont : X → Set Q} {D : Set (PhysicalState Cont → Bool)} {protocols : Set Q}
/-- Literal feasibility in the separately retained original joint class. -/
def JFeasible (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : Prop := ∃ p, p ∈ O.jointClass S
/-- Original finite-family infimum budget, without an affordable-p witness. -/
def JAdmissible (O : OriginalData Cont D protocols R Record) (C : NNReal)
(S : Finset (OriginalTask Cont D)) : Prop :=
JFeasible O S ∧ originalCost O S ≤ (C : ENNReal)
/-- Real notation for the unchanged original ENNReal valuation. Physical cost
claims below use it only at feasible families, where the infimum is finite. -/
def jCost (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : ℝ := (originalCost O S).toReal
def JPrices (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : Set ℝ :=
{c | ∃ p, p ∈ O.jointClass S ∧ bill O.service p = c}
/-- Near-optimal original-J competitors, retaining all unrequested support. -/
def JNovel (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) (d : OriginalTask Cont D) : Prop :=
∃ η : ℝ, 0 < η ∧ ∀ p, p ∈ O.jointClass S →
bill O.service p ≤ jCost O S + η → ¬ MaintainsSufficient O.service p d
/-- P1's same-complete-protocol subfamily clause at its admitted ambient-family
scope (v9.25:2744-2750,2844-2850). Explicit original-source law; not derivable
from arbitrary OriginalData.joint_support alone. No global Ledger closure. -/
def JSubfamilyAtBudget (O : OriginalData Cont D protocols R Record) (C : NNReal) : Prop :=
∀ T U, U ⊆ T → JAdmissible O C T → ∀ p,
p ∈ O.jointClass T → p ∈ O.jointClass U
/-- Granted B05, on precisely the original J valuation and original near-optimal
support condition. BOTH original infimum-budget domains remain explicit. -/
def JB05 (O : OriginalData Cont D protocols R Record) (C : NNReal) (ε : ℝ) : Prop :=
0 < ε ∧ ∀ T d, JAdmissible O C T → JAdmissible O C (insert d T) →
JNovel O T d → ε ≤ jCost O (insert d T) - jCost O T
def JAllNovel (O : OriginalData Cont D protocols R Record) :
Finset (OriginalTask Cont D) → List (OriginalTask Cont D) → Prop
| _, [] => True
| T, d :: ds => JNovel O T d ∧ JAllNovel O (insert d T) ds
def jPureValues (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : Set ℕ :=
{k | ∃ ds : List (OriginalTask Cont D), ds.Nodup ∧ ds.toFinset ⊆ S ∧
JAllNovel O ∅ ds ∧ ds.length = k}
/-- P1's maximum original support-novel chain length, not a service rank. -/
def jPureRank (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : ℕ := sSup (jPureValues O S)
theorem original_cost_finite (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) (hS : JFeasible O S) : originalCost O S ≠ ⊤ := by
obtain ⟨p, hp⟩ := hS
apply ne_top_of_le_ne_top (by simp :
(O.service.calibration (O.service.wholeResource p) : ENNReal) ≠ ⊤)
exact (sInf_le (show (O.service.calibration (O.service.wholeResource p) : ENNReal) ∈
originalPrices O S from ⟨p, hp, rfl⟩))
/-- Exact scalar-infimum identity; no comparison with the larger service class. -/
theorem jCost_price_infimum (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) (_hS : JFeasible O S) :
jCost O S = sInf (JPrices O S) := by
unfold jCost originalCost
rw [ENNReal.toReal_sInf _ (by
intro c hc
obtain ⟨p, hp, rfl⟩ := hc
simp)]
congr 1
ext c
constructor
· rintro ⟨z, ⟨p, hp, rfl⟩, hc⟩
exact ⟨p, hp, by simpa [bill, resource] using hc⟩
· rintro ⟨p, hp, hc⟩
exact ⟨(O.service.calibration (O.service.wholeResource p) : ENNReal),
⟨p, hp, rfl⟩, by simpa [bill, resource] using hc⟩
/-- Finite original ENNReal cost and its real notation are exactly equal. -/
theorem jCost_ofReal (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) (hS : JFeasible O S) :
ENNReal.ofReal (jCost O S) = originalCost O S := by
exact ENNReal.ofReal_toReal (original_cost_finite O S hS)
theorem admissibility_real_identity (O : OriginalData Cont D protocols R Record)
(C : NNReal) (S : Finset (OriginalTask Cont D)) :
JAdmissible O C S ↔ JFeasible O S ∧ jCost O S ≤ (C : ℝ) := by
constructor
· rintro ⟨hf, hb⟩
refine ⟨hf, ?_⟩
simpa [jCost] using ENNReal.toReal_mono (by simp : (C : ENNReal) ≠ ⊤) hb
· rintro ⟨hf, hb⟩
refine ⟨hf, ?_⟩
rw [← jCost_ofReal O S hf]
simpa using ENNReal.ofReal_le_ofReal hb
/-- Every original subfamily keeps the same original protocol and infimum budget. -/
theorem admissible_subfamily (O : OriginalData Cont D protocols R Record) (C : NNReal)
(hsub : JSubfamilyAtBudget O C) (S T : Finset (OriginalTask Cont D))
(hS : JAdmissible O C S) (hTS : T ⊆ S) :
JAdmissible O C T ∧ originalCost O T ≤ originalCost O S := by
have hmono : originalCost O T ≤ originalCost O S := by
apply le_sInf
rintro c ⟨p, hp, rfl⟩
exact sInf_le ⟨p, hsub S T hTS hS p hp, rfl⟩
obtain ⟨p, hp⟩ := hS.1
exact ⟨⟨⟨p, hsub S T hTS hS p hp⟩, hmono.trans hS.2⟩, hmono⟩
theorem jCost_subfamily (O : OriginalData Cont D protocols R Record) (C : NNReal)
(hsub : JSubfamilyAtBudget O C) (S T : Finset (OriginalTask Cont D))
(hS : JAdmissible O C S) (hTS : T ⊆ S) : jCost O T ≤ jCost O S := by
exact ENNReal.toReal_mono (original_cost_finite O S hS.1)
(admissible_subfamily O C hsub S T hS hTS).2
/-- Telescoping charges only original support-novel additions and licenses both
budget domains through the original same-p admissible-subfamily source clause. -/
theorem chain_cost (O : OriginalData Cont D protocols R Record) (C : NNReal) (ε : ℝ)
(hsub : JSubfamilyAtBudget O C) (hB05 : JB05 O C ε)
(S : Finset (OriginalTask Cont D)) (hS : JAdmissible O C S)
(T : Finset (OriginalTask Cont D)) (ds : List (OriginalTask Cont D))
(hin : extend T ds ⊆ S) (hn : JAllNovel O T ds) :
ε * (ds.length : ℝ) ≤ jCost O (extend T ds) - jCost O T := by
induction ds generalizing T with
| nil => simp [extend]
| cons d ds ih =>
have hi : insert d T ⊆ S :=
(show insert d T ⊆ extend (insert d T) ds from by
rw [extension_union]; exact Finset.subset_union_left).trans hin
have hT : JAdmissible O C T :=
(admissible_subfamily O C hsub S T hS ((Finset.subset_insert d T).trans hi)).1
have hTd : JAdmissible O C (insert d T) :=
(admissible_subfamily O C hsub S (insert d T) hS hi).1
have hinc := hB05.2 T d hT hTd hn.1
have htail := ih (insert d T) hin hn.2
simp only [List.length_cons, Nat.cast_add, Nat.cast_one]
change ε * ((ds.length : ℝ) + 1) ≤
jCost O (extend (insert d T) ds) - jCost O T
linarith
theorem zero_chain (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : 0 ∈ jPureValues O S := by
exact ⟨[], by simp, by simp, trivial, rfl⟩
theorem pure_values_bounded (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : BddAbove (jPureValues O S) := by
refine ⟨S.card, ?_⟩
rintro k ⟨ds, hnd, hin, hn, rfl⟩
have hc := Finset.card_le_card hin
simpa [List.toFinset_card_of_nodup hnd] using hc
/-- The pure original chain rank is attained; empty chains need no empty-zero law. -/
theorem pure_rank_attained (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : jPureRank O S ∈ jPureValues O S := by
exact Nat.sSup_mem ⟨0, zero_chain O S⟩ (pure_values_bounded O S)
/-- Pure original-J chain floor and count. No service floor, global closure,
minimizer, chosen-p affordability or extra empty-zero premise is consumed. -/
theorem original_joint_rank_bounds (O : OriginalData Cont D protocols R Record)
(C : NNReal) (ε : ℝ) (hsub : JSubfamilyAtBudget O C) (hB05 : JB05 O C ε)
(S : Finset (OriginalTask Cont D)) (hS : JAdmissible O C S) :
ε * (jPureRank O S : ℝ) ≤ jCost O S ∧ jPureRank O S ≤ ⌊(C : ℝ) / ε⌋₊ := by
obtain ⟨ds, hnd, hin, hn, heq⟩ := pure_rank_attained O S
have hin' : extend ∅ ds ⊆ S := by simpa [extension_union] using hin
have hchain := chain_cost O C ε hsub hB05 S hS ∅ ds hin' hn
rw [heq] at hchain
have hmono := jCost_subfamily O C hsub S (extend ∅ ds) hS hin'
have hzero : 0 ≤ jCost O ∅ := ENNReal.toReal_nonneg
have hfloor : ε * (jPureRank O S : ℝ) ≤ jCost O S := by linarith
refine ⟨hfloor, ?_⟩
apply Nat.le_floor
apply (le_div_iff₀ hB05.1).2
have hb := ((admissibility_real_identity O C S).1 hS).2
nlinarith
end APFOriginalJointRank