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

Sign

definition
show as:
view math explainer →
module
IndisputableMonolith.RecogGeom.Examples
domain
RecogGeom
line
65 · github
papers citing
none yet

open explainer

Generate a durable explainer page for this declaration.

open lean source

IndisputableMonolith.RecogGeom.Examples on GitHub at line 65.

browse module

All declarations in this module, on Recognition.

explainer page

Tracked in the explainer inventory; generation is lazy so crawlers do not trigger LLM jobs.

open explainer

depends on

used by

formal source

  62  nonempty := ⟨0⟩
  63
  64/-- Three-valued sign type -/
  65inductive Sign : Type
  66  | neg : Sign
  67  | zero : Sign
  68  | pos : Sign
  69  deriving DecidableEq, Repr
  70
  71/-- Sign is nonempty -/
  72instance : Nonempty Sign := ⟨Sign.zero⟩
  73
  74/-- The sign function -/
  75def signOf : ℤ → Sign
  76  | n => if n < 0 then Sign.neg else if n = 0 then Sign.zero else Sign.pos
  77
  78/-- The sign recognizer on ℤ -/
  79def signRecognizer : Recognizer ℤ Sign where
  80  R := signOf
  81  nontrivial := by
  82    use -1, 1
  83    simp [signOf]
  84
  85/-- **Theorem**: Two integers are indistinguishable iff same sign -/
  86theorem sign_indistinguishable (n m : ℤ) :
  87    Indistinguishable signRecognizer n m ↔ signOf n = signOf m := by
  88  rfl
  89
  90/-- **Theorem**: -5 ~ -3 (both negative) -/
  91theorem neg_indist : Indistinguishable signRecognizer (-5) (-3) := by
  92  simp [Indistinguishable, signRecognizer, signOf]
  93
  94/-- **Theorem**: -1 ≁ 1 (different signs) -/
  95theorem neg_pos_dist : ¬Indistinguishable signRecognizer (-1) 1 := by