pith. machine review for the scientific record. sign in
lemma

minIndex_spec

proved
show as:
view math explainer →
module
IndisputableMonolith.Foundation.Atomicity
domain
Foundation
line
372 · github
papers citing
none yet

open explainer

Read the cached plain-language explainer.

open lean source

IndisputableMonolith.Foundation.Atomicity on GitHub at line 372.

browse module

All declarations in this module, on Recognition.

explainer page

A cached Ask Recognition explainer exists for this declaration.

open explainer

depends on

used by

formal source

 369noncomputable def minIndex (e : E.Event) : ℕ :=
 370  Nat.find (enum_surjective (E:=E) e)
 371
 372lemma minIndex_spec (e : E.Event) : enum (E:=E) (minIndex (E:=E) e) = e := by
 373  classical
 374  unfold minIndex
 375  exact Nat.find_spec (enum_surjective (E:=E) e)
 376
 377lemma minIndex_min (e : E.Event) {n : ℕ} (h : enum (E:=E) n = e) :
 378    minIndex (E:=E) e ≤ n := by
 379  classical
 380  unfold minIndex
 381  exact Nat.find_min' (enum_surjective (E:=E) e) h
 382
 383/-- A canonical countable schedule derived from `minIndex`. Each event appears
 384    exactly once at its minimal enumeration index. -/
 385noncomputable def scheduleByMinIndex : CountableSchedule E.Event :=
 386{ postAt := fun n =>
 387    if h : ∃ e : E.Event, minIndex (E:=E) e = n then
 388      some (Classical.choose h)
 389    else none
 390, nodup := by
 391    intro n₁ n₂ e h₁ h₂
 392    classical
 393    unfold scheduleByMinIndex at h₁ h₂
 394    simp only at h₁ h₂
 395    rcases Classical.decEq (∃ e, minIndex (E:=E) e = n₁) with hdec₁ | hdec₁
 396    · simp [scheduleByMinIndex._match_1, hdec₁] at h₁
 397    · rcases h₁
 398    rcases Classical.decEq (∃ e, minIndex (E:=E) e = n₂) with hdec₂ | hdec₂
 399    · simp [scheduleByMinIndex._match_1, hdec₂] at h₂
 400    · rcases h₂
 401    -- In the `some` branches on both sides
 402    have hsome₁ : ∃ e, minIndex (E:=E) e = n₁ := by