Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Model vocabulary — Word model for two contexts and record-free turns

Definition
APFB06_two_context_world_Vocabulary

by FiniteUniverse · Nov 17, 2026 · Mathlib 0df444a (Lean v4.33.1)

apfapf-referencepullbacks-v46-2026-11

Data, predicates and immediate constructor helpers for this reviewed model. Its substantive results are published as separate proved theorem nodes.

A supplied two-context word model meets encoded EightHold, proposed B02 r2 and full occupant predicates. Looking is nondeterministic, turning deterministic, and equal kept records need not imply equal future continuations. Probabilities are not part of this model. B06 uses a supplied single-mark alignment; B07a/b use singleton admissibility domains. Their physical fidelity and the candidate interpretation are not certified.

Supplied data and hypotheses

  • Every parameter and hypothesis in the exact source declaration remains exposed; no author input is adopted.

Limits

This is conditional reference mathematics. The supplied model and its hypotheses are not adopted Foundation inputs, and this node does not establish K1, K3 or K4 closure.

Definition code
import Definitions.Def_APFB06_worlds_against_the_occupant_statement_Vocabulary
import Theorems.Thm_APFPaper1_Source_not_holdingNothingFree_of_bill_pos
import Theorems.Thm_APFPaper1_Source_not_holdingNothingFree_of_keeps
import Theorems.Thm_APFPaper1_Source_not_inFull_of_not_free
import Theorems.Thm_APFB06_ReadingsWorld_meets_in_full
import Theorems.Thm_APFB06_MovingWorld_holdingNothingFree
import Theorems.Thm_APFB06_MovingWorld_fcost_empty
import Theorems.Thm_APFB06_MovingWorld_every_family_occupied
import Theorems.Thm_APFB06_MovingWorld_occupant_holds_with_parts_at_unit
import Theorems.Thm_APFB06_MovingWorld_meets_in_full
import Theorems.Thm_APFB06_SharedWorld_holdingNothingFree
import Theorems.Thm_APFB06_SharedWorld_fcost_empty
import Theorems.Thm_APFB06_SharedWorld_every_family_occupied
import Theorems.Thm_APFB06_SharedWorld_occupant_holds_with_parts_at_unit
import Theorems.Thm_APFB06_SharedWorld_meets_in_full
import Theorems.Thm_APFB06_ResidueNullWorld_meets_in_full
import Theorems.Thm_APFB06_BridgeWorld_not_holdingNothingFree
import Theorems.Thm_APFB06_BridgeWorld_fails_in_full
import Theorems.Thm_APFB06_RelationWorldR2_not_holdingNothingFree
import Theorems.Thm_APFB06_ResidueWorldR2_Unequal_not_holdingNothingFree
import Theorems.Thm_APFB06_BusWorld_not_holdingNothingFree
import Theorems.Thm_APFB06_OverheadWorld_not_holdingNothingFree
import Theorems.Thm_APFB06_DiscountWorld_not_holdingNothingFree
import Theorems.Thm_APFPaper1_LoadWorld_not_holdingNothingFree
import Theorems.Thm_APFPaper5_Worlds_not_holdingNothingFree
import Theorems.Thm_APFB06_WorldsAudit_three_signs_among_worlds_meeting_the_statement
import Definitions.Def_APFB06_turned_context_world_Vocabulary
import Theorems.Thm_APFB06_TurnedContextWorld_chance_total
import Theorems.Thm_APFB06_TurnedContextWorld_chance_values
import Theorems.Thm_APFB06_TurnedContextWorld_side_is_certain
import Theorems.Thm_APFB06_TurnedContextWorld_noSide_is_flat
import Theorems.Thm_APFB06_TurnedContextWorld_hasSide_iff_noSide_other
import Theorems.Thm_APFB06_TurnedContextWorld_no_state_has_both_sides
import Theorems.Thm_APFB06_TurnedContextWorld_each_mark_takes_both_sides
import Theorems.Thm_APFB06_TurnedContextWorld_own_context_does_not_count_it
import Theorems.Thm_APFB06_TurnedContextWorld_both_sides_can_be_gained
import Theorems.Thm_APFB06_TurnedContextWorld_raw_states_differ_in_connection
import Theorems.Thm_APFB06_TurnedContextWorld_connection_fixes_the_raw_state
import Theorems.Thm_APFB06_TurnedContextWorld_bill_eq
import Theorems.Thm_APFB06_TurnedContextWorld_bill_same_everywhere
import Theorems.Thm_APFB06_TurnedContextWorld_connection_a_turn_away
import Theorems.Thm_APFB06_TurnedContextWorld_turned_context_counts_it
import Theorems.Thm_APFB06_TurnedContextWorld_table_is_a_place_on_the_circle
import Theorems.Thm_APFB06_TurnedContextWorld_turn_changes_context
import Theorems.Thm_APFB06_TurnedContextWorld_turn_two
import Theorems.Thm_APFB06_TurnedContextWorld_turn_four
import Theorems.Thm_APFB06_TurnedContextWorld_turn_bill
import Theorems.Thm_APFB06_TurnedContextWorld_turn_reads_the_other_mark
import Theorems.Thm_APFB06_TurnedContextWorld_turn_back_reads_the_other_mark
import Theorems.Thm_APFB06_TurnedContextWorld_nothing_and_turn_told_apart
import Theorems.Thm_APFB06_TurnedContextWorld_reads_repeatable
import Theorems.Thm_APFB06_TurnedContextWorld_reads_gives_a_side
import Theorems.Thm_APFB06_TurnedContextWorld_reading_the_other_mark_frees_the_first
import Theorems.Thm_APFB06_TurnedContextWorld_reads_do_not_commute
import Theorems.Thm_APFB06_MovingWorld_mark_a_turn_away_is_the_other_mark
import Theorems.Thm_APFB06_MovingWorld_both_marks_have_sides
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum

