everyoneishere — a product as an assay, on Face
77 receipts inline · 669 lines · pinned a286109c2940144a — shasum -a 256 of this file, cut to 16, as pins has it · lake env lean everyoneishere.lean prints nothing when every receipt passes
import Face
open Room Face
set_option autoImplicit false
namespace EveryoneIsHere
inductive Entry where
| arrives (seat : Nat)
| says (seat : Nat)
| marks (seat : Nat) (words : Nat) (toward : Option Nat)
| acks (seat : Nat) (mark : Nat)
/-- info: 'EveryoneIsHere.Entry' does not depend on any axioms -/
#guard_msgs in #print axioms Entry
def entryAt : List Entry → Nat → Option Entry
| [], _ => none
| e :: _, 1 => some e
| _ :: r, n + 2 => entryAt r (n + 1)
| _ :: _, 0 => none
/-- info: 'EveryoneIsHere.entryAt' does not depend on any axioms -/
#guard_msgs in #print axioms entryAt
def seated : List Entry → Nat → Bool
| [], _ => false
| Entry.arrives h :: r, s => Nat.beq h s || seated r s
| Entry.says _ :: r, s => seated r s
| Entry.marks _ _ _ :: r, s => seated r s
| Entry.acks _ _ :: r, s => seated r s
/-- info: 'EveryoneIsHere.seated' does not depend on any axioms -/
#guard_msgs in #print axioms seated
def saidBy (s : Nat) : Option Entry → Bool
| some (Entry.says h) => Nat.beq h s
| some (Entry.arrives _) => false
| some (Entry.marks _ _ _) => false
| some (Entry.acks _ _) => false
| none => false
/-- info: 'EveryoneIsHere.saidBy' does not depend on any axioms -/
#guard_msgs in #print axioms saidBy
def wordsOf (r : List Entry) (n s : Nat) : Bool := saidBy s (entryAt r n)
/-- info: 'EveryoneIsHere.wordsOf' does not depend on any axioms -/
#guard_msgs in #print axioms wordsOf
def either (b : Bool) (y n : Option Nat) : Option Nat :=
match b with
| true => y
| false => n
/-- info: 'EveryoneIsHere.either' does not depend on any axioms -/
#guard_msgs in #print axioms either
def stepHolder (n i : Nat) : Entry → Option Nat → Option Nat
| Entry.marks m _ _, h => either (Nat.beq i n) (some m) h
| Entry.acks a k, h => either (Nat.beq k n) (some a) h
| Entry.arrives _, h => h
| Entry.says _, h => h
/-- info: 'EveryoneIsHere.stepHolder' does not depend on any axioms -/
#guard_msgs in #print axioms stepHolder
def holderGo (n : Nat) : List Entry → Nat → Option Nat → Option Nat
| [], _, h => h
| e :: r, i, h => holderGo n r (i + 1) (stepHolder n i e h)
/-- info: 'EveryoneIsHere.holderGo' does not depend on any axioms -/
#guard_msgs in #print axioms holderGo
def holder (r : List Entry) (n : Nat) : Option Nat := holderGo n r 1 none
/-- info: 'EveryoneIsHere.holder' does not depend on any axioms -/
#guard_msgs in #print axioms holder
def reachesFor (marker : Nat) (toward : Option Nat) (s : Nat) : Bool :=
match toward with
| some t => Nat.beq t s
| none => !Nat.beq marker s
/-- info: 'EveryoneIsHere.reachesFor' does not depend on any axioms -/
#guard_msgs in #print axioms reachesFor
def optSame : Option Nat → Option Nat → Bool
| some a, some b => Nat.beq a b
| none, none => true
| some _, none => false
| none, some _ => false
/-- info: 'EveryoneIsHere.optSame' does not depend on any axioms -/
#guard_msgs in #print axioms optSame
def ackable (r : List Entry) (h n : Nat) : Option Entry → Bool
| some (Entry.marks m _ t) => seated r h && reachesFor m t h && optSame (holder r n) (some m)
| some (Entry.arrives _) => false
| some (Entry.says _) => false
| some (Entry.acks _ _) => false
| none => false
/-- info: 'EveryoneIsHere.ackable' does not depend on any axioms -/
#guard_msgs in #print axioms ackable
def admit (r : List Entry) : Entry → Bool
| Entry.arrives h => !seated r h
| Entry.says h => seated r h
| Entry.marks h w _ => seated r h && wordsOf r w h
| Entry.acks h n => ackable r h n (entryAt r n)
/-- info: 'EveryoneIsHere.admit' does not depend on any axioms -/
#guard_msgs in #print axioms admit
def keepIf : Bool → List Entry → List Entry → List Entry
| true, y, _ => y
| false, _, n => n
/-- info: 'EveryoneIsHere.keepIf' does not depend on any axioms -/
#guard_msgs in #print axioms keepIf
def move (r : List Entry) (e : Entry) : List Entry := keepIf (admit r e) (r ++ [e]) r
/-- info: 'EveryoneIsHere.move' does not depend on any axioms -/
#guard_msgs in #print axioms move
def moves (r : List Entry) : List Entry → List Entry
| [] => r
| e :: es => moves (move r e) es
/-- info: 'EveryoneIsHere.moves' does not depend on any axioms -/
#guard_msgs in #print axioms moves
def theDay : List Entry :=
moves [] [Entry.arrives 1, Entry.arrives 2, Entry.says 1, Entry.marks 1 3 (some 2), Entry.marks 2 3 none,
Entry.acks 3 4, Entry.acks 1 4, Entry.acks 2 4, Entry.acks 2 4, Entry.says 3]
#guard theDay.length == 5
#guard holder theDay 4 == some 2
#guard admit theDay (Entry.marks 2 3 none) == false
#guard admit theDay (Entry.marks 1 3 none) == true
#guard admit theDay (Entry.acks 1 4) == false
#guard seated theDay 3 == false
#guard admit theDay (Entry.marks 1 3 (some 9)) == true
/-- info: 'EveryoneIsHere.theDay' does not depend on any axioms -/
#guard_msgs in #print axioms theDay
inductive Step where
| looks (place : Nat)
| acts (e : Entry)
/-- info: 'EveryoneIsHere.Step' does not depend on any axioms -/
#guard_msgs in #print axioms Step
def walk : List Entry → List Step → List Entry
| r, [] => r
| r, Step.looks _ :: s => walk r s
| r, Step.acts e :: s => walk (move r e) s
/-- info: 'EveryoneIsHere.walk' does not depend on any axioms -/
#guard_msgs in #print axioms walk
def actsOf : List Step → List Entry
| [] => []
| Step.looks _ :: s => actsOf s
| Step.acts e :: s => e :: actsOf s
/-- info: 'EveryoneIsHere.actsOf' does not depend on any axioms -/
#guard_msgs in #print axioms actsOf
def theDayWandered : List Entry :=
walk [] [Step.looks 0, Step.acts (Entry.arrives 1), Step.looks 1, Step.looks 1, Step.acts (Entry.arrives 2),
Step.acts (Entry.says 1), Step.looks 3, Step.acts (Entry.marks 1 3 (some 2)), Step.looks 4, Step.looks 2,
Step.acts (Entry.marks 2 3 none), Step.acts (Entry.acks 3 4), Step.acts (Entry.acks 1 4), Step.looks 4,
Step.acts (Entry.acks 2 4), Step.acts (Entry.acks 2 4), Step.looks 9, Step.acts (Entry.says 3)]
#guard theDayWandered.length == theDay.length
#guard holder theDayWandered 4 == holder theDay 4
/-- info: 'EveryoneIsHere.theDayWandered' does not depend on any axioms -/
#guard_msgs in #print axioms theDayWandered
def tapeFace : Face := ⟨List Entry, Nat, Option Entry, entryAt⟩
/-- info: 'EveryoneIsHere.tapeFace' does not depend on any axioms -/
#guard_msgs in #print axioms tapeFace
def noOne : Face := originFace Nat
/-- info: 'EveryoneIsHere.noOne' does not depend on any axioms -/
#guard_msgs in #print axioms noOne
def heldCount (r : List Entry) : Nat := ((List.range (r.length + 1)).filter (fun n => (holder r n).isSome)).length
/-- info: 'EveryoneIsHere.heldCount' does not depend on any axioms -/
#guard_msgs in #print axioms heldCount
def markCount : List Entry → Nat
| [] => 0
| Entry.marks _ _ _ :: r => markCount r + 1
| Entry.arrives _ :: r => markCount r
| Entry.says _ :: r => markCount r
| Entry.acks _ _ :: r => markCount r
#guard heldCount theDay == markCount theDay
#guard heldCount theDayWandered == markCount theDayWandered
/-- info: 'EveryoneIsHere.markCount' does not depend on any axioms -/
#guard_msgs in #print axioms markCount
def renameEntry (σ : Nat → Nat) : Entry → Entry
| Entry.arrives s => Entry.arrives (σ s)
| Entry.says s => Entry.says (σ s)
| Entry.marks s w t => Entry.marks (σ s) w (t.map σ)
| Entry.acks s k => Entry.acks (σ s) k
/-- info: 'EveryoneIsHere.renameEntry' does not depend on any axioms -/
#guard_msgs in #print axioms renameEntry
def renamed (σ : Nat → Nat) (r : List Entry) : List Entry := r.map (renameEntry σ)
/-- info: 'EveryoneIsHere.renamed' does not depend on any axioms -/
#guard_msgs in #print axioms renamed
def depthFace : Face := ⟨List Entry, Unit, Nat, fun r _ => r.length⟩
/-- info: 'EveryoneIsHere.depthFace' does not depend on any axioms -/
#guard_msgs in #print axioms depthFace
def readsTheOrder (L : Face) (o : L.State → L.State → Bool) : Prop :=
∀ x x' y y', alike L x x' → alike L y y' → o x y = o x' y'
/-- info: 'EveryoneIsHere.readsTheOrder' does not depend on any axioms -/
#guard_msgs in #print axioms readsTheOrder
def theDayRenamedDepth : Nat := (renamed (fun s => s + 10) theDay).length
/-- info: 'EveryoneIsHere.theDayRenamedDepth' does not depend on any axioms -/
#guard_msgs in #print axioms theDayRenamedDepth
def theDayRenamedHolder : Option Nat := holder (renamed (fun s => s + 10) theDay) 4
/-- info: 'EveryoneIsHere.theDayRenamedHolder' does not depend on any axioms -/
#guard_msgs in #print axioms theDayRenamedHolder
def twoArrivalsMergedDepth : Nat := (moves [] (renamed (fun _ => 1) [Entry.arrives 1, Entry.arrives 2])).length
/-- info: 'EveryoneIsHere.twoArrivalsMergedDepth' does not depend on any axioms -/
#guard_msgs in #print axioms twoArrivalsMergedDepth
def twoArrivalsDepth : Nat := (moves [] [Entry.arrives 1, Entry.arrives 2]).length
#guard theDayRenamedDepth == theDay.length
#guard theDayRenamedHolder == some 12
#guard twoArrivalsMergedDepth == 1
#guard twoArrivalsDepth == 2
/-- info: 'EveryoneIsHere.twoArrivalsDepth' does not depend on any axioms -/
#guard_msgs in #print axioms twoArrivalsDepth
def worldRoom : List Entry := moves [] [Entry.arrives 1, Entry.arrives 2]
/-- info: 'EveryoneIsHere.worldRoom' does not depend on any axioms -/
#guard_msgs in #print axioms worldRoom
def tickOnce (r : List Entry) : List Entry :=
moves r [Entry.says 1, Entry.marks 1 (r.length + 1) (some 2), Entry.says 2, Entry.acks 2 (r.length + 2)]
/-- info: 'EveryoneIsHere.tickOnce' does not depend on any axioms -/
#guard_msgs in #print axioms tickOnce
def ticked : Nat → List Entry → List Entry
| 0, r => r
| k + 1, r => ticked k (tickOnce r)
/-- info: 'EveryoneIsHere.ticked' does not depend on any axioms -/
#guard_msgs in #print axioms ticked
def worldAfter (k : Nat) (_secret : Nat) : List Entry := ticked k worldRoom
/-- info: 'EveryoneIsHere.worldAfter' does not depend on any axioms -/
#guard_msgs in #print axioms worldAfter
def fourTicksLength : Nat := (worldAfter 4 7).length
/-- info: 'EveryoneIsHere.fourTicksLength' does not depend on any axioms -/
#guard_msgs in #print axioms fourTicksLength
def fourTicksHolder : Option Nat := holder (worldAfter 4 7) 16
#guard fourTicksLength == 18
#guard fourTicksHolder == some 2
/-- info: 'EveryoneIsHere.fourTicksHolder' does not depend on any axioms -/
#guard_msgs in #print axioms fourTicksHolder
theorem appending_nothing_is_still (r : List Entry) : r = r ++ [] := by
induction r with
| nil => rfl
| cons x r ih => exact congrArg (List.cons x) ih
/-- info: 'EveryoneIsHere.appending_nothing_is_still' does not depend on any axioms -/
#guard_msgs in #print axioms appending_nothing_is_still
theorem the_second_of_two {a b : Bool} (h : (a && b) = true) : b = true := by
cases a <;> cases b <;> first | rfl | cases h
/-- info: 'EveryoneIsHere.the_second_of_two' does not depend on any axioms -/
#guard_msgs in #print axioms the_second_of_two
theorem the_holder_reads_the_last_entry (n : Nat) :
∀ (r : List Entry) (i : Nat) (x : Option Nat) (e : Entry),
holderGo n (r ++ [e]) i x = stepHolder n (i + r.length) e (holderGo n r i x)
| [], i, x, e => rfl
| d :: r, i, x, e => by
show holderGo n (r ++ [e]) (i + 1) (stepHolder n i d x) = stepHolder n (i + (r.length + 1)) e (holderGo n r (i + 1) (stepHolder n i d x))
rw [the_holder_reads_the_last_entry n r (i + 1) (stepHolder n i d x) e, Nat.add_right_comm, Nat.add_assoc]
/-- info: 'EveryoneIsHere.the_holder_reads_the_last_entry' does not depend on any axioms -/
#guard_msgs in #print axioms the_holder_reads_the_last_entry
theorem holding_moves_only_at_an_ack_or_at_the_making (n j : Nat) (e : Entry) (x : Option Nat)
(moved : stepHolder n j e x ≠ x) :
(∃ a, e = Entry.acks a n) ∨ (∃ m w t, e = Entry.marks m w t ∧ j = n) := by
cases e with
| arrives s => exact absurd rfl moved
| says s => exact absurd rfl moved
| marks m w t =>
cases hb : Nat.beq j n with
| true => exact Or.inr ⟨m, w, t, rfl, Nat.eq_of_beq_eq_true hb⟩
| false => exact absurd (by show either (Nat.beq j n) (some m) x = x; rw [hb]; rfl) moved
| acks a k =>
cases hb : Nat.beq k n with
| true => exact Or.inl ⟨a, by rw [Nat.eq_of_beq_eq_true hb]⟩
| false => exact absurd (by show either (Nat.beq k n) (some a) x = x; rw [hb]; rfl) moved
/-- info: 'EveryoneIsHere.holding_moves_only_at_an_ack_or_at_the_making' does not depend on any axioms -/
#guard_msgs in #print axioms holding_moves_only_at_an_ack_or_at_the_making
theorem a_look_writes_nothing : ∀ (s : List Step) (r : List Entry), walk r s = moves r (actsOf s)
| [], _ => rfl
| Step.looks _ :: s, r => a_look_writes_nothing s r
| Step.acts e :: s, r => a_look_writes_nothing s (move r e)
/-- info: 'EveryoneIsHere.a_look_writes_nothing' does not depend on any axioms -/
#guard_msgs in #print axioms a_look_writes_nothing
theorem the_tape_merges_the_walkers (r : List Entry) (w w' : List Nat) :
alike (host tapeFace (List Nat)) (atTheDoor r w) (atTheDoor r w') :=
(by (apply Face.the_host_merges_the_guests <;> fail))
/-- info: 'EveryoneIsHere.the_tape_merges_the_walkers' does not depend on any axioms -/
#guard_msgs in #print axioms the_tape_merges_the_walkers
theorem a_wider_seat_reads_the_walk (r : List Entry) {w w' : List Nat} (h : w ≠ w') :
¬ alike (widen tapeFace (List Nat)) (atTheDoor r w) (atTheDoor r w') :=
(by (apply Face.a_wider_seat_reads_the_remainder <;> assumption))
/-- info: 'EveryoneIsHere.a_wider_seat_reads_the_walk' does not depend on any axioms -/
#guard_msgs in #print axioms a_wider_seat_reads_the_walk
theorem no_one_is_everyone_at_the_zeroth_door (s t : Nat) : alike noOne s t :=
the_origin_merges_every_seat s t
-- custody (2026-11-24): a council of three, on Isaac's question "we might be close to having conservation laws in
-- EIH?", found the conserved thing is custody, not openness: every end has one holder from its mark, the mark is the
-- only source, and between makings no move makes a holder appear or vanish (everyoneishere model.md, the same day)
/-- info: 'EveryoneIsHere.no_one_is_everyone_at_the_zeroth_door' does not depend on any axioms -/
#guard_msgs in #print axioms no_one_is_everyone_at_the_zeroth_door
theorem the_moves_resume : ∀ (es : List Entry) (r : List Entry) (es' : List Entry),
moves r (es ++ es') = moves (moves r es) es' :=
by
(intro x; induction x;
all_goals
(first
| (intros; rfl)
| (rename_i ih; intros; exact ih _ _)))
/-- info: 'EveryoneIsHere.the_moves_resume' does not depend on any axioms -/
#guard_msgs in #print axioms the_moves_resume
theorem the_looks_drop_out_of_any_split : ∀ (s s' : List Step), actsOf (s ++ s') = actsOf s ++ actsOf s'
| [], _ => rfl
| Step.looks _ :: s, s' => the_looks_drop_out_of_any_split s s'
| Step.acts e :: s, s' => congrArg (List.cons e) (the_looks_drop_out_of_any_split s s')
/-- info: 'EveryoneIsHere.the_looks_drop_out_of_any_split' does not depend on any axioms -/
#guard_msgs in #print axioms the_looks_drop_out_of_any_split
theorem histories_resume_but_tapes_do_not_append :
moves [Entry.arrives 1] [Entry.arrives 1] ≠ [Entry.arrives 1] ++ moves [] [Entry.arrives 1] :=
fun h => nomatch h
/-- info: 'EveryoneIsHere.histories_resume_but_tapes_do_not_append' does not depend on any axioms -/
#guard_msgs in #print axioms histories_resume_but_tapes_do_not_append
theorem no_one_is_the_unit_of_looking (x y : door (List Entry) Nat) :
alike (pairFace tapeFace noOne face met) x y ↔ alike tapeFace (face x) (face y) :=
(by (apply Face.the_origin_is_the_pairs_unit <;> fail))
/-- info: 'EveryoneIsHere.no_one_is_the_unit_of_looking' does not depend on any axioms -/
#guard_msgs in #print axioms no_one_is_the_unit_of_looking
theorem the_empty_walk_is_the_identity (r : List Entry) (s : List Step) :
walk r ([] ++ s) = walk r s ∧ walk r (s ++ []) = walk r s ∧ walk r [] = r :=
⟨rfl, congrArg (walk r) (the_append_rests s), rfl⟩
/-- info: 'EveryoneIsHere.the_empty_walk_is_the_identity' does not depend on any axioms -/
#guard_msgs in #print axioms the_empty_walk_is_the_identity
theorem the_depth_hears_no_renaming (σ : Nat → Nat) : unheard depthFace (renamed σ) :=
by (intro _ y; induction y; all_goals ((intros; (apply Room.len_map <;> fail))))
/-- info: 'EveryoneIsHere.the_depth_hears_no_renaming' does not depend on any axioms -/
#guard_msgs in #print axioms the_depth_hears_no_renaming
theorem a_renaming_is_read_on_the_tape : ¬ unheard tapeFace (renamed Nat.succ) := by
intro h
have hb := congrArg (fun o : Option Entry => seated o.toList 1) (h [Entry.arrives 1] (1 : Nat))
nomatch hb
/-- info: 'EveryoneIsHere.a_renaming_is_read_on_the_tape' does not depend on any axioms -/
#guard_msgs in #print axioms a_renaming_is_read_on_the_tape
theorem the_step_follows_any_renaming (σ : Nat → Nat) (n i : Nat) (e : Entry) (x : Option Nat) :
stepHolder n i (renameEntry σ e) (x.map σ) = (stepHolder n i e x).map σ := by
cases e with
| arrives _ => rfl
| says _ => rfl
| marks m w t =>
show either (Nat.beq i n) (some (σ m)) (x.map σ) = (either (Nat.beq i n) (some m) x).map σ
cases Nat.beq i n <;> rfl
| acks a k =>
show either (Nat.beq k n) (some (σ a)) (x.map σ) = (either (Nat.beq k n) (some a) x).map σ
cases Nat.beq k n <;> rfl
/-- info: 'EveryoneIsHere.the_step_follows_any_renaming' does not depend on any axioms -/
#guard_msgs in #print axioms the_step_follows_any_renaming
theorem no_entry_sits_at_zero : ∀ r : List Entry, entryAt r 0 = none
| [] => rfl
| _ :: _ => rfl
/-- info: 'EveryoneIsHere.no_entry_sits_at_zero' does not depend on any axioms -/
#guard_msgs in #print axioms no_entry_sits_at_zero
theorem a_partial_view_would_not_read_the_depth :
alike (rehear tapeFace (fun _ : Unit => (1 : Nat))) [Entry.arrives 1] [Entry.arrives 1, Entry.arrives 2] ∧
[Entry.arrives 1].length ≠ [Entry.arrives 1, Entry.arrives 2].length :=
⟨fun _ => rfl, fun h => nomatch congrArg (Nat.beq 1) h⟩
/-- info: 'EveryoneIsHere.a_partial_view_would_not_read_the_depth' does not depend on any axioms -/
#guard_msgs in #print axioms a_partial_view_would_not_read_the_depth
theorem no_looker_orders_what_it_cannot_tell_apart (L : Face) (o : L.State → L.State → Bool)
(ho : readsTheOrder L o) {x y : L.State} (h : alike L x y) : o x y = o y x :=
ho x y y x h (fun p => (h p).symm)
/-- info: 'EveryoneIsHere.no_looker_orders_what_it_cannot_tell_apart' does not depend on any axioms -/
#guard_msgs in #print axioms no_looker_orders_what_it_cannot_tell_apart
theorem the_kernel_reads_its_numbers_one_seat_wider :
¬ alike (sharpen (reseat tapeFace (fun _ : Nat => [])) (fun n : Nat => n)) (1 : Nat) (2 : Nat) :=
(by (apply Face.a_wider_seat_reads_the_remainder <;> decide))
/-- info: 'EveryoneIsHere.the_kernel_reads_its_numbers_one_seat_wider' does not depend on any axioms -/
#guard_msgs in #print axioms the_kernel_reads_its_numbers_one_seat_wider
theorem the_world_room_never_hears_the_secret (k s s' : Nat) : worldAfter k s = worldAfter k s' :=
by (intros; (repeat' constructor); all_goals (intros; fail))
/-- info: 'EveryoneIsHere.the_world_room_never_hears_the_secret' does not depend on any axioms -/
#guard_msgs in #print axioms the_world_room_never_hears_the_secret
theorem the_world_room_merges_the_secrets (k s s' : Nat) :
alike (host tapeFace Nat) (atTheDoor (worldAfter k s) s) (atTheDoor (worldAfter k s') s') :=
(by (apply Face.the_host_merges_the_guests <;> fail))
/-- info: 'EveryoneIsHere.the_world_room_merges_the_secrets' does not depend on any axioms -/
#guard_msgs in #print axioms the_world_room_merges_the_secrets
theorem a_wider_seat_reads_the_secret (k : Nat) {s s' : Nat} (h : s ≠ s') :
¬ alike (widen tapeFace Nat) (atTheDoor (worldAfter k s) s) (atTheDoor (worldAfter k s') s') :=
(by (apply Face.a_wider_seat_reads_the_remainder <;> assumption))
/-- info: 'EveryoneIsHere.a_wider_seat_reads_the_secret' does not depend on any axioms -/
#guard_msgs in #print axioms a_wider_seat_reads_the_secret
theorem the_tape_only_grows (r : List Entry) (e : Entry) : ∃ t, move r e = r ++ t := by
show ∃ t, keepIf (admit r e) (r ++ [e]) r = r ++ t
cases admit r e with
| true => exact ⟨[e], rfl⟩
| false => exact ⟨[], appending_nothing_is_still r⟩
/-- info: 'EveryoneIsHere.the_tape_only_grows' does not depend on any axioms -/
#guard_msgs in #print axioms the_tape_only_grows
theorem only_you_mark_your_own_words (r : List Entry) (h w : Nat) (t : Option Nat)
(ok : admit r (Entry.marks h w t) = true) : wordsOf r w h = true :=
(by (apply the_second_of_two <;> assumption))
/-- info: 'EveryoneIsHere.only_you_mark_your_own_words' does not depend on any axioms -/
#guard_msgs in #print axioms only_you_mark_your_own_words
theorem holding_moves_only_at_a_handshake (r : List Entry) (n : Nat) (e : Entry)
(moved : holder (r ++ [e]) n ≠ holder r n) :
(∃ a, e = Entry.acks a n) ∨ (∃ m w t, e = Entry.marks m w t ∧ 1 + r.length = n) :=
holding_moves_only_at_an_ack_or_at_the_making n (1 + r.length) e (holder r n)
(by
intro same
apply moved
show holderGo n (r ++ [e]) 1 none = holderGo n r 1 none
rw [the_holder_reads_the_last_entry n r 1 none e]
exact same)
/-- info: 'EveryoneIsHere.holding_moves_only_at_a_handshake' does not depend on any axioms -/
#guard_msgs in #print axioms holding_moves_only_at_a_handshake
theorem walkers_who_move_alike_leave_one_tape (r : List Entry) (s s' : List Step) (same : actsOf s = actsOf s') :
walk r s = walk r s' := by
rw [a_look_writes_nothing s r, a_look_writes_nothing s' r, same]
/-- info: 'EveryoneIsHere.walkers_who_move_alike_leave_one_tape' does not depend on any axioms -/
#guard_msgs in #print axioms walkers_who_move_alike_leave_one_tape
theorem holding_neither_appears_nor_vanishes_between_makings (r : List Entry) (e : Entry) (n : Nat)
(notMark : ∀ m w t, e ≠ Entry.marks m w t) : (holder (move r e) n).isSome = (holder r n).isSome := by
show (holderGo n (keepIf (admit r e) (r ++ [e]) r) 1 none).isSome = (holder r n).isSome
cases ha : admit r e with
| false => rfl
| true =>
show (holderGo n (r ++ [e]) 1 none).isSome = (holder r n).isSome
rw [the_holder_reads_the_last_entry n r 1 none e]
cases e with
| arrives s => rfl
| says s => rfl
| marks m w t => exact absurd rfl (notMark m w t)
| acks a k =>
show (either (Nat.beq k n) (some a) (holder r n)).isSome = (holder r n).isSome
cases hb : Nat.beq k n with
| false => rfl
| true =>
have kn : k = n := Nat.eq_of_beq_eq_true hb
subst kn
have hk : ackable r a k (entryAt r k) = true := ha
revert hk
cases entryAt r k with
| none => intro hk; cases hk
| some d =>
cases d with
| arrives _ => intro hk; cases hk
| says _ => intro hk; cases hk
| acks _ _ => intro hk; cases hk
| marks m w t =>
intro hk
have hs : optSame (holder r k) (some m) = true := the_second_of_two hk
revert hs
cases holder r k with
| none => intro hs; cases hs
| some _ => intro _; rfl
-- positions (2026-11-29): keystone (4) in everyoneishere model.md asked whether positions compose or only resemble
-- it. at the kernel's grain: histories compose (walks under append, the empty walk a two-sided identity, the looks
-- dropping out of any split), and they act on tapes by resuming (the_park_resumes' shape); tapes themselves do not
-- compose by appending, because admission reads the prefix. so every looker is nobody (the empty tape) plus history
#guard (moves (moves [] [Entry.arrives 1]) [Entry.arrives 1]).length == 1
#guard ([Entry.arrives 1] ++ moves [] [Entry.arrives 1]).length == 2
#guard (walk (walk [] [Step.looks 0, Step.acts (Entry.arrives 1), Step.looks 1])
[Step.acts (Entry.arrives 2), Step.looks 7]).length == (walk [] [Step.acts (Entry.arrives 1), Step.acts (Entry.arrives 2)]).length
/-- info: 'EveryoneIsHere.holding_neither_appears_nor_vanishes_between_makings' does not depend on any axioms -/
#guard_msgs in #print axioms holding_neither_appears_nor_vanishes_between_makings
theorem every_looker_is_nobody_plus_history (es : List Entry) (s : List Step) :
walk (moves [] es) s = moves [] (es ++ actsOf s) :=
by
(intros; (try dsimp only [Step, walk, actsOf, moves, Entry] at *); intros;
(rw [a_look_writes_nothing]; (apply ((the_moves_resume _ _ _)).symm <;> fail)))
/-- info: 'EveryoneIsHere.every_looker_is_nobody_plus_history' does not depend on any axioms -/
#guard_msgs in #print axioms every_looker_is_nobody_plus_history
theorem the_walks_resume (r : List Entry) (s s' : List Step) : walk r (s ++ s') = walk (walk r s) s' := by
rw [a_look_writes_nothing (s ++ s') r, a_look_writes_nothing s' (walk r s), a_look_writes_nothing s r,
the_looks_drop_out_of_any_split, the_moves_resume]
-- what a looker tells apart (2026-11-29): everyoneishere draws each tape in the looker's own chart, never the
-- kernel's numbering, and asked how a page should order and fold rooms a looker can't tell apart. reach is
-- room-granular (a host insulates an arrival with a fresh room), so whoever looks into a room reads its whole tape
/-- info: 'EveryoneIsHere.the_walks_resume' does not depend on any axioms -/
#guard_msgs in #print axioms the_walks_resume
theorem the_holding_walk_follows_any_renaming (σ : Nat → Nat) (n : Nat) :
∀ (r : List Entry) (i : Nat) (x : Option Nat), holderGo n (renamed σ r) i (x.map σ) = (holderGo n r i x).map σ
| [], _, _ => rfl
| e :: r, i, x => by
show holderGo n (renamed σ r) (i + 1) (stepHolder n i (renameEntry σ e) (x.map σ)) = (holderGo n r (i + 1) (stepHolder n i e x)).map σ
rw [the_step_follows_any_renaming σ n i e x]
exact the_holding_walk_follows_any_renaming σ n r (i + 1) (stepHolder n i e x)
/-- info: 'EveryoneIsHere.the_holding_walk_follows_any_renaming' does not depend on any axioms -/
#guard_msgs in #print axioms the_holding_walk_follows_any_renaming
theorem the_tape_reads_back : ∀ (r r' : List Entry), (∀ n, entryAt r n = entryAt r' n) → r = r'
| [], [], _ => rfl
| [], _ :: _, h => nomatch h 1
| _ :: _, [], h => nomatch h 1
| e :: r, e' :: r', h => by
have he : some e = some e' := h 1
cases he
exact congrArg (List.cons e) (the_tape_reads_back r r' (fun n => match n with
| 0 => (no_entry_sits_at_zero r).trans (no_entry_sits_at_zero r').symm
| k + 1 => h (k + 2)))
/-- info: 'EveryoneIsHere.the_tape_reads_back' does not depend on any axioms -/
#guard_msgs in #print axioms the_tape_reads_back
theorem any_order_among_the_alike_is_someone_elses_chart (L : Face) (o : L.State → L.State → Bool)
{x y : L.State} (h : alike L x y) (strict : o x y ≠ o y x) : ¬ readsTheOrder L o :=
fun ho => strict (no_looker_orders_what_it_cannot_tell_apart L o ho h)
/-- info: 'EveryoneIsHere.any_order_among_the_alike_is_someone_elses_chart' does not depend on any axioms -/
#guard_msgs in #print axioms any_order_among_the_alike_is_someone_elses_chart
theorem the_holder_follows_any_renaming (σ : Nat → Nat) (r : List Entry) (n : Nat) :
holder (renamed σ r) n = (holder r n).map σ :=
the_holding_walk_follows_any_renaming σ n r 1 none
/-- info: 'EveryoneIsHere.the_holder_follows_any_renaming' does not depend on any axioms -/
#guard_msgs in #print axioms the_holder_follows_any_renaming
theorem the_tape_face_is_exact (r r' : List Entry) : alike tapeFace r r' ↔ r = r' :=
⟨the_tape_reads_back r r', fun h => by rw [h]; exact fun _ => rfl⟩
/-- info: 'EveryoneIsHere.the_tape_face_is_exact' does not depend on any axioms -/
#guard_msgs in #print axioms the_tape_face_is_exact
theorem the_kernels_numbers_are_no_lookers_order : ¬ readsTheOrder (reseat tapeFace (fun _ : Nat => [])) Nat.blt :=
any_order_among_the_alike_is_someone_elses_chart (reseat tapeFace (fun _ : Nat => [])) Nat.blt
(x := (1 : Nat)) (y := (2 : Nat)) (fun _ => rfl) (fun h => nomatch h)
/-- info: 'EveryoneIsHere.the_kernels_numbers_are_no_lookers_order' does not depend on any axioms -/
#guard_msgs in #print axioms the_kernels_numbers_are_no_lookers_order
theorem the_depth_is_read_wherever_the_room_is {r r' : List Entry} (h : alike tapeFace r r') :
r.length = r'.length :=
congrArg List.length ((the_tape_face_is_exact r r').mp h)
/-- info: 'EveryoneIsHere.the_depth_is_read_wherever_the_room_is' does not depend on any axioms -/
#guard_msgs in #print axioms the_depth_is_read_wherever_the_room_is
theorem the_lookers_own_history_parts_no_rooms_it_reads_alike (mine : List Entry) {X : Type}
(g : List Entry → List Entry → X) {a b : List Entry} (h : alike tapeFace a b) : g mine a = g mine b := by
rw [(the_tape_face_is_exact a b).mp h]
-- foam's game at the product's carriers (2026-11-23): a world's room, ticked. each tick the wearer says a step, marks
-- it toward the world, the world says its new weight and acks. in the product (spec/frames/game_treaty_spec.rb in
-- everyoneishere) the step's words carry the secret's residue mod 3 and the secret stays on the wearer's own tape;
-- here, at the kernel's grain, words are only that a seat said something, so the secret has nowhere to go at all
/-- info: 'EveryoneIsHere.the_lookers_own_history_parts_no_rooms_it_reads_alike' does not depend on any axioms -/
#guard_msgs in #print axioms the_lookers_own_history_parts_no_rooms_it_reads_alike
end EveryoneIsHere