def
definition
narrativeCost
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Foundation.UniversalForcing.NarrativeRealization on GitHub at line 21.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
formal source
18
19abbrev NarrativeBeat := Nat
20
21def narrativeCost (a b : NarrativeBeat) : Nat :=
22 if a = b then 0 else 1
23
24@[simp] theorem narrativeCost_self (a : NarrativeBeat) : narrativeCost a a = 0 := by
25 simp [narrativeCost]
26
27theorem narrativeCost_symm (a b : NarrativeBeat) : narrativeCost a b = narrativeCost b a := by
28 by_cases h : a = b
29 · subst h; simp [narrativeCost]
30 · have h' : b ≠ a := by intro hb; exact h hb.symm
31 simp [narrativeCost, h, h']
32
33def narrativeInterpret (n : LogicNat) : NarrativeBeat :=
34 LogicNat.toNat n
35
36/-- Narrative realization as beat-count comparison. -/
37def narrativeRealization : LogicRealization where
38 Carrier := NarrativeBeat
39 Cost := Nat
40 zeroCost := inferInstance
41 compare := narrativeCost
42 zero := 0
43 step := Nat.succ
44 Orbit := LogicNat
45 orbitZero := LogicNat.zero
46 orbitStep := LogicNat.succ
47 interpret := narrativeInterpret
48 interpret_zero := by rfl
49 interpret_step := by
50 intro n
51 show LogicNat.toNat (LogicNat.succ n) = Nat.succ (LogicNat.toNat n)