set_option autoImplicit false
open APFPaper1.Continuation
open APFPaper1.Source

namespace APFB06.TwoContextWorld

/-- The records: the record of side true on the mark of the first context, and of the second. -/
inductive Rc
  | r0 | r1
  deriving DecidableEq

instance : Fintype Rc := ⟨{Rc.r0, Rc.r1}, fun r => by cases r <;> decide⟩

/-- The record of the mark of context `g`. -/
def recIn (g : Bool) : Rc := cond g Rc.r1 Rc.r0

/-- The fragments. `keep` keeps the record of the mark of the context it is used in. `look` and `turn`
go to the other context and keep no record. -/
inductive Lbl
  | keep | look | turn
  deriving DecidableEq

/-- The contexts are the two values of `Bool`. Every fragment label is typed between every pair of
contexts; a label used between the wrong pair never runs. -/
abbrev Frag : Bool → Bool → Type := fun _ _ => Lbl

/-- A raw state of a context: the side on that context's mark. -/
abbrev St : Type := Bool

abbrev Raw : Bool → Type := fun _ => St
abbrev Res : Bool → Type := fun _ => Finset Rc

/-- The turn from context `g` to the other: the side is kept from the first context to the second, and
turned over from the second to the first. -/
def tmap (g : Bool) (x : St) : St := cond g (!x) x

/-- The steps. `keep` runs within a context where the side is true and changes nothing. `look` runs to
the other context and can land on either side. `turn` runs to the other context and lands on the side
`tmap` gives. -/
def step : (g h : Bool) → Frag g h → Raw g → Raw h → Prop := fun g h f x y =>
  match f with
  | Lbl.keep => h = g ∧ x = true ∧ y = x
  | Lbl.look => h = !g
  | Lbl.turn => h = (!g) ∧ y = tmap g x

/-- What a word keeps: the record of the mark of each context where it uses `keep`. -/
def keptW : {g h : Bool} → Word Frag g h → Finset Rc
  | _, _, Word.nil _ => ∅
  | _, _, Word.cons (g := g) f w => (if f = Lbl.keep then {recIn g} else ∅) ∪ keptW w

def kept (g : Bool) (w : WordFrom Frag g) : Finset Rc := keptW w.2

theorem card_kept_le (g : Bool) (w : WordFrom Frag g) : (kept g w).card ≤ 2 :=
  le_trans (Finset.card_le_univ _) (by decide)

def resource : (g : Bool) → WordFrom Frag g → Res g := fun g w => kept g w
def calibration : (g : Bool) → Res g → NNReal := fun _ s => ((s.card : ℕ) : NNReal)
def C : Bool → NNReal := fun _ => 2

abbrev K : (g : Bool) → Raw g → WordFrom Frag g → Prop := Cont step resource calibration C

/-- Every word is within budget: there are only two records. -/
theorem in_budget (g : Bool) (w : WordFrom Frag g) : calibration g (resource g w) ≤ C g := by
  show (((kept g w).card : ℕ) : NNReal) ≤ 2
  have h := card_kept_le g w
  exact_mod_cast h

/-! ### The words used -/

/-- Keep the record of the mark of `g`. -/
def wKeep (g : Bool) : WordFrom Frag g :=
  ⟨g, Word.cons (g := g) (h := g) (k := g) Lbl.keep (Word.nil g)⟩

