Documentation

Std.Data.String.ToInt

theorem String.Slice.toInt?_eq_some_iff {s : Slice} {a : Int} :
s.toInt? = some a ↔ (∃ (b : Nat), s.toNat? = some b ∧ a = ↑b) ∨ ∃ (t : String), s.copy = "-" ++ t ∧ ∃ (b : Nat), t.toNat? = some b ∧ a = -↑b
theorem String.Slice.toInt?_eq_of_eq_minus_append {s : Slice} {t : String} (h : s.copy = "-" ++ t) :
s.toInt? = Option.map (fun (n : Nat) => -↑n) t.toNat?
theorem String.Slice.isInt_congr {s t : Slice} (h : s.copy = t.copy) :
theorem String.toInt?_eq_some_iff {s : String} {a : Int} :
s.toInt? = some a ↔ (∃ (b : Nat), s.toNat? = some b ∧ a = ↑b) ∨ ∃ (t : String), s = "-" ++ t ∧ ∃ (b : Nat), t.toNat? = some b ∧ a = -↑b
@[simp]
theorem String.toInt?_minus_append {s : String} :
("-" ++ s).toInt? = Option.map (fun (n : Nat) => -↑n) s.toNat?
@[simp]
theorem Nat.toInt?_repr (n : Nat) :
n.repr.toInt? = some ↑n
@[simp]
theorem Nat.isInt_repr (n : Nat) :
@[simp]
theorem Int.toInt?_repr (a : Int) :
@[simp]
theorem Int.isInt_repr (a : Int) :
theorem Int.repr_injective {a b : Int} (h : a.repr = b.repr) :
a = b
@[simp]
theorem Int.repr_inj {a b : Int} :
a.repr = b.repr ↔ a = b