def
definition
natCost
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Foundation.OrderedLogicRealization on GitHub at line 14.
browse module
All declarations in this module, on Recognition.
explainer page
used by
formal source
11namespace OrderedLogicRealization
12
13/-- Equality cost on `Nat`. -/
14def natCost (m n : Nat) : Nat :=
15 if m = n then 0 else 1
16
17@[simp] theorem natCost_self (n : Nat) : natCost n n = 0 := by
18 simp [natCost]
19
20theorem natCost_symm (m n : Nat) : natCost m n = natCost n m := by
21 by_cases h : m = n
22 · subst h
23 simp [natCost]
24 · have h' : n ≠ m := by intro hnm; exact h hnm.symm
25 simp [natCost, h, h']
26
27/-- The ordered natural-number realization. -/
28def natOrderedRealization : LogicRealization where
29 Carrier := Nat
30 Cost := Nat
31 zeroCost := inferInstance
32 compare := natCost
33 zero := 0
34 step := Nat.succ
35 Orbit := ArithmeticFromLogic.LogicNat
36 orbitZero := ArithmeticFromLogic.LogicNat.zero
37 orbitStep := ArithmeticFromLogic.LogicNat.succ
38 interpret := ArithmeticFromLogic.LogicNat.toNat
39 interpret_zero := ArithmeticFromLogic.LogicNat.toNat_zero
40 interpret_step := by
41 intro n
42 exact ArithmeticFromLogic.LogicNat.toNat_succ n
43 orbit_no_confusion := by
44 intro n h