/-- Look at the other mark. -/
def wLook (g : Bool) : WordFrom Frag g :=
  ⟨!g, Word.cons (g := g) (h := !g) (k := !g) Lbl.look (Word.nil (!g))⟩

/-- Turn to the other context. -/
def wTurn (g : Bool) : WordFrom Frag g :=
  ⟨!g, Word.cons (g := g) (h := !g) (k := !g) Lbl.turn (Word.nil (!g))⟩

/-- Look at the other mark, then keep its record. -/
def wLookKeep (g : Bool) : WordFrom Frag g :=
  ⟨!g, Word.cons (g := g) (h := !g) (k := !g) Lbl.look
    (Word.cons (g := !g) (h := !g) (k := !g) Lbl.keep (Word.nil (!g)))⟩

/-- Turn to the other context, then keep the record of its mark. -/
def wTurnKeep (g : Bool) : WordFrom Frag g :=
  ⟨!g, Word.cons (g := g) (h := !g) (k := !g) Lbl.turn
    (Word.cons (g := !g) (h := !g) (k := !g) Lbl.keep (Word.nil (!g)))⟩













/-- The record of a context's mark can be kept exactly where the side is true. -/
theorem wKeep_in_iff (g : Bool) (x : St) : K g x (wKeep g) ↔ x = true := by
  constructor
  · rintro ⟨⟨_, _, ⟨_, hx, _⟩, _⟩, _⟩
    exact hx
  · intro h
    exact ⟨⟨x, x, ⟨rfl, h, rfl⟩, rfl⟩, in_budget _ _⟩

/-- Different raw states of a context have different continuation profiles. -/
theorem profile_inj (g : Bool) (x y : St) (h : K g x = K g y) : x = y := by
  have h1 : x = true ↔ y = true := by
    rw [← wKeep_in_iff g x, ← wKeep_in_iff g y, h]
  exact Bool.eq_iff_iff.mpr h1

/-! ### The distinctions and what they need -/

/-- The mark of a context reads the side. -/
def dG : St → Bool := fun x => x

/-- The distinction domain of each context: its one mark. -/
abbrev Delta : (g : Bool) → (St → Bool) → Prop := fun _ d => d = dG

