l3lab/ntp-mathlib huggingface dataset:
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · 

Proof state:
case inr.inr.refine'_1
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ 0 ≤ a / ↑n

Next tactic:
exact div_nonneg ha n.cast_nonneg
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · exact div_nonneg ha n.cast_nonneg
  

Proof state:
case inr.inr.refine'_2
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ ↑(⌊a⌋₊ / n) ≤ a / ↑n ∧ a / ↑n < ↑(⌊a⌋₊ / n) + 1

Next tactic:
constructor
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · exact div_nonneg ha n.cast_nonneg
  constructor
  · 

Proof state:
case inr.inr.refine'_2.left
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ ↑(⌊a⌋₊ / n) ≤ a / ↑n

Next tactic:
exact cast_div_le.trans (div_le_div_of_le_of_nonneg (floor_le ha) n.cast_nonneg)
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · exact div_nonneg ha n.cast_nonneg
  constructor
  · exact cast_div_le.trans (div_le_div_of_le_of_nonneg (floor_le ha) n.cast_nonneg)
  

Proof state:
case inr.inr.refine'_2.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ a / ↑n < ↑(⌊a⌋₊ / n) + 1

Next tactic:
rw [div_lt_iff, add_mul, one_mul, ← cast_mul, ← cast_add, ← floor_lt ha]
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · exact div_nonneg ha n.cast_nonneg
  constructor
  · exact cast_div_le.trans (div_le_div_of_le_of_nonneg (floor_le ha) n.cast_nonneg)
  rw [div_lt_iff, add_mul, one_mul, ← cast_mul, ← cast_add, ← floor_lt ha]
  · 

Proof state:
case inr.inr.refine'_2.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ ⌊a⌋₊ < ⌊a⌋₊ / n * n + n

Next tactic:
exact lt_div_mul_add hn
theorem floor_div_nat (a : α) (n : ℕ) : ⌊a / n⌋₊ = ⌊a⌋₊ / n := by
  rcases le_total a 0 with ha | ha
  · rw [floor_of_nonpos, floor_of_nonpos ha]
    · simp
    apply div_nonpos_of_nonpos_of_nonneg ha n.cast_nonneg
  obtain rfl | hn := n.eq_zero_or_pos
  · rw [cast_zero, div_zero, Nat.div_zero, floor_zero]
  refine' (floor_eq_iff _).2 _
  · exact div_nonneg ha n.cast_nonneg
  constructor
  · exact cast_div_le.trans (div_le_div_of_le_of_nonneg (floor_le ha) n.cast_nonneg)
  rw [div_lt_iff, add_mul, one_mul, ← cast_mul, ← cast_add, ← floor_lt ha]
  · exact lt_div_mul_add hn
  · 

Proof state:
case inr.inr.refine'_2.right
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
a : α
n : ℕ
ha : 0 ≤ a
hn : n > 0
⊢ 0 < ↑n

Next tactic:
exact cast_pos.2 hn
/-- Natural division is the floor of field division. -/
theorem floor_div_eq_div (m n : ℕ) : ⌊(m : α) / n⌋₊ = m / n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
m n : ℕ
⊢ ⌊↑m / ↑n⌋₊ = m / n

Next tactic:
convert floor_div_nat (m : α) n
/-- Natural division is the floor of field division. -/
theorem floor_div_eq_div (m n : ℕ) : ⌊(m : α) / n⌋₊ = m / n := by
  convert floor_div_nat (m : α) n
  

Proof state:
case h.e'_3.h.e'_5
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedSemifield α
inst✝ : FloorSemiring α
m n : ℕ
⊢ m = ⌊↑m⌋₊

Next tactic:
rw [m.floor_coe]
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
⊢ Subsingleton (FloorSemiring α)

Next tactic:
refine' ⟨fun H₁ H₂ => _⟩
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
⊢ H₁ = H₂

Next tactic:
have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
⊢ H₁ = H₂

