import proofs.RootCarrier import proofs.RootProjectiveAdapters import proofs.ProjectiveReturn /-! # 011a / S-01 — Root field lift: finite seed and provenance kernel This module is the first root-to-physics composition record. It does two things, and only two things. 1. It packages the already certified finite root field seed (eta-hat, C-hat, Pi_0) from `RootCarrier.lean`, including the displayed regularity witness. 2. It makes provenance proof-carrying. A `rootDerived` tag can enter a certificate only through a `RootCertificate`; imported and calibrated premises retain their tags under composition. The full spacetime lift L_field : (H, S, C_1, L_s) -> (M, E, eta-hat, C-hat, Pi) is represented below as a declared interface with named density, covariance, and boundary obligations. No smooth manifold, bundle, coframe, action density, Einstein--Hilbert term, Maxwell term, or physical coefficient is constructed by this finite module. Lean target: 4.33.0, Core Lean only. -/ set_option autoImplicit false namespace RootFieldLift011a /-! ## 1. Exact finite root seed -/ structure FiniteFieldCarrier where eta : List (List Int) chat : List (List Int) coframe : List (List Int) def finiteSeed : FiniteFieldCarrier := ⟨RootCarrier.eta, RootCarrier.Chat, RootCarrier.Pi0⟩ def CarriesRoot (F : FiniteFieldCarrier) : Prop := F.eta = RootCarrier.eta ∧ F.chat = RootCarrier.Chat ∧ F.coframe = RootCarrier.Pi0 def RegularAt (F : FiniteFieldCarrier) : Prop := RootCarrier.preimages.map (RootCarrier.dS F.coframe) = (List.range 16).map RootCarrier.unitScaled theorem finiteSeed_carries_root : CarriesRoot finiteSeed := by exact ⟨rfl, rfl, rfl⟩ theorem finiteSeed_regular : RegularAt finiteSeed := by exact RootCarrier.dS_onto_certificate theorem root_metric_square : RootCarrier.mmul RootCarrier.G2 RootCarrier.G2 2 = RootCarrier.mscale 5 (RootCarrier.idMat 2) := RootCarrier.G_square theorem root_quarter_turn_square : ProjectiveReturn.mul RootProjectiveAdapters.C RootProjectiveAdapters.C = ProjectiveReturn.matNeg ProjectiveReturn.I := RootProjectiveAdapters.C_square /-! ## 2. Proof-carrying source provenance -/ inductive OriginTag where | rootDerived | consistencyFixed | imported | empiricallyCalibrated deriving DecidableEq, Repr structure SourceRef where title : String revision : String deriving Repr inductive ClosureObligation where | fieldLift | fieldDensity | covariance | boundaryTerms | smoothCompletion | coefficientSelection | matterSelection | physicalStateConstruction | empiricalInstantiation | globalExtension deriving DecidableEq, Repr /-! `RootCertificate P` is deliberately a closed family. A future root-derived claim must add a constructor together with an exact theorem; it cannot be promoted by attaching a display tag. -/ inductive RootCertificate : Prop → Type where | finiteCarrier : RootCertificate (CarriesRoot finiteSeed) | finiteRegular : RootCertificate (RegularAt finiteSeed) | metricSquare : RootCertificate (RootCarrier.mmul RootCarrier.G2 RootCarrier.G2 2 = RootCarrier.mscale 5 (RootCarrier.idMat 2)) | quarterTurnSquare : RootCertificate (ProjectiveReturn.mul RootProjectiveAdapters.C RootProjectiveAdapters.C = ProjectiveReturn.matNeg ProjectiveReturn.I) def RootCertificate.proof {P : Prop} (certificate : RootCertificate P) : P := match certificate with | .finiteCarrier => finiteSeed_carries_root | .finiteRegular => finiteSeed_regular | .metricSquare => root_metric_square | .quarterTurnSquare => root_quarter_turn_square /-! Every discharged proposition carries its complete origin list. Composition concatenates rather than rewrites lists, so an imported premise remains visible in each result that uses it. -/ inductive Certified : List OriginTag → Prop → Type where | root {P : Prop} : RootCertificate P → Certified [.rootDerived] P | consistencyFixed {P : Prop} : SourceRef → P → Certified [.consistencyFixed] P | imported {P : Prop} : SourceRef → P → Certified [.imported] P | calibrated {P : Prop} : SourceRef → P → Certified [.empiricallyCalibrated] P | compose {P Q : Prop} {xs ys : List OriginTag} : Certified xs (P → Q) → Certified ys P → Certified (xs ++ ys) Q def Certified.origins {xs : List OriginTag} {P : Prop} (_ : Certified xs P) : List OriginTag := xs def RootOnly (xs : List OriginTag) : Prop := xs = [.rootDerived] theorem compose_preserves_origins {P Q : Prop} {xs ys : List OriginTag} (f : Certified xs (P → Q)) (p : Certified ys P) : Certified.origins (Certified.compose f p) = xs ++ ys := rfl theorem imported_is_not_root_only {P : Prop} (source : SourceRef) (witness : P) : ¬ RootOnly (Certified.origins (Certified.imported source witness)) := by simp [RootOnly, Certified.origins] inductive ClaimState (P : Prop) where | discharged {xs : List OriginTag} : Certified xs P → ClaimState P | unresolved : ClosureObligation → ClaimState P /-! The common closure record is the audit interface used by every 011 stage. `outputCertificates` is intentionally dependent: a listed output has a proof term together with the complete origin list that produced it. Imports are separate proof-carrying entries, so a later theorem can use an imported premise without erasing its source office. -/ structure RootInput where proposition : Prop certificate : RootCertificate proposition structure ImportedPremise where proposition : Prop source : SourceRef witness : proposition structure ClosureRecord where carrier : Type premises : List Prop rootInputs : List RootInput imports : List ImportedPremise derivedOutputs : List Prop coverage : String exclusions : List String witnessType : Type witness : witnessType outputCertificates : ∀ P : Prop, P ∈ derivedOutputs → Sigma (fun xs : List OriginTag => Certified xs P) def ClosureRecord.outputOrigins (record : ClosureRecord) (P : Prop) (hP : P ∈ record.derivedOutputs) : List OriginTag := (record.outputCertificates P hP).fst /-! ## 3. Coefficient ownership ledger -/ inductive ActionOffice where | internalMetricSeed | internalFluxSeed | fieldCoframe | fieldDensity | einsteinHilbertDensity | maxwellDensity | gravitationalConstant | lightSpeed | cosmologicalConstant | permeability | calibrationChi deriving DecidableEq, Repr /-! This is the public five-office ownership vocabulary. `unresolved` is the Lean-safe spelling of the ledger status `open`. -/ inductive CoefficientOrigin where | rootDerived | consistencyFixed | imported | empiricallyCalibrated | unresolved deriving DecidableEq, Repr structure CoefficientEntry where office : ActionOffice origin : CoefficientOrigin source : Option SourceRef obligation : Option ClosureObligation deriving Repr /-! The proof-carrying form backs the public `CoefficientOrigin` label. In particular, only `.rootDerived` accepts a `RootCertificate`; an unresolved entry has an obligation and exposes no proof extractor. -/ inductive CoefficientSupport (office : ActionOffice) (P : Prop) : Type where | rootDerived : RootCertificate P → CoefficientSupport office P | consistencyFixed : SourceRef → P → CoefficientSupport office P | imported : SourceRef → P → CoefficientSupport office P | empiricallyCalibrated : SourceRef → P → CoefficientSupport office P | unresolved : ClosureObligation → CoefficientSupport office P def CoefficientSupport.origin {office : ActionOffice} {P : Prop} : CoefficientSupport office P → CoefficientOrigin | .rootDerived _ => .rootDerived | .consistencyFixed _ _ => .consistencyFixed | .imported _ _ => .imported | .empiricallyCalibrated _ _ => .empiricallyCalibrated | .unresolved _ => .unresolved def CoefficientSupport.state {office : ActionOffice} {P : Prop} : CoefficientSupport office P → ClaimState P | .rootDerived certificate => .discharged (.root certificate) | .consistencyFixed source witness => .discharged (.consistencyFixed source witness) | .imported source witness => .discharged (.imported source witness) | .empiricallyCalibrated source witness => .discharged (.calibrated source witness) | .unresolved obligation => .unresolved obligation def rootCarrierSource : SourceRef := ⟨"RootCarrier.lean", "finite eta-hat / C-hat / Pi_0 certificate"⟩ def sutureDynamicsSource : SourceRef := ⟨"Suture Field Dynamics", "SD.1 constrained action"⟩ def calibrationSource : SourceRef := ⟨"Suture Field Dynamics", "Boundary 6 calibration office"⟩ def allActionOffices : List ActionOffice := [.internalMetricSeed, .internalFluxSeed, .fieldCoframe, .fieldDensity, .einsteinHilbertDensity, .maxwellDensity, .gravitationalConstant, .lightSpeed, .cosmologicalConstant, .permeability, .calibrationChi] /-! This records present ownership only. It does not prove the physical action; the EH/Maxwell and dimensional-coefficient entries remain imported, while the spacetime lift, density, covariance, and boundary law remain unresolved. -/ def coefficientLedger : List CoefficientEntry := [⟨.internalMetricSeed, .rootDerived, some rootCarrierSource, none⟩, ⟨.internalFluxSeed, .rootDerived, some rootCarrierSource, none⟩, ⟨.fieldCoframe, .unresolved, none, some .fieldLift⟩, ⟨.fieldDensity, .unresolved, none, some .fieldDensity⟩, ⟨.einsteinHilbertDensity, .imported, some sutureDynamicsSource, none⟩, ⟨.maxwellDensity, .imported, some sutureDynamicsSource, none⟩, ⟨.gravitationalConstant, .imported, some sutureDynamicsSource, none⟩, ⟨.lightSpeed, .imported, some sutureDynamicsSource, none⟩, ⟨.cosmologicalConstant, .imported, some sutureDynamicsSource, none⟩, ⟨.permeability, .imported, some sutureDynamicsSource, none⟩, ⟨.calibrationChi, .empiricallyCalibrated, some calibrationSource, none⟩] theorem coefficientLedger_covers_declared_offices : coefficientLedger.map CoefficientEntry.office = allActionOffices := by decide def metricSeedSupport : CoefficientSupport .internalMetricSeed (CarriesRoot finiteSeed) := .rootDerived .finiteCarrier def fluxSeedSupport : CoefficientSupport .internalFluxSeed (CarriesRoot finiteSeed) := .rootDerived .finiteCarrier theorem metricSeedSupport_is_root_derived : CoefficientSupport.origin metricSeedSupport = .rootDerived := rfl theorem fluxSeedSupport_is_root_derived : CoefficientSupport.origin fluxSeedSupport = .rootDerived := rfl /-! ## 4. Declared field lift versus witnessed field lift -/ structure DeclaredFieldLift where source : FiniteFieldCarrier target : Type lift : FiniteFieldCarrier → target inducedMetric : target → Prop inducedFlux : target → Prop density : target → Prop covariant : target → Prop boundaryLaw : target → Prop /-! `WitnessedFieldLift` makes the exact missing theorem shape explicit. It is not instantiated here: a valid instance must carry the real field construction and all named proof states. -/ structure WitnessedFieldLift (D : DeclaredFieldLift) where carrierFromRoot : Certified [.rootDerived] (CarriesRoot D.source) regularFromRoot : Certified [.rootDerived] (RegularAt D.source) metricState : ClaimState (D.inducedMetric (D.lift D.source)) fluxState : ClaimState (D.inducedFlux (D.lift D.source)) densityState : ClaimState (D.density (D.lift D.source)) covarianceState : ClaimState (D.covariant (D.lift D.source)) boundaryState : ClaimState (D.boundaryLaw (D.lift D.source)) def finiteCarrierCertificate : Certified [.rootDerived] (CarriesRoot finiteSeed) := .root .finiteCarrier def finiteRegularCertificate : Certified [.rootDerived] (RegularAt finiteSeed) := .root .finiteRegular theorem finiteCarrierCertificate_is_root_only : RootOnly (Certified.origins finiteCarrierCertificate) := rfl theorem finiteRegularCertificate_is_root_only : RootOnly (Certified.origins finiteRegularCertificate) := rfl #print axioms finiteSeed_carries_root #print axioms finiteSeed_regular #print axioms compose_preserves_origins #print axioms imported_is_not_root_only #print axioms coefficientLedger_covers_declared_offices end RootFieldLift011a