noncomputable instance instDecEqDomain (g : Bool) : DecidableEq {d : St → Bool // Delta g d} :=
  Classical.decEq _

abbrev Dist (g : Bool) : Type := {d : St → Bool // Delta g d}

/-- The mark of context `g`, as a distinction of its domain. -/
def dd (g : Bool) : Dist g := ⟨dG, rfl⟩



theorem hresp (g : Bool) (d : {d : St → Bool // Delta g d}) (x y : St) (h : K g x = K g y) :
    d.val x = d.val y := by
  rw [profile_inj g x y h]

/-- The records a distinction needs: the record of its context's mark. -/
def fam (g : Bool) (_ : Dist g) : Finset Rc := {recIn g}

/-! ### Protocols: every word -/

def protocols : (g : Bool) → Set (WordFrom Frag g) := fun _ => Set.univ

abbrev Pr (g : Bool) : Type := {p : WordFrom Frag g // p ∈ protocols g}

/-- The protocol that does nothing. -/
def pNull (g : Bool) : Pr g := ⟨nullWord g, Set.mem_univ _⟩

/-- The protocol that keeps the record of the mark. -/
def pKeep (g : Bool) : Pr g := ⟨wKeep g, Set.mem_univ _⟩

def keptP (g : Bool) (p : Pr g) : Finset Rc := kept g p.val

def maint (g : Bool) (p : {p : WordFrom Frag g // p ∈ protocols g}) : Set Rc := ↑(kept g p.val)
def suff (g : Bool) (_ : {p : WordFrom Frag g // p ∈ protocols g}) (s : Set Rc)
    (_ : {d : St → Bool // Delta g d}) : Prop := recIn g ∈ s
def uses (g : Bool) (_ : {p : WordFrom Frag g // p ∈ protocols g})
    (_ : {d : St → Bool // Delta g d}) (_ : Set Rc) : Prop := True
def wholeRes (g : Bool) (p : {p : WordFrom Frag g // p ∈ protocols g}) : Res g := resource g p.val














/-- The family cost of the ledger on this world, in context `g`. -/
noncomputable abbrev fcost (g : Bool) (S : Finset (Dist g)) : ℝ :=
  APFPaper1.Source.familyCost (wholeRes g) (calibration g) (maint g) (suff g) (uses g) S









/-! ### B06 on the physical domain, at the extensional joint class -/

noncomputable def heldD (g : Bool) : Finset (Dist g) := {dd g}

/-- The occupant's alignment in context `g`: it sits where the mark is held true and carries the
mark. -/
noncomputable def alignR (g : Bool) : APFB06.OriginalAlignment (K g)
    (APFB06.physicalDomain (K g) (Delta g) (hresp g)) where
  carrier := APFB01.physicalClass (K g) true
  carried := (heldD g).map (APFB06.taskEquiv (K g) (Delta g) (hresp g)).symm.toEmbedding
  active := by
    intro t ht
    obtain ⟨d, hd, rfl⟩ := Finset.mem_map.mp ht
    rw [Finset.mem_singleton.mp hd]
    rfl

def actualJointR : Set (Sigma fun g =>
    APFB06.OriginalAlignment (K g) (APFB06.physicalDomain (K g) (Delta g) (hresp g))) :=
  {⟨false, alignR false⟩}





/-! ### The eight declared forms -/

/-- The eight declared forms on the supplied data. B01 is stated in each context. -/
def EightHold : Prop :=
  (∀ g : Bool, APF_B01_DeclaredInput (K g)
      (fun (f : APFB01.PhysicalState (K g) → Prop) (x : St) => f (APFB01.physicalClass (K g) x))
      (fun (f : APFB01.PhysicalState (K g) → Prop) (x : St) => f (APFB01.physicalClass (K g) x))
      (fun (f : APFB01.PhysicalState (K g) → Prop) (x : St) => f (APFB01.physicalClass (K g) x))
      (fun (f : APFB01.PhysicalState (K g) → Prop) (x : St) =>
        f (APFB01.physicalClass (K g) x))) ∧
    APFB02.B02SourceMeaning (Context := Bool) (X := fun _ => St) (Q := fun g => WordFrom Frag g)
      (P := fun g => {p : WordFrom Frag g // p ∈ protocols g}) (Record := fun _ => Rc)
      K Delta maint suff uses ∧
    APFB03.B03TaskCost (Context := Bool) (D := fun g => {d : St → Bool // Delta g d})
      (P := fun g => {p : WordFrom Frag g // p ∈ protocols g}) (R := fun _ => Finset Rc)
      (Record := fun _ => Rc) wholeRes calibration maint suff uses ∧
    APFB04.B04FiniteCapacity (Context := Bool) (fun g => ((C g : NNReal) : ℝ)) ∧
    APFB05.MarginalFloor (Context := Bool) (D := fun g => {d : St → Bool // Delta g d})
      (P := fun g => {p : WordFrom Frag g // p ∈ protocols g}) (R := fun _ => Finset Rc)
      (Record := fun _ => Rc) wholeRes calibration maint suff uses (fun _ _ => True)
      (fun g => ((C g : NNReal) : ℝ)) (fun _ => (1 : ℝ)) ∧
    APFB06.AmendedB06_20260914 K
      (fun g => APFB06.physicalDomain (K g) (Delta g) (hresp g)) protocols
      (fun g => APFB06.extensionalJoint (maint g)
        (fun p s t => suff g p s (APFB06.taskEquiv (K g) (Delta g) (hresp g) t))
        (fun p t s => uses g p (APFB06.taskEquiv (K g) (Delta g) (hresp g) t) s))
      wholeRes calibration C actualJointR ∧
    APFB07a.A2Selection (Interface := Bool)
      (Configuration := fun g => APFB01.PhysicalState (K g))
      (fun g s => s = APFB01.physicalClass (K g) true) (fun _ _ => (1 : ℝ))
      (fun g => APFB01.physicalClass (K g) true) ∧
    APFB07b.BWUniqueMinimum (Interface := Bool)
      (Configuration := fun g => APFB01.PhysicalState (K g))
      (fun g s => s = APFB01.physicalClass (K g) true) (fun _ _ => (1 : ℝ))



/-! ### B02 with its second sentence -/





/-! ### The occupant statement in full -/









/-! ### The candidate sentence, on this world -/

























/-! ### The record sentences, of every word -/

/-- Each record costs 1. -/
def recCost : Rc → NNReal := fun _ => 1











/-! ### B07b with both sides admissible -/









end APFB06.TwoContextWorld
Source
Theorems.Thm_APFB06_two_context_world; Pullbacks v46, SHA-256 b16c2056b084c948c40c1a73412e50e72d2886c426ce5f3010430c6209fbdb69. Theorems.Thm_APFB06_two_context_world; pullbacks v46; SHA-256 b16c2056b084c948c40c1a73412e50e72d2886c426ce5f3010430c6209fbdb69

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me