Next tactic:
have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
⊢ FloorSemiring.floor = FloorSemiring.floor

Next tactic:
ext a
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    

Proof state:
case h
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
⊢ FloorSemiring.floor a = FloorSemiring.floor a

Next tactic:
cases' lt_or_le a 0 with h h
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · 

Proof state:
case h.inl
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
h : a < 0
⊢ FloorSemiring.floor a = FloorSemiring.floor a

Next tactic:
rw [H₁.floor_of_neg, H₂.floor_of_neg]
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> 

Proof state:
case h.inl
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
h : a < 0
⊢ a < 0

Next tactic:
exact h
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · 

Proof state:
case h.inr
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
h : 0 ≤ a
⊢ FloorSemiring.floor a = FloorSemiring.floor a

Next tactic:
refine' eq_of_forall_le_iff fun n => _
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      

Proof state:
case h.inr
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
h : 0 ≤ a
n : ℕ
⊢ n ≤ FloorSemiring.floor a ↔ n ≤ FloorSemiring.floor a

Next tactic:
rw [H₁.gc_floor, H₂.gc_floor]
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      rw [H₁.gc_floor, H₂.gc_floor] <;> 

Proof state:
case h.inr
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this : FloorSemiring.ceil = FloorSemiring.ceil
a : α
h : 0 ≤ a
n : ℕ
⊢ 0 ≤ a

Next tactic:
exact h
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₁ H₂ : FloorSemiring α
this✝ : FloorSemiring.ceil = FloorSemiring.ceil
this : FloorSemiring.floor = FloorSemiring.floor
⊢ H₁ = H₂

Next tactic:
cases H₁
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
  cases H₁
  

Proof state:
case mk
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
H₂ : FloorSemiring α
floor✝ ceil✝ : α → ℕ
floor_of_neg✝ : ∀ {a : α}, a < 0 → floor✝ a = 0
gc_floor✝ : ∀ {a : α} {n : ℕ}, 0 ≤ a → (n ≤ floor✝ a ↔ ↑n ≤ a)
gc_ceil✝ : GaloisConnection ceil✝ Nat.cast
this✝ : FloorSemiring.ceil = FloorSemiring.ceil
this : FloorSemiring.floor = FloorSemiring.floor
⊢ { floor := floor✝, ceil := ceil✝, floor_of_neg := floor_of_neg✝, gc_floor := gc_floor✝, gc_ceil := gc_ceil✝ } = H₂

Next tactic:
cases H₂
/-- There exists at most one `FloorSemiring` structure on a linear ordered semiring. -/
theorem subsingleton_floorSemiring {α} [LinearOrderedSemiring α] :
    Subsingleton (FloorSemiring α) := by
  refine' ⟨fun H₁ H₂ => _⟩
  have : H₁.ceil = H₂.ceil := funext fun a => (H₁.gc_ceil.l_unique H₂.gc_ceil) fun n => rfl
  have : H₁.floor = H₂.floor := by
    ext a
    cases' lt_or_le a 0 with h h
    · rw [H₁.floor_of_neg, H₂.floor_of_neg] <;> exact h
    · refine' eq_of_forall_le_iff fun n => _
      rw [H₁.gc_floor, H₂.gc_floor] <;> exact h
  cases H₁
  cases H₂
  

