-- src/Iris/Algebra/Frac.lean

import Iris.Algebra.CMRA

import Iris.Algebra.OFE

namespace Iris

namespace Fraction

variable [Fraction α]

end Fraction

open Fraction OFE CMRA

section NumericFraction

class NumericFraction (α : Type _) extends One α, Add α, LE α, LT α where
  add_comm : ∀ a b : α, a + b = b + a
  add_assoc : ∀ a b c : α, a + (b + c) = (a + b) + c
  add_left_cancel : ∀ {a b c : α}, a + b = a + c → b = c
  le_def : ∀ {a b : α}, a ≤ b ↔ a = b ∨ a < b
  lt_def : ∀ {a b : α}, a < b ↔ ∃ c : α, a + c = b
  lt_irrefl : ∀ {a : α}, ¬a < a

variable {α} [NumericFraction α]

open NumericFraction

-- Repository definitions used:
content: ...

-- Repository lemmas used:
content: theorem List.getElem_append_left{α : Type u_1} {l₁ l₂ : List α} {i : Nat} (hn : i < l₁.length) :\n(l₁ ++ l₂)[i] = l₁[i]

-- Local definitions used:
content: class NumericFraction (α : Type _) extends One α, Add α, LE α, LT α where
  add_comm : ∀ a b : α, a + b = b + a
  add_assoc : ∀ a b c : α, a + (b + c) = (a + b) + c
  add_left_cancel : ∀ {a b c : α}, a + b = a + c → b = c
  le_def : ∀ {a b : α}, a ≤ b ↔ a = b ∨ a < b
  lt_def : ∀ {a b : α}, a < b ↔ ∃ c : α, a + c = b
  lt_irrefl : ∀ {a : α}, ¬a < a

-- Local lemmas used:
content: theorem add_ne_self {a b : α} : a + b ≠ a

content: theorem not_add_lt_self {a b : α} : ¬a + b < a

-- Target theorem and proof:
theorem not_add_le_self {a b : α} : ¬ a + b ≤ a
:= fun H => by
  obtain H | H := le_def.mp H
  · exact add_ne_self H
  · exact not_add_lt_self H