File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Mathlib/Algebra/Order/Interval Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Yaël Dillies
55-/
66import Mathlib.Algebra.Group.Pointwise.Set.Basic
7+ import Mathlib.Algebra.Ring.Prod
78import Mathlib.Algebra.Order.BigOperators.Group.Finset
9+ import Mathlib.Algebra.Order.Ring.Canonical
810import Mathlib.Order.Interval.Basic
911import Mathlib.Tactic.Positivity.Core
1012
@@ -263,6 +265,40 @@ theorem bot_pow : ∀ {n : ℕ}, n ≠ 0 → (⊥ : Interval α) ^ n = ⊥
263265
264266end Interval
265267
268+ /-!
269+ ### Semiring structure
270+
271+ When `α` is a canonically `OrderedCommSemiring`, the previous `+` and `*` on `NonemptyInterval α`
272+ form a `CommSemiring`.
273+ -/
274+
275+ section NatCast
276+ variable [Preorder α] [NatCast α]
277+
278+ namespace NonemptyInterval
279+
280+ instance : NatCast (NonemptyInterval α) where
281+ natCast n := pure <| Nat.cast n
282+
283+ theorem fst_natCast (n : ℕ) : (n : NonemptyInterval α).fst = n := rfl
284+
285+ theorem snd_natCast (n : ℕ) : (n : NonemptyInterval α).snd = n := rfl
286+
287+ @[simp]
288+ theorem pure_natCast (n : ℕ) : pure (n : α) = n := rfl
289+
290+ end NonemptyInterval
291+
292+ end NatCast
293+
294+ namespace NonemptyInterval
295+
296+ instance [OrderedCommSemiring α] [CanonicallyOrderedAdd α] : CommSemiring (NonemptyInterval α) :=
297+ NonemptyInterval.toProd_injective.commSemiring _
298+ toProd_zero toProd_one toProd_add toProd_mul (swap toProd_nsmul) toProd_pow (fun _ => rfl)
299+
300+ end NonemptyInterval
301+
266302/-!
267303### Subtraction
268304
You can’t perform that action at this time.
0 commit comments