Proof state:
case mk.mk
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type u_4
inst✝ : LinearOrderedSemiring α
floor✝¹ ceil✝¹ : α → ℕ
floor_of_neg✝¹ : ∀ {a : α}, a < 0 → floor✝¹ a = 0
gc_floor✝¹ : ∀ {a : α} {n : ℕ}, 0 ≤ a → (n ≤ floor✝¹ a ↔ ↑n ≤ a)
gc_ceil✝¹ : GaloisConnection ceil✝¹ Nat.cast
floor✝ ceil✝ : α → ℕ
floor_of_neg✝ : ∀ {a : α}, a < 0 → floor✝ a = 0
gc_floor✝ : ∀ {a : α} {n : ℕ}, 0 ≤ a → (n ≤ floor✝ a ↔ ↑n ≤ a)
gc_ceil✝ : GaloisConnection ceil✝ Nat.cast
this✝ : FloorSemiring.ceil = FloorSemiring.ceil
this : FloorSemiring.floor = FloorSemiring.floor
⊢ { floor := floor✝¹, ceil := ceil✝¹, floor_of_neg := floor_of_neg✝¹, gc_floor := gc_floor✝¹, gc_ceil := gc_ceil✝¹ } =
    { floor := floor✝, ceil := ceil✝, floor_of_neg := floor_of_neg✝, gc_floor := gc_floor✝, gc_ceil := gc_ceil✝ }

Next tactic:
congr
instance : FloorRing ℤ where
  floor := id
  ceil := id
  gc_coe_floor a b := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
a b : ℤ
⊢ ↑a ≤ b ↔ a ≤ id b

Next tactic:
rw [Int.cast_id]
instance : FloorRing ℤ where
  floor := id
  ceil := id
  gc_coe_floor a b := by
    rw [Int.cast_id]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
a b : ℤ
⊢ a ≤ b ↔ a ≤ id b

Next tactic:
rfl
instance : FloorRing ℤ where
  floor := id
  ceil := id
  gc_coe_floor a b := by
    rw [Int.cast_id]
    rfl
  gc_ceil_coe a b := by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
a b : ℤ
⊢ id a ≤ b ↔ a ≤ ↑b

Next tactic:
rw [Int.cast_id]
instance : FloorRing ℤ where
  floor := id
  ceil := id
  gc_coe_floor a b := by
    rw [Int.cast_id]
    rfl
  gc_ceil_coe a b := by
    rw [Int.cast_id]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
a b : ℤ
⊢ id a ≤ b ↔ a ≤ b

