Original occupied-family source data and canonical full-domain encoding
DefinitionAPFUpstreamOccupantAPF original occupied-family source representation and canonical encoding. The original D_Gamma, original alignment, original J(S), support and whole bill precede the target tested domain. Canonical Delta is the raw image of the entire original D, not the occupied S alone. encodedSource is constructed by actual reindexing. OriginalB06 records original adopted occurrence and its original held-family cost bound. The definition contains two checked internal encoding lemmas; their inclusion does not make them separate native theorem nodes.
Four evidence accounts: papers: P0v6.2.56 B06 actual joint-held meaning3216/3218, narrow3651; P1v9.24 full original domain/quotient1233-1240, distinction1721-1734, original J/infimum1755-1758, alignment1808-1839, forward support2575. Existing source formalized. codebank: Original SourceData/PhysicalInputs/ProcessView and exact new upstream/forward modules personally consulted at unchanged pins. carrier/core finite supplied examples do not replace original occurrence or general proof. machine_checked: Exact definition and13 theorem module independently rebuilt; accepted binaries match. Definition includes two proved internal encoding lemmas, not separate native theorem nodes. Native registration/status is separate and must be read back. foundation: Exact B01/B02/B04/B06 and unchanged original source conventions. Original J forward support and original occurrence/held bound explicit. No target feasibility/bound/class-equivalence premise. This is scoped source-faithful formal coverage, not actual execution/time/quantum.
Complete source-field account:
- Gamma; Raw/FullProcess/Resource/Support dependent types; Cont — Each Gamma is its own COMPLETE original resolution/perturbation/duration/full-joint-obligation/accounting context. Original full finite-process universe and Cont retained. No new common contract or finite interrogation quotient. Dependency on Gamma in conclusion preserves same original context. Formal types do not physically construct these adopted source data. Source: P1.1198-1246,1721-1734,1755-1758
- D : Set (PhysicalState Cont -> Bool) — ENTIRE ORIGINAL physical distinction domain, independently specified before Delta. OriginalTask is membership subtype of original D. No availability of every Boolean function. No target-chosen or occupied-family-defined domain. Source: P1.1233-1240,1721-1726
- protocols; ProtocolView protocols — Literal original admitted finite-process subset in full universe. Each member finite, universe not assumed finite. No availability at actual carrier or affordability restriction. Source: accepted Def_APFOriginalProcessView.lean; root7
- OriginalData.service : SourceData OriginalTask originalP R Record — Original D-indexed source fields before target TestedTask domain exists. encodedSource is actually constructed from these fields. This is not independently supplied target A declared original. Source: accepted Def_APFOriginalSource.lean, P1.1732/1756/2575
- service.nullProtocol, null_bill — Original empty protocol and zero calibrated bill; no zero resource inference. Retained to construct same SourceData target; unused to show J nonempty. Source: unchanged accepted SourceData null convention
- service.wholeResource; R AddCommMonoid/Preorder — Complete original load, including support/control/recovery and null load. Algebra/order carried unchanged, no component reconstruction from scalar bill; algebra/order laws not used to force feasibility. Source: unchanged accepted SourceData
- service.calibration, calibration_monotone, calibration_zero — Original NNReal bill calibrated from entire original resource. Same function and same p used both sides. These fields are copied to target, not newly derived from B06. Source: unchanged accepted SourceData
- service.maintained, sufficient, usesToRealize — Maintained throughout original complete contract, source-sufficient and ACTUALLY USED by same p for each original d. Reindex only d through constructed domain equivalence. Records are physical support identities, not decoded data. Source: P1.2574-2576; accepted SourceData
- OriginalData.jointClass — Original P_Gamma(S) under complete joint contract, not defined as target all-member service. No class equivalence and no nonempty-class field. Source: P1.1755-1758
- OriginalData.joint_support — For an ALREADY admitted original p in J(S), original actual maintained/sufficient/used support exists for each d in S. It is a substantive source clause, not a proved new physics law. Requires original J membership, which theorem derives from original cost bound. It asserts neither joint existence nor target feasibility nor a converse. Source: P1.2575; exact Stage A forward-route acceptance
- OriginalData.physical — Each ORIGINAL D member is nontrivial and individually enforced by original finite p with support. Not all finite families feasible. Principal uses nontriviality; single-member witness conjunct is preserved but not used to join anything. Source: B02/P1.1721-1726; accepted original physical source meaning
- OriginalAlignment.carrier/carried/active — Original a on full quotient, complete finite S subset D, all original d(a)=true. No nonempty or budget field in alignment type. Original occurrence o is retained in principal result. Source: P1.1808-1818,1825
- actualJoint; OriginalB06 — Original occurrence predicate is on original (a,S) before encoding; its physical referent is original actually drawn joint objects. Original nonempty S and bound on ORIGINAL J cost are input meaning. No new typed occupant, target bound, SourceFeasible or attaining protocol supplied. Irreducibility/profile is retained in original predicate and not calculated or derived. Source: B06/P0.3216/3218, narrow3651; P1.1828-1839; accepted held/admissible source record
- C : Gamma -> NNReal — Capacity finite by original real representation. Only original occupied-family infimum bounded. No all-protocol price cap or affordable attaining p conclusion. Source: B04/A1; P1.1233-1240,1836
- originalPrices/originalCost — Actual original J membership and original whole bill define extended nonnegative prices. Empty price set infimum top. No replacement by old real empty-set sInf or target-service prices. Source: P1.1755-1758
- canonicalDelta; encode; domainEquiv — Specializes previously FREE Delta parameter to raw pullbacks of entire original D. Not a claim about a separately fixed proper subset. Full domain equivalence proved; full occupied S round-trips only with its image. Source: Stage A exact canonical full-domain specialization6ec74983; B01 full quotient
- encodedSource — Original p, universe, maintained support, complete resource and calibration copied literally; distinction arguments reindexed by proved inverse. No target A supplied as input. Source: explicit constructor plus proved support/bill identities
- Classical.choice/propext/Quot.sound — Reported compiler axioms. Choice used for inverse of canonical bijection. No target axiom/sorry/admit in new source. Source: Lean/mathlib logic
import Definitions.Def_APFOriginalProcessView
import Mathlib.Data.ENNReal.Basic
import Mathlib.Data.ENNReal.Operations
set_option autoImplicit false
open Classical APFOriginalSource APFOriginalPhysical APFPaper1.Foundation
namespace APFUpstreamOccupant
variable {X Q R Record : Type*} [AddCommMonoid R] [Preorder R]
/-- Paper1's ORIGINAL full physical distinction domain on its full quotient.
D is specified upstream, independently of any raw encoding or occupied family. -/
abbrev OriginalTask (Cont : X → Set Q) (D : Set (PhysicalState Cont → Bool)) :=
{d : PhysicalState Cont → Bool // d ∈ D}
/-- Original paper data at ONE complete source contract: resolution, perturbations,
duration, full joint obligations and accounting remain in the original context.
The original joint class is retained separately; only its forward support meaning
is supplied. No nonemptiness, target bound or class-equivalence field occurs. -/
structure OriginalData (Cont : X → Set Q) (D : Set (PhysicalState Cont → Bool))
(protocols : Set Q) (R Record : Type*) [AddCommMonoid R] [Preorder R] where
service : SourceData (OriginalTask Cont D)
(APFOriginalProcess.ProtocolView protocols) R Record
jointClass : Finset (OriginalTask Cont D) → Set (APFOriginalProcess.ProtocolView protocols)
/-- P1.2575: support actually used by this SAME already joint original p. -/
joint_support : ∀ S p, p ∈ jointClass S → ∀ d ∈ S, RealizesMember service p d
/-- Original B02/P1.1721 physical-domain content, before any target typing. -/
physical : ∀ d : OriginalTask Cont D,
(∃ a b, d.val a ≠ d.val b) ∧ ∃ p, RealizesMember service p d
/-- Original Paper1 alignment, before Delta/QuotientTask/A are constructed. -/
structure OriginalAlignment (Cont : X → Set Q) (D : Set (PhysicalState Cont → Bool)) where
carrier : PhysicalState Cont
carried : Finset (OriginalTask Cont D)
active : ∀ d ∈ carried, d.val carrier = true
variable {Cont : X → Set Q} {D : Set (PhysicalState Cont → Bool)} {protocols : Set Q}
/-- Prices of the ORIGINAL separately retained joint class; never target prices. -/
def originalPrices (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : Set ENNReal :=
{c | ∃ p ∈ O.jointClass S, (O.service.calibration (O.service.wholeResource p) : ENNReal) = c}
noncomputable def originalCost (O : OriginalData Cont D protocols R Record)
(S : Finset (OriginalTask Cont D)) : ENNReal := sInf (originalPrices O S)
def rawPullback (d : OriginalTask Cont D) : X → Bool :=
fun x => d.val (physicalClass Cont x)
/-- Canonical specialization of the FREE Delta parameter: entire original D.
This is not the occupied family's image and not all Boolean predicates. -/
def canonicalDelta (Cont : X → Set Q) (D : Set (PhysicalState Cont → Bool)) : Set (X → Bool) :=
Set.range (rawPullback (Cont := Cont) (D := D))
def encode (d : OriginalTask Cont D) : TestedTask (canonicalDelta Cont D) :=
⟨rawPullback d, ⟨d, rfl⟩⟩
theorem encode_injective : Function.Injective (encode (Cont := Cont) (D := D)) := by
intro d e h
apply Subtype.ext
funext z
refine Quotient.inductionOn z (fun x => ?_)
exact congrFun (congrArg Subtype.val h) x
theorem encode_surjective : Function.Surjective (encode (Cont := Cont) (D := D)) := by
intro f
obtain ⟨d, hd⟩ := f.property
exact ⟨d, Subtype.ext hd⟩
noncomputable def domainEquiv (Cont : X → Set Q) (D : Set (PhysicalState Cont → Bool)) :
OriginalTask Cont D ≃ TestedTask (canonicalDelta Cont D) :=
Equiv.ofBijective encode ⟨encode_injective, encode_surjective⟩
noncomputable def encodeFamily (S : Finset (OriginalTask Cont D)) :
Finset (TestedTask (canonicalDelta Cont D)) := S.map (domainEquiv Cont D).toEmbedding
noncomputable def decodeFamily (S : Finset (TestedTask (canonicalDelta Cont D))) :
Finset (OriginalTask Cont D) := S.map (domainEquiv Cont D).symm.toEmbedding
/-- Actual reindexing of ORIGINAL support data. All process/resource/bill fields
are copied literally; only the distinction argument is transported by inverse. -/
noncomputable def encodedSource (O : OriginalData Cont D protocols R Record) :
SourceData (TestedTask (canonicalDelta Cont D))
(APFOriginalProcess.ProtocolView protocols) R Record where
nullProtocol := O.service.nullProtocol
wholeResource := O.service.wholeResource
calibration := O.service.calibration
calibration_monotone := O.service.calibration_monotone
calibration_zero := O.service.calibration_zero
null_bill := O.service.null_bill
maintained := O.service.maintained
sufficient := fun p σ f => O.service.sufficient p σ ((domainEquiv Cont D).symm f)
usesToRealize := fun p f σ => O.service.usesToRealize p ((domainEquiv Cont D).symm f) σ
section ContextFamily
variable {Γ : Type*} {Raw FullProcess Resource Support : Γ → Type*}
variable [∀ γ, AddCommMonoid (Resource γ)] [∀ γ, Preorder (Resource γ)]
/-- Adopted original B06 occurrence at its own full original source contract.
Original actual-joint predicate precedes Delta/A; original bound is on ORIGINAL J.
Irreducibility/profile is retained in that original predicate, not calculated. -/
def OriginalB06
(Cont : ∀ γ, Raw γ → Set (FullProcess γ))
(D : ∀ γ, Set (PhysicalState (Cont γ) → Bool))
(protocols : ∀ γ, Set (FullProcess γ))
(O : ∀ γ, OriginalData (Cont γ) (D γ) (protocols γ) (Resource γ) (Support γ))
(C : Γ → NNReal)
(actualJoint : Set (Σ γ, OriginalAlignment (Cont γ) (D γ))) : Prop :=
∃ o, o ∈ actualJoint ∧ o.2.carried.Nonempty ∧
originalCost (O o.1) o.2.carried ≤ (C o.1 : ENNReal)
end ContextFamily
end APFUpstreamOccupant