Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit c4c279e

Browse files
committed
feat(data/real/nnreal): add nnreal.le_infi_add_infi and other lemmas (#14048)
* add `nnreal.coe_two`, `nnreal.le_infi_add_infi`, `nnreal.half_le_self`; * generalize `le_cinfi_mul_cinfi`, `csupr_mul_csupr_le`, and their additive versions to allow two different index types.
1 parent a945b18 commit c4c279e

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/data/real/basic.lean

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,7 @@ real.Sup_of_not_bdd_above $ λ ⟨x, h⟩, not_le_of_lt (lt_add_one _) $ h (set.
491491
by simp [Inf_def, Sup_empty]
492492

493493
lemma cinfi_empty {α : Sort*} [is_empty α] (f : α → ℝ) : (⨅ i, f i) = 0 :=
494-
begin
495-
dsimp [infi],
496-
convert real.Inf_empty,
497-
rw set.range_eq_empty_iff,
498-
apply_instance
499-
end
494+
by rw [infi_of_empty', Inf_empty]
500495

501496
@[simp] lemma cinfi_const_zero {α : Sort*} : (⨅ i : α, (0:ℝ)) = 0 :=
502497
begin

src/data/real/nnreal.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ protected lemma coe_inv (r : ℝ≥0) : ((r⁻¹ : ℝ≥0) : ℝ) = r⁻¹ := r
122122
protected lemma coe_div (r₁ r₂ : ℝ≥0) : ((r₁ / r₂ : ℝ≥0) : ℝ) = r₁ / r₂ := rfl
123123
@[simp, norm_cast] protected lemma coe_bit0 (r : ℝ≥0) : ((bit0 r : ℝ≥0) : ℝ) = bit0 r := rfl
124124
@[simp, norm_cast] protected lemma coe_bit1 (r : ℝ≥0) : ((bit1 r : ℝ≥0) : ℝ) = bit1 r := rfl
125+
protected lemma coe_two : ((2 : ℝ≥0) : ℝ) = 2 := rfl
125126

126127
@[simp, norm_cast] protected lemma coe_sub {r₁ r₂ : ℝ≥0} (h : r₂ ≤ r₁) :
127128
((r₁ - r₂ : ℝ≥0) : ℝ) = r₁ - r₂ :=
@@ -319,6 +320,13 @@ eq.symm $ @subset_Inf_of_within ℝ (set.Ici 0) _ ⟨(0 : ℝ≥0)⟩ s $
319320
@[norm_cast] lemma coe_infi {ι : Sort*} (s : ι → ℝ≥0) : (↑(⨅ i, s i) : ℝ) = ⨅ i, (s i) :=
320321
by rw [infi, infi, coe_Inf, set.range_comp]
321322

323+
lemma le_infi_add_infi {ι ι' : Sort*} [nonempty ι] [nonempty ι'] {f : ι → ℝ≥0} {g : ι' → ℝ≥0}
324+
{a : ℝ≥0} (h : ∀ i j, a ≤ f i + g j) : a ≤ (⨅ i, f i) + ⨅ j, g j :=
325+
begin
326+
rw [← nnreal.coe_le_coe, nnreal.coe_add, coe_infi, coe_infi],
327+
exact le_cinfi_add_cinfi h
328+
end
329+
322330
example : archimedean ℝ≥0 := by apply_instance
323331

324332
-- TODO: why are these three instances necessary? why aren't they inferred?
@@ -653,6 +661,8 @@ lemma half_pos {a : ℝ≥0} (h : 0 < a) : 0 < a / 2 := div_pos h zero_lt_two
653661

654662
lemma add_halves (a : ℝ≥0) : a / 2 + a / 2 = a := nnreal.eq (add_halves a)
655663

664+
lemma half_le_self (a : ℝ≥0) : a / 2 ≤ a := nnreal.coe_le_coe.mp $ half_le_self a.coe_nonneg
665+
656666
lemma half_lt_self {a : ℝ≥0} (h : a ≠ 0) : a / 2 < a :=
657667
by rw [← nnreal.coe_lt_coe, nnreal.coe_div]; exact
658668
half_lt_self (bot_lt_iff_ne_bot.2 h)

src/order/conditionally_complete_lattice.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ end with_top_bot
10681068

10691069
section group
10701070

1071-
variables [nonempty ι] [conditionally_complete_lattice α] [group α]
1071+
variables {ι' : Sort*} [nonempty ι] [nonempty ι'] [conditionally_complete_lattice α] [group α]
10721072

10731073
@[to_additive]
10741074
lemma le_mul_cinfi [covariant_class α α (*) (≤)] {a : α} {g : α} {h : ι → α}
@@ -1092,12 +1092,12 @@ lemma csupr_mul_le [covariant_class α α (function.swap (*)) (≤)] {a : α} {g
10921092

10931093
@[to_additive]
10941094
lemma le_cinfi_mul_cinfi [covariant_class α α (*) (≤)] [covariant_class α α (function.swap (*)) (≤)]
1095-
{a : α} {g h : ι → α} (H : ∀ i j, a ≤ g i * h j) : a ≤ infi g * infi h :=
1095+
{a : α} {g : ι → α} {h : ι' → α} (H : ∀ i j, a ≤ g i * h j) : a ≤ infi g * infi h :=
10961096
le_cinfi_mul $ λ i, le_mul_cinfi $ H _
10971097

10981098
@[to_additive]
10991099
lemma csupr_mul_csupr_le [covariant_class α α (*) (≤)] [covariant_class α α (function.swap (*)) (≤)]
1100-
{a : α} {g h : ι → α} (H : ∀ i j, g i * h j ≤ a) : supr g * supr h ≤ a :=
1100+
{a : α} {g : ι → α} {h : ι' → α} (H : ∀ i j, g i * h j ≤ a) : supr g * supr h ≤ a :=
11011101
csupr_mul_le $ λ i, mul_csupr_le $ H _
11021102

11031103
end group

0 commit comments

Comments
 (0)