Next tactic:
rfl
/-- A `FloorRing` constructor from the `floor` function alone. -/
def FloorRing.ofFloor (α) [LinearOrderedRing α] (floor : α → ℤ)
    (gc_coe_floor : GaloisConnection (↑) floor) : FloorRing α :=
  { floor
    ceil := fun a => -floor (-a)
    gc_coe_floor
    gc_ceil_coe := fun a z => by 

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type ?u.104087
inst✝ : LinearOrderedRing α
floor : α → ℤ
gc_coe_floor : GaloisConnection Int.cast floor
a : α
z : ℤ
⊢ (fun a => -floor (-a)) a ≤ z ↔ a ≤ ↑z

Next tactic:
rw [neg_le, ← gc_coe_floor, Int.cast_neg, neg_le_neg_iff]
/-- A `FloorRing` constructor from the `ceil` function alone. -/
def FloorRing.ofCeil (α) [LinearOrderedRing α] (ceil : α → ℤ)
    (gc_ceil_coe : GaloisConnection ceil (↑)) : FloorRing α :=
  { floor := fun a => -ceil (-a)
    ceil
    gc_coe_floor := fun a z => by 

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
α : Type ?u.105340
inst✝ : LinearOrderedRing α
ceil : α → ℤ
gc_ceil_coe : GaloisConnection ceil Int.cast
a : ℤ
z : α
⊢ ↑a ≤ z ↔ a ≤ (fun a => -ceil (-a)) z

Next tactic:
rw [le_neg, gc_ceil_coe, Int.cast_neg, neg_le_neg_iff]
@[simp]
theorem fract_int : (Int.fract : ℤ → ℤ) = 0 :=
  funext fun x => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
x : ℤ
⊢ fract x = OfNat.ofNat 0 x

Next tactic:
simp [fract]
theorem floor_nonneg : 0 ≤ ⌊a⌋ ↔ 0 ≤ a := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ 0 ≤ ⌊a⌋ ↔ 0 ≤ a

Next tactic:
rw [le_floor, Int.cast_zero]
@[simp]
theorem floor_le_sub_one_iff : ⌊a⌋ ≤ z - 1 ↔ a < z := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ ⌊a⌋ ≤ z - 1 ↔ a < ↑z

Next tactic:
rw [← floor_lt, le_sub_one_iff]
@[simp]
theorem floor_le_neg_one_iff : ⌊a⌋ ≤ -1 ↔ a < 0 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ ⌊a⌋ ≤ -1 ↔ a < 0

Next tactic:
rw [← zero_sub (1 : ℤ), floor_le_sub_one_iff, cast_zero]
theorem floor_nonpos (ha : a ≤ 0) : ⌊a⌋ ≤ 0 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
ha : a ≤ 0
⊢ ⌊a⌋ ≤ 0

Next tactic:
rw [← @cast_le α, Int.cast_zero]
theorem floor_nonpos (ha : a ≤ 0) : ⌊a⌋ ≤ 0 := by
  rw [← @cast_le α, Int.cast_zero]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
ha : a ≤ 0
⊢ ↑⌊a⌋ ≤ 0

Next tactic:
exact (floor_le a).trans ha
@[simp]
theorem lt_floor_add_one (a : α) : a < ⌊a⌋ + 1 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
⊢ a < ↑⌊a⌋ + 1

Next tactic:
simpa only [Int.succ, Int.cast_add, Int.cast_one] using lt_succ_floor a
@[simp]
theorem floor_intCast (z : ℤ) : ⌊(z : α)⌋ = z :=
  eq_of_forall_le_iff fun a => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z✝ : ℤ
a✝ : α
z a : ℤ
⊢ a ≤ ⌊↑z⌋ ↔ a ≤ z

Next tactic:
rw [le_floor, Int.cast_le]
@[simp]
theorem floor_natCast (n : ℕ) : ⌊(n : α)⌋ = n :=
  eq_of_forall_le_iff fun a => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ : α
n : ℕ
a : ℤ
⊢ a ≤ ⌊↑n⌋ ↔ a ≤ ↑n

Next tactic:
rw [le_floor, ← cast_ofNat, cast_le]
@[simp]
theorem floor_zero : ⌊(0 : α)⌋ = 0 := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ ⌊0⌋ = 0

Next tactic:
rw [← cast_zero, floor_intCast]
@[simp]
theorem floor_one : ⌊(1 : α)⌋ = 1 := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ ⌊1⌋ = 1

Next tactic:
rw [← cast_one, floor_intCast]
theorem floor_pos : 0 < ⌊a⌋ ↔ 1 ≤ a := by
  -- Porting note: broken `convert le_floor`
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a : α
⊢ 0 < ⌊a⌋ ↔ 1 ≤ a

Next tactic:
rw [Int.lt_iff_add_one_le, zero_add, le_floor, cast_one]
@[simp]
theorem floor_add_int (a : α) (z : ℤ) : ⌊a + z⌋ = ⌊a⌋ + z :=
  eq_of_forall_le_iff fun a => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z✝ : ℤ
a✝¹ a✝ : α
z a : ℤ
⊢ a ≤ ⌊a✝ + ↑z⌋ ↔ a ≤ ⌊a✝⌋ + z

Next tactic:
rw [le_floor, ← sub_le_iff_le_add, ← sub_le_iff_le_add, le_floor, Int.cast_sub]
@[simp]
theorem floor_add_one (a : α) : ⌊a + 1⌋ = ⌊a⌋ + 1 := by
  -- Porting note: broken `convert floor_add_int a 1`
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
⊢ ⌊a + 1⌋ = ⌊a⌋ + 1

Next tactic:
rw [← cast_one, floor_add_int]
theorem le_floor_add (a b : α) : ⌊a⌋ + ⌊b⌋ ≤ ⌊a + b⌋ := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ⌊a⌋ + ⌊b⌋ ≤ ⌊a + b⌋

Next tactic:
rw [le_floor, Int.cast_add]
theorem le_floor_add (a b : α) : ⌊a⌋ + ⌊b⌋ ≤ ⌊a + b⌋ := by
  rw [le_floor, Int.cast_add]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ↑⌊a⌋ + ↑⌊b⌋ ≤ a + b

Next tactic:
exact add_le_add (floor_le _) (floor_le _)
theorem le_floor_add_floor (a b : α) : ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋ := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋

Next tactic:
rw [← sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
theorem le_floor_add_floor (a b : α) : ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋ := by
  rw [← sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ↑⌊a + b⌋ - 1 - a ≤ ↑⌊b⌋

Next tactic:
refine' le_trans _ (sub_one_lt_floor _).le
theorem le_floor_add_floor (a b : α) : ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋ := by
  rw [← sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
  refine' le_trans _ (sub_one_lt_floor _).le
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ↑⌊a + b⌋ - 1 - a ≤ b - 1

Next tactic:
rw [sub_le_iff_le_add', ← add_sub_assoc, sub_le_sub_iff_right]
theorem le_floor_add_floor (a b : α) : ⌊a + b⌋ - 1 ≤ ⌊a⌋ + ⌊b⌋ := by
  rw [← sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
  refine' le_trans _ (sub_one_lt_floor _).le
  rw [sub_le_iff_le_add', ← add_sub_assoc, sub_le_sub_iff_right]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a b : α
⊢ ↑⌊a + b⌋ ≤ a + b

Next tactic:
exact floor_le _
@[simp]
theorem floor_int_add (z : ℤ) (a : α) : ⌊↑z + a⌋ = z + ⌊a⌋ := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z✝ : ℤ
a✝ : α
z : ℤ
a : α
⊢ ⌊↑z + a⌋ = z + ⌊a⌋

Next tactic:
simpa only [add_comm] using floor_add_int a z
@[simp]
theorem floor_add_nat (a : α) (n : ℕ) : ⌊a + n⌋ = ⌊a⌋ + n := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
n : ℕ
⊢ ⌊a + ↑n⌋ = ⌊a⌋ + ↑n

Next tactic:
rw [← Int.cast_ofNat, floor_add_int]
@[simp]
theorem floor_nat_add (n : ℕ) (a : α) : ⌊↑n + a⌋ = n + ⌊a⌋ := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ : α
n : ℕ
a : α
⊢ ⌊↑n + a⌋ = ↑n + ⌊a⌋

Next tactic:
rw [← Int.cast_ofNat, floor_int_add]
@[simp]
theorem floor_sub_int (a : α) (z : ℤ) : ⌊a - z⌋ = ⌊a⌋ - z :=
  Eq.trans (by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z✝ : ℤ
a✝ a : α
z : ℤ
⊢ ⌊a - ↑z⌋ = ⌊a + ↑(-z)⌋

Next tactic:
rw [Int.cast_neg, sub_eq_add_neg]
@[simp]
theorem floor_sub_nat (a : α) (n : ℕ) : ⌊a - n⌋ = ⌊a⌋ - n := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : LinearOrderedRing α
inst✝ : FloorRing α
z : ℤ
a✝ a : α
n : ℕ
⊢ ⌊a - ↑n⌋ = ⌊a⌋ - ↑n

Next tactic:
rw [← Int.cast_ofNat, floor_sub_int]
theorem abs_sub_lt_one_of_floor_eq_floor {α : Type*} [LinearOrderedCommRing α] [FloorRing α]
    {a b : α} (h : ⌊a⌋ = ⌊b⌋) : |a - b| < 1 := by
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
inst✝³ : LinearOrderedRing α✝
inst✝² : FloorRing α✝
z : ℤ
a✝ : α✝
α : Type u_4
inst✝¹ : LinearOrderedCommRing α
inst✝ : FloorRing α
a b : α
h : ⌊a⌋ = ⌊b⌋
⊢ |a - b| < 1

Next tactic:
have : a < ⌊a⌋ + 1 := lt_floor_add_one a