J0 source model: Model
DefinitionAPFJ0_20260927_J0_Modelapf-j0-pcj0-20260927
Supporting definitions and definition-required proofs from the independently accepted J0/PC-J0 model. Private reference material; it is not a universal hardware law or generic universe of physical models.
Definition code
import Definitions.Def_APFPaper1_Foundation
import Mathlib.Topology.Instances.Real.Lemmas
import Mathlib.Tactic.DeriveFintype
set_option autoImplicit false
set_option maxRecDepth 8192
set_option maxHeartbeats 2000000
open Classical
namespace APFJ0
abbrev Position := Fin 3
abbrev Raw := Position → Bool
abbrev Component := Fin 4
abbrev WeightVector := Component → ℝ
def PositiveRegion : Set WeightVector := {w | ∀ i, 0 < w i}
abbrev Weights := {w : WeightVector // w ∈ PositiveRegion}
inductive Support | nil | a | b | ab | am | bm | abm
deriving DecidableEq, Repr
open Support
instance : Fintype Support where
elems := {nil,a,b,ab,am,bm,abm}
complete := by intro x; cases x <;> simp
def coords : Support → Finset Position
| nil => ∅ | a => {0} | b => {1} | ab => {0,1}
| am => {0,2} | bm => {1,2} | abm => {0,1,2}
def resource : Support → Finset Component
| nil => ∅ | a => {0} | b => {1} | ab => {0,1,3}
| am => {0,2} | bm => {1,2} | abm => {0,1,2,3}
def join : Support → Support → Support
| .nil, .nil => .nil
| .nil, .a => .a
| .nil, .b => .b
| .nil, .ab => .ab
| .nil, .am => .am
| .nil, .bm => .bm
| .nil, .abm => .abm
| .a, .nil => .a
| .a, .a => .a
| .a, .b => .ab
| .a, .ab => .ab
| .a, .am => .am
| .a, .bm => .abm
| .a, .abm => .abm
| .b, .nil => .b
| .b, .a => .ab
| .b, .b => .b
| .b, .ab => .ab
| .b, .am => .abm
| .b, .bm => .bm
| .b, .abm => .abm
| .ab, .nil => .ab
| .ab, .a => .ab
| .ab, .b => .ab
| .ab, .ab => .ab
| .ab, .am => .abm
| .ab, .bm => .abm
| .ab, .abm => .abm
| .am, .nil => .am
| .am, .a => .am
| .am, .b => .abm
| .am, .ab => .abm
| .am, .am => .am
| .am, .bm => .abm
| .am, .abm => .abm
| .bm, .nil => .bm
| .bm, .a => .abm
| .bm, .b => .bm
| .bm, .ab => .abm
| .bm, .am => .abm
| .bm, .bm => .bm
| .bm, .abm => .abm
| .abm, .nil => .abm
| .abm, .a => .abm
| .abm, .b => .abm
| .abm, .ab => .abm
| .abm, .am => .abm
| .abm, .bm => .abm
| .abm, .abm => .abm
@[simp] theorem join_nil (s : Support) : join s nil = s := by cases s <;> rfl
@[simp] theorem nil_join (s : Support) : join nil s = s := by cases s <;> rfl
theorem join_assoc (s t u : Support) : join (join s t) u = join s (join t u) := by
cases s <;> cases t <;> cases u <;> rfl
theorem coords_join (s t : Support) : coords (join s t) = coords s ∪ coords t := by
cases s <;> cases t <;> decide
theorem resource_injective : Function.Injective resource := by decide
noncomputable def price (w : WeightVector) (s : Support) : ℝ := ∑ i ∈ resource s, w i
noncomputable def capacity (w : WeightVector) : ℝ := price w abm
def SameRecords (s : Support) (x y : Raw) : Prop := ∀ i ∈ coords s, x i = y i
def Readable {Y : Type} (s : Support) (f : Raw → Y) : Prop :=
∀ x y, SameRecords s x y → f x = f y
def Nonconstant (f : Raw → Bool) : Prop := ∃ x y, f x ≠ f y
abbrev Task := {f : Raw → Bool // Nonconstant f}
structure Primitive where
support : Support
guard : Finset Raw
nonempty : guard.Nonempty
determined : ∀ x y, SameRecords support x y → (x ∈ guard ↔ y ∈ guard)
abbrev Word := List Primitive
def wordSupport : Word → Support
| [] => nil | p :: w => join p.support (wordSupport w)
def Enabled (w : Word) (x : Raw) : Prop := ∀ p ∈ w, x ∈ p.guard
def Use : Word → Raw → Raw → Prop
| [], x, y => y = x
| p :: w, x, z => ∃ y, x ∈ p.guard ∧ y = x ∧ Use w y z
structure PassiveReadout (w : Word) where
size : ℕ
value : Raw → Fin (size+1)
determined : Readable (wordSupport w) value
structure Process where
word : Word
readout : PassiveReadout word
def Qualified (p : Process) : Prop := ∃ x, Enabled p.word x
abbrev Protocol := {p : Process // Qualified p}
def U (p : Process) (x y : Raw) : Prop := Use p.word x y
def profile (x : Raw) : Set Process := {p | ∃ y, U p x y}
def Carries (p : Process) (d : Task) : Prop := Readable (wordSupport p.word) d.val
def Serves (p : Protocol) (S : Finset Task) : Prop :=
(∀ x, Enabled p.val.word x) ∧ ∀ d ∈ S, Carries p.val d
noncomputable def bill (w : WeightVector) (p : Process) : ℝ := price w (wordSupport p.word)
noncomputable def prices (w : WeightVector) (S : Finset Task) : Set ℝ :=
{c | ∃ p : Protocol, Serves p S ∧ bill w p.val = c}
noncomputable def cost (w : WeightVector) (S : Finset Task) : ℝ := sInf (prices w S)
def SupportNovel (w : WeightVector) (S : Finset Task) (d : Task) : Prop :=
∃ η : ℝ, 0 < η ∧ ∀ p : Protocol, Serves p S →
bill w p.val ≤ cost w S + η → ¬ Carries p.val d
abbrev Boundary := Bool × Bool
def boundary (x : Raw) : Boundary := (x 0,x 1)
def eligible (r : Boundary) : Set Raw := {x | boundary x = r}
def realized (r : Boundary) : Raw := fun i => if i = 0 then r.1 else if i = 1 then r.2 else false
def actual : Raw := realized (true,true)
noncomputable def axisTask (i : Position) (v : Bool) : Task :=
⟨fun x => decide (x i = v), by
refine ⟨(fun _ => false),(fun _ => true),?_⟩
cases v <;> simp⟩
noncomputable def held (x : Raw) : Finset Task :=
{axisTask 0 (x 0),axisTask 1 (x 1)} ∪ if x 2 = true then {axisTask 2 true} else ∅
noncomputable def totalCost (w : WeightVector) (x : Raw) : ℝ := cost w (held x)
end APFJ0
Source
APF private accepted J0/PC-J0 source; exact source SHA256 7708b75b946f1456531cedb7431be274e0be75a2320878e6976aadcd44a557f8; module J0.Model