J0 source model: Counts
DefinitionAPFJ0_20260927_J0_Countsapf-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_APFJ0_20260927_J0_PartialAction
import Definitions.Def_APFJ0_20260927_J0_Coordinates
set_option autoImplicit false
set_option maxRecDepth 100000
set_option maxHeartbeats 0
namespace APFJ0
instance sameRecordsDecidable (s : Support) (x y : Raw) : Decidable (SameRecords s x y) :=
inferInstanceAs (Decidable (∀ i ∈ coords s,x i = y i))
def GoodPair (p : Support × Finset Raw) : Prop :=
p.2.Nonempty ∧ ∀ x y : Raw, SameRecords p.1 x y → (x ∈ p.2 ↔ y ∈ p.2)
instance goodPairDecidable : DecidablePred GoodPair := fun p =>
inferInstanceAs (Decidable (p.2.Nonempty ∧ ∀ x y : Raw, SameRecords p.1 x y → (x ∈ p.2 ↔ y ∈ p.2)))
def allNormalPairs : Finset (Support × Finset Raw) := Finset.univ.filter GoodPair
open Classical
abbrev NormalPair := {p : Support × Finset Raw // GoodPair p}
instance : Fintype NormalPair := Fintype.subtype allNormalPairs (by intro p;simp [allNormalPairs])
def primitivePair (p : Primitive) : NormalPair := ⟨(p.support,p.guard),p.nonempty,p.determined⟩
def pairPrimitive (p : NormalPair) : Primitive := ⟨p.val.1,p.val.2,p.property.1,p.property.2⟩
def primitiveEquiv : Primitive ≃ NormalPair where
toFun := primitivePair
invFun := pairPrimitive
left_inv p := by cases p;rfl
right_inv p := by cases p;rfl
noncomputable instance : Fintype Primitive := Fintype.ofEquiv NormalPair primitiveEquiv.symm
def primitiveWord (p : Primitive) : Word := [p]
noncomputable def wordNormal (u : Word) (h : Live u) : Primitive where
support := wordSupport u
guard := Finset.univ.filter (Enabled u)
nonempty := by obtain ⟨x,hx⟩ := h;exact ⟨x,by simp [hx]⟩
determined := by intro x y hxy;simpa using word_guard_determined u x y hxy
theorem live_primitive (p : Primitive) : Live (primitiveWord p) := by
obtain ⟨x,hx⟩ := p.nonempty
exact ⟨x,by simpa [primitiveWord,Enabled] using hx⟩
theorem wordNormal_same (u : Word) (h : Live u) : SameNormal u (primitiveWord (wordNormal u h)) := by
constructor
· simp [primitiveWord,wordNormal]
· intro x;simp [primitiveWord,wordNormal,Enabled]
theorem primitive_action_injective : Function.Injective (fun p : Primitive => action (primitiveWord p)) := by
intro p q h
obtain ⟨hs,hd⟩ := (action_iff_normal _ _ (live_primitive p)).mp h
have hsupport : p.support = q.support := by simpa [primitiveWord] using hs
have hguard : p.guard = q.guard := by
ext x;simpa [primitiveWord,Enabled] using hd x
cases p;cases q;simp_all
def ActionImage := Set.range (fun p : Primitive => action (primitiveWord p))
noncomputable def imageEquiv : Primitive ≃ ActionImage :=
Equiv.ofInjective (fun p : Primitive => action (primitiveWord p)) primitive_action_injective
noncomputable instance : Fintype ActionImage := Fintype.ofEquiv Primitive imageEquiv
theorem all_live_words_in_image (u : Word) (h : Live u) : action u ∈ ActionImage := by
refine ⟨wordNormal u h,?_⟩
exact ((action_iff_normal _ _ h).mpr (wordNormal_same u h)).symm
instance nonconstantDecidable : DecidablePred Nonconstant := fun f =>
inferInstanceAs (Decidable (∃ x y : Raw,f x ≠ f y))
def allTasks : Finset (Raw → Bool) := Finset.univ.filter Nonconstant
instance : Fintype Task := Fintype.subtype allTasks (by intro f;simp [allTasks])
end APFJ0
Source
APF private accepted J0/PC-J0 source; exact source SHA256 a8e8534b3e133a6db81c6a9a6813c925aa81daa014df317eb926b9c1203bdc8c; module